|
Lines 19-24
Link Here
|
| 19 |
* bug 370639 - [compiler][resource] restore the default for resource leak warnings |
19 |
* bug 370639 - [compiler][resource] restore the default for resource leak warnings |
| 20 |
* bug 365859 - [compiler][null] distinguish warnings based on flow analysis vs. null annotations |
20 |
* bug 365859 - [compiler][null] distinguish warnings based on flow analysis vs. null annotations |
| 21 |
* bug 374605 - Unreasonable warning for enum-based switch statements |
21 |
* bug 374605 - Unreasonable warning for enum-based switch statements |
|
|
22 |
* bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set |
| 22 |
*******************************************************************************/ |
23 |
*******************************************************************************/ |
| 23 |
package org.eclipse.jdt.core.tests.compiler.regression; |
24 |
package org.eclipse.jdt.core.tests.compiler.regression; |
| 24 |
|
25 |
|
|
Lines 81-87
Link Here
|
| 81 |
"}\n"; |
82 |
"}\n"; |
| 82 |
|
83 |
|
| 83 |
static { |
84 |
static { |
| 84 |
// TESTS_NAMES = new String[] { "testBug375409e" }; |
85 |
// TESTS_NAMES = new String[] { "testBug375366" }; |
| 85 |
// TESTS_NUMBERS = new int[] { 306 }; |
86 |
// TESTS_NUMBERS = new int[] { 306 }; |
| 86 |
// TESTS_RANGE = new int[] { 298, -1 }; |
87 |
// TESTS_RANGE = new int[] { 298, -1 }; |
| 87 |
} |
88 |
} |
|
Lines 13467-13470
Link Here
|
| 13467 |
"", |
13468 |
"", |
| 13468 |
true); |
13469 |
true); |
| 13469 |
} |
13470 |
} |
|
|
13471 |
// Bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set |
| 13472 |
// when -properties is used process javadoc by default |
| 13473 |
public void testBug375366a() throws IOException { |
| 13474 |
createOutputTestDirectory("regression/.settings"); |
| 13475 |
Util.createFile(OUTPUT_DIR+"/.settings/org.eclipse.jdt.core.prefs", |
| 13476 |
"eclipse.preferences.version=1\n" + |
| 13477 |
"org.eclipse.jdt.core.compiler.problem.unusedParameter=warning\n"); |
| 13478 |
this.runConformTest( |
| 13479 |
new String[] { |
| 13480 |
"bugs/warning/ShowBug.java", |
| 13481 |
"package bugs.warning;\n" + |
| 13482 |
"\n" + |
| 13483 |
"public class ShowBug {\n" + |
| 13484 |
" /**\n" + |
| 13485 |
" * \n" + |
| 13486 |
" * @param unusedParam\n" + |
| 13487 |
" */\n" + |
| 13488 |
" public void foo(Object unusedParam) {\n" + |
| 13489 |
" \n" + |
| 13490 |
" }\n" + |
| 13491 |
"}\n" |
| 13492 |
}, |
| 13493 |
"\"" + OUTPUT_DIR + File.separator + "bugs" + File.separator + "warning" + File.separator + "ShowBug.java\"" |
| 13494 |
+ " -1.5" |
| 13495 |
+ " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs " |
| 13496 |
+ " -d \"" + OUTPUT_DIR + "\"", |
| 13497 |
"", |
| 13498 |
"", |
| 13499 |
false /*don't flush output dir*/); |
| 13500 |
} |
| 13501 |
|
| 13502 |
// Bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set |
| 13503 |
// property file explicitly disables javadoc processing |
| 13504 |
public void testBug375366b() throws IOException { |
| 13505 |
createOutputTestDirectory("regression/.settings"); |
| 13506 |
Util.createFile(OUTPUT_DIR+"/.settings/org.eclipse.jdt.core.prefs", |
| 13507 |
"eclipse.preferences.version=1\n" + |
| 13508 |
"org.eclipse.jdt.core.compiler.problem.unusedParameter=warning\n" + |
| 13509 |
"org.eclipse.jdt.core.compiler.doc.comment.support=disabled\n"); |
| 13510 |
this.runTest( |
| 13511 |
true, // compile OK, expecting only warning |
| 13512 |
new String[] { |
| 13513 |
"bugs/warning/ShowBug.java", |
| 13514 |
"package bugs.warning;\n" + |
| 13515 |
"\n" + |
| 13516 |
"public class ShowBug {\n" + |
| 13517 |
" /**\n" + |
| 13518 |
" * \n" + |
| 13519 |
" * @param unusedParam\n" + |
| 13520 |
" */\n" + |
| 13521 |
" public void foo(Object unusedParam) {\n" + |
| 13522 |
" \n" + |
| 13523 |
" }\n" + |
| 13524 |
"}\n" |
| 13525 |
}, |
| 13526 |
"\"" + OUTPUT_DIR + File.separator + "bugs" + File.separator + "warning" + File.separator + "ShowBug.java\"" |
| 13527 |
+ " -1.5" |
| 13528 |
+ " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs " |
| 13529 |
+ " -d \"" + OUTPUT_DIR + "\"", |
| 13530 |
"", |
| 13531 |
"----------\n" + |
| 13532 |
"1. WARNING in ---OUTPUT_DIR_PLACEHOLDER---/bugs/warning/ShowBug.java (at line 8)\n" + |
| 13533 |
" public void foo(Object unusedParam) {\n" + |
| 13534 |
" ^^^^^^^^^^^\n" + |
| 13535 |
"The value of the parameter unusedParam is not used\n" + |
| 13536 |
"----------\n" + |
| 13537 |
"1 problem (1 warning)", |
| 13538 |
false /*don't flush output dir*/, |
| 13539 |
null /* progress */); |
| 13540 |
} |
| 13541 |
|
| 13542 |
// Bug 375366 - ECJ ignores unusedParameterIncludeDocCommentReference unless enableJavadoc option is set |
| 13543 |
// property file enables null annotation support |
| 13544 |
public void testBug375366c() throws IOException { |
| 13545 |
createOutputTestDirectory("regression/.settings"); |
| 13546 |
Util.createFile(OUTPUT_DIR+"/.settings/org.eclipse.jdt.core.prefs", |
| 13547 |
"eclipse.preferences.version=1\n" + |
| 13548 |
"org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled\n"); |
| 13549 |
this.runNegativeTest( |
| 13550 |
new String[] { |
| 13551 |
"p/X.java", |
| 13552 |
"package p;\n" + |
| 13553 |
"import org.eclipse.jdt.annotation.*;\n" + |
| 13554 |
"public class X {\n" + |
| 13555 |
" @NonNull Object foo(@Nullable Object o, @NonNull Object o2) {\n" + |
| 13556 |
" return this;\n" + |
| 13557 |
" }\n" + |
| 13558 |
"}\n" + |
| 13559 |
"class Y extends X {\n" + |
| 13560 |
" @Nullable Object foo(Object o, Object o2) { return null; }\n" + |
| 13561 |
"}\n", |
| 13562 |
"org/eclipse/jdt/annotation/NonNull.java", |
| 13563 |
NONNULL_ANNOTATION_CONTENT, |
| 13564 |
"org/eclipse/jdt/annotation/Nullable.java", |
| 13565 |
NULLABLE_ANNOTATION_CONTENT, |
| 13566 |
"org/eclipse/jdt/annotation/NonNullByDefault.java", |
| 13567 |
NONNULL_BY_DEFAULT_ANNOTATION_CONTENT |
| 13568 |
}, |
| 13569 |
"\"" + OUTPUT_DIR + File.separator + "p" + File.separator + "X.java\"" |
| 13570 |
+ " -sourcepath \"" + OUTPUT_DIR + "\"" |
| 13571 |
+ " -1.5" |
| 13572 |
+ " -properties " + OUTPUT_DIR + File.separator +".settings" + File.separator + "org.eclipse.jdt.core.prefs " |
| 13573 |
+ " -d \"" + OUTPUT_DIR + "\"", |
| 13574 |
"", |
| 13575 |
"----------\n" + |
| 13576 |
"1. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 9)\n" + |
| 13577 |
" @Nullable Object foo(Object o, Object o2) { return null; }\n" + |
| 13578 |
" ^^^^^^^^^^^^^^^^\n" + |
| 13579 |
"The return type is incompatible with the @NonNull return from X.foo(Object, Object)\n" + |
| 13580 |
"----------\n" + |
| 13581 |
"2. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 9)\n" + |
| 13582 |
" @Nullable Object foo(Object o, Object o2) { return null; }\n" + |
| 13583 |
" ^^^^^^\n" + |
| 13584 |
"Missing nullable annotation: inherited method from X declares this parameter as @Nullable\n" + |
| 13585 |
"----------\n" + |
| 13586 |
"3. ERROR in ---OUTPUT_DIR_PLACEHOLDER---/p/X.java (at line 9)\n" + |
| 13587 |
" @Nullable Object foo(Object o, Object o2) { return null; }\n" + |
| 13588 |
" ^^^^^^\n" + |
| 13589 |
"Missing non-null annotation: inherited method from X declares this parameter as @NonNull\n" + |
| 13590 |
"----------\n" + |
| 13591 |
"3 problems (3 errors)", |
| 13592 |
false/*don't flush*/); |
| 13593 |
} |
| 13470 |
} |
13594 |
} |