Lines 13-18
Link Here
|
13 |
* bug 295551 - Add option to automatically promote all warnings to errors |
13 |
* bug 295551 - Add option to automatically promote all warnings to errors |
14 |
* bug 185682 - Increment/decrement operators mark local variables as read |
14 |
* bug 185682 - Increment/decrement operators mark local variables as read |
15 |
* bug 349326 - [1.7] new warning for missing try-with-resources |
15 |
* bug 349326 - [1.7] new warning for missing try-with-resources |
|
|
16 |
* bug 359721 - [options] add command line option for new warning token "resource" |
16 |
*******************************************************************************/ |
17 |
*******************************************************************************/ |
17 |
package org.eclipse.jdt.core.tests.compiler.regression; |
18 |
package org.eclipse.jdt.core.tests.compiler.regression; |
18 |
|
19 |
|
Lines 1705-1710
Link Here
|
1705 |
" paramAssign assignment to a parameter\n" + |
1706 |
" paramAssign assignment to a parameter\n" + |
1706 |
" pkgDefaultMethod + attempt to override package-default method\n" + |
1707 |
" pkgDefaultMethod + attempt to override package-default method\n" + |
1707 |
" raw + usage of raw type\n" + |
1708 |
" raw + usage of raw type\n" + |
|
|
1709 |
" resource + (potential) leaks of resources of type Closeable\n" + |
1708 |
" semicolon unnecessary semicolon, empty statement\n" + |
1710 |
" semicolon unnecessary semicolon, empty statement\n" + |
1709 |
" serial + missing serialVersionUID\n" + |
1711 |
" serial + missing serialVersionUID\n" + |
1710 |
" specialParamHiding constructor or setter parameter hiding a field\n" + |
1712 |
" specialParamHiding constructor or setter parameter hiding a field\n" + |
Lines 12241-12244
Link Here
|
12241 |
"3 problems (1 error, 2 warnings)", |
12243 |
"3 problems (1 error, 2 warnings)", |
12242 |
true); |
12244 |
true); |
12243 |
} |
12245 |
} |
|
|
12246 |
//-warn option - regression tests |
12247 |
public void test0308_warn_options() { |
12248 |
// check the option introduced in bug 359721 |
12249 |
this.runConformTest( |
12250 |
new String[] { |
12251 |
"X.java", |
12252 |
"import java.io.FileReader;\n" + |
12253 |
"public class X {\n" + |
12254 |
" void foo() throws java.io.IOException {\n" + |
12255 |
" FileReader r = new FileReader(\"f1\");\n" + |
12256 |
" char[] cs = new char[1024];\n" + |
12257 |
" r.read(cs);\n" + |
12258 |
" }\n" + |
12259 |
"}\n" |
12260 |
}, |
12261 |
"\"" + OUTPUT_DIR + File.separator + "X.java\"" |
12262 |
+ " -warn:-resource -1.7 -d \"" + OUTPUT_DIR + "\"", |
12263 |
"", |
12264 |
"", |
12265 |
true); |
12266 |
} |
12267 |
//-warn option - regression tests |
12268 |
public void test0309_warn_options() { |
12269 |
// check the option introduced in bug 359721 |
12270 |
this.runConformTest( |
12271 |
new String[] { |
12272 |
"X.java", |
12273 |
"import java.io.FileReader;\n" + |
12274 |
"public class X {\n" + |
12275 |
" void foo(boolean b) throws java.io.IOException {\n" + |
12276 |
" FileReader r = new FileReader(\"f1\");\n" + |
12277 |
" char[] cs = new char[1024];\n" + |
12278 |
" r.read(cs);\n" + |
12279 |
" if (b) r.close();\n" + |
12280 |
" }\n" + |
12281 |
"}\n" |
12282 |
}, |
12283 |
"\"" + OUTPUT_DIR + File.separator + "X.java\"" |
12284 |
+ " -warn:+resource -1.7 -d \"" + OUTPUT_DIR + "\"", |
12285 |
"", |
12286 |
"----------\n" + |
12287 |
"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/X.java (at line 4)\n" + |
12288 |
" FileReader r = new FileReader(\"f1\");\n" + |
12289 |
" ^\n" + |
12290 |
"Potential resource leak: \'r\' may not be closed\n" + |
12291 |
"----------\n" + |
12292 |
"1 problem (1 warning)", |
12293 |
true); |
12294 |
} |
12244 |
} |
12295 |
} |