|
Lines 45-51
Link Here
|
| 45 |
// All specified tests which do not belong to the class are skipped... |
45 |
// All specified tests which do not belong to the class are skipped... |
| 46 |
static { |
46 |
static { |
| 47 |
// TESTS_NAMES = new String[] { "test127" }; |
47 |
// TESTS_NAMES = new String[] { "test127" }; |
| 48 |
// TESTS_NUMBERS = new int[] { 278 }; |
48 |
// TESTS_NUMBERS = new int[] { 285 }; |
| 49 |
// TESTS_RANGE = new int[] { 249, -1 }; |
49 |
// TESTS_RANGE = new int[] { 249, -1 }; |
| 50 |
} |
50 |
} |
| 51 |
|
51 |
|
|
Lines 998-1004
Link Here
|
| 998 |
this.runConformTest( |
998 |
this.runConformTest( |
| 999 |
new String[] { |
999 |
new String[] { |
| 1000 |
"X.java", |
1000 |
"X.java", |
| 1001 |
"@Foo(type=String.class) public class X {\r\n" + |
1001 |
"@Foo(type=String.class) public class X {\n" + |
| 1002 |
"}" |
1002 |
"}" |
| 1003 |
}, |
1003 |
}, |
| 1004 |
"", |
1004 |
"", |
|
Lines 1247-1254
Link Here
|
| 1247 |
"}\n" |
1247 |
"}\n" |
| 1248 |
}, |
1248 |
}, |
| 1249 |
"----------\n" + |
1249 |
"----------\n" + |
| 1250 |
"1. ERROR in X.java (at line 12)\r\n" + |
1250 |
"1. ERROR in X.java (at line 12)\n" + |
| 1251 |
" public @MyAnn void something() { } \r\n" + |
1251 |
" public @MyAnn void something() { } \n" + |
| 1252 |
" ^^^^^^\n" + |
1252 |
" ^^^^^^\n" + |
| 1253 |
"The annotation @MyAnn is disallowed for this location\n" + |
1253 |
"The annotation @MyAnn is disallowed for this location\n" + |
| 1254 |
"----------\n"); |
1254 |
"----------\n"); |
|
Lines 2724-2731
Link Here
|
| 2724 |
"}\n" |
2724 |
"}\n" |
| 2725 |
}, |
2725 |
}, |
| 2726 |
"----------\n" + |
2726 |
"----------\n" + |
| 2727 |
"1. ERROR in X.java (at line 4)\r\n" + |
2727 |
"1. ERROR in X.java (at line 4)\n" + |
| 2728 |
" @Inherited\r\n" + |
2728 |
" @Inherited\n" + |
| 2729 |
" ^^^^^^^^^^\n" + |
2729 |
" ^^^^^^^^^^\n" + |
| 2730 |
"The annotation @Inherited is disallowed for this location\n" + |
2730 |
"The annotation @Inherited is disallowed for this location\n" + |
| 2731 |
"----------\n"); |
2731 |
"----------\n"); |
|
Lines 2959-2966
Link Here
|
| 2959 |
"}\n", |
2959 |
"}\n", |
| 2960 |
}, |
2960 |
}, |
| 2961 |
"----------\n" + |
2961 |
"----------\n" + |
| 2962 |
"1. ERROR in X.java (at line 3)\r\n" + |
2962 |
"1. ERROR in X.java (at line 3)\n" + |
| 2963 |
" @Target(Element)\r\n" + |
2963 |
" @Target(Element)\n" + |
| 2964 |
" ^^^^^^^\n" + |
2964 |
" ^^^^^^^\n" + |
| 2965 |
"Element cannot be resolved to a variable\n" + |
2965 |
"Element cannot be resolved to a variable\n" + |
| 2966 |
"----------\n"); |
2966 |
"----------\n"); |
|
Lines 4369-4376
Link Here
|
| 4369 |
public void test140() { |
4369 |
public void test140() { |
| 4370 |
String expectedOutput = new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6 |
4370 |
String expectedOutput = new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6 |
| 4371 |
? "----------\n" + |
4371 |
? "----------\n" + |
| 4372 |
"1. ERROR in X.java (at line 6)\r\n" + |
4372 |
"1. ERROR in X.java (at line 6)\n" + |
| 4373 |
" static void foo(){} \r\n" + |
4373 |
" static void foo(){} \n" + |
| 4374 |
" ^^^^^\n" + |
4374 |
" ^^^^^\n" + |
| 4375 |
"The method foo() of type Bar must override a superclass method\n" + |
4375 |
"The method foo() of type Bar must override a superclass method\n" + |
| 4376 |
"----------\n" |
4376 |
"----------\n" |
|
Lines 4504-4509
Link Here
|
| 4504 |
true, |
4504 |
true, |
| 4505 |
raiseInvalidJavadocSeverity); |
4505 |
raiseInvalidJavadocSeverity); |
| 4506 |
} |
4506 |
} |
|
|
4507 |
// check that @SuppressWarning is reported as unused when corresponding warning is moved from |
| 4508 |
// warning to error |
| 4507 |
public void test142c() { |
4509 |
public void test142c() { |
| 4508 |
Map raiseDeprecationReduceInvalidJavadocSeverity = |
4510 |
Map raiseDeprecationReduceInvalidJavadocSeverity = |
| 4509 |
new HashMap(2); |
4511 |
new HashMap(2); |
|
Lines 4535-4550
Link Here
|
| 4535 |
}, |
4537 |
}, |
| 4536 |
null, |
4538 |
null, |
| 4537 |
raiseDeprecationReduceInvalidJavadocSeverity, |
4539 |
raiseDeprecationReduceInvalidJavadocSeverity, |
| 4538 |
"----------\n" + |
4540 |
"----------\n" + |
| 4539 |
"1. ERROR in X.java (at line 2)\n" + |
4541 |
"1. WARNING in X.java (at line 1)\n" + |
| 4540 |
" public class X extends p.OldStuff {\n" + |
4542 |
" @SuppressWarnings(\"deprecation\")\n" + |
| 4541 |
" ^^^^^^^^^^\n" + |
4543 |
" ^^^^^^^^^^^^^\n" + |
| 4542 |
"The type OldStuff is deprecated\n" + |
4544 |
"Unnecessary @SuppressWarnings(\"deprecation\")\n" + |
| 4543 |
"----------\n" + |
4545 |
"----------\n" + |
| 4544 |
"2. ERROR in X.java (at line 8)\n" + |
4546 |
"2. ERROR in X.java (at line 2)\n" + |
| 4545 |
" super.foo();\n" + |
4547 |
" public class X extends p.OldStuff {\n" + |
| 4546 |
" ^^^^^^^^^^^\n" + |
4548 |
" ^^^^^^^^^^\n" + |
| 4547 |
"The method foo() from the type OldStuff is deprecated\n" + |
4549 |
"The type OldStuff is deprecated\n" + |
|
|
4550 |
"----------\n" + |
| 4551 |
"3. ERROR in X.java (at line 8)\n" + |
| 4552 |
" super.foo();\n" + |
| 4553 |
" ^^^^^^^^^^^\n" + |
| 4554 |
"The method foo() from the type OldStuff is deprecated\n" + |
| 4548 |
"----------\n", |
4555 |
"----------\n", |
| 4549 |
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); |
4556 |
JavacTestOptions.Excuse.EclipseWarningConfiguredAsError); |
| 4550 |
} |
4557 |
} |
|
Lines 5832-5841
Link Here
|
| 5832 |
"import static java.lang.annotation.RetentionPolicy.*;\n" + |
5839 |
"import static java.lang.annotation.RetentionPolicy.*;\n" + |
| 5833 |
"import java.lang.annotation.Retention;\n" + |
5840 |
"import java.lang.annotation.Retention;\n" + |
| 5834 |
"import java.lang.annotation.Target;\n" + |
5841 |
"import java.lang.annotation.Target;\n" + |
| 5835 |
"@Target({TYPE, FIELD, METHOD,\r\n" + |
5842 |
"@Target({TYPE, FIELD, METHOD,\n" + |
| 5836 |
" PARAMETER, CONSTRUCTOR,\r\n" + |
5843 |
" PARAMETER, CONSTRUCTOR,\n" + |
| 5837 |
" LOCAL_VARIABLE, PACKAGE,})\r\n" + |
5844 |
" LOCAL_VARIABLE, PACKAGE,})\n" + |
| 5838 |
"@Retention(CLASS)\r\n" + |
5845 |
"@Retention(CLASS)\n" + |
| 5839 |
"public @interface X {}" |
5846 |
"public @interface X {}" |
| 5840 |
}, |
5847 |
}, |
| 5841 |
"", |
5848 |
"", |
|
Lines 6328-6335
Link Here
|
| 6328 |
"}" |
6335 |
"}" |
| 6329 |
}, |
6336 |
}, |
| 6330 |
"----------\n" + |
6337 |
"----------\n" + |
| 6331 |
"1. ERROR in A.java (at line 2)\r\n" + |
6338 |
"1. ERROR in A.java (at line 2)\n" + |
| 6332 |
" A circular1();\r\n" + |
6339 |
" A circular1();\n" + |
| 6333 |
" ^\n" + |
6340 |
" ^\n" + |
| 6334 |
"Cycle detected: the annotation type A cannot contain attributes of the annotation type itself\n" + |
6341 |
"Cycle detected: the annotation type A cannot contain attributes of the annotation type itself\n" + |
| 6335 |
"----------\n" |
6342 |
"----------\n" |
|
Lines 6346-6363
Link Here
|
| 6346 |
"}" |
6353 |
"}" |
| 6347 |
}, |
6354 |
}, |
| 6348 |
"----------\n" + |
6355 |
"----------\n" + |
| 6349 |
"1. ERROR in A.java (at line 2)\r\n" + |
6356 |
"1. ERROR in A.java (at line 2)\n" + |
| 6350 |
" B circular2();\r\n" + |
6357 |
" B circular2();\n" + |
| 6351 |
" ^\n" + |
6358 |
" ^\n" + |
| 6352 |
"Cycle detected: a cycle exists between annotation attributes of A and B\n" + |
6359 |
"Cycle detected: a cycle exists between annotation attributes of A and B\n" + |
| 6353 |
"----------\n" + |
6360 |
"----------\n" + |
| 6354 |
"2. ERROR in A.java (at line 3)\r\n" + |
6361 |
"2. ERROR in A.java (at line 3)\n" + |
| 6355 |
" A circular1();\r\n" + |
6362 |
" A circular1();\n" + |
| 6356 |
" ^\n" + |
6363 |
" ^\n" + |
| 6357 |
"Cycle detected: the annotation type A cannot contain attributes of the annotation type itself\n" + |
6364 |
"Cycle detected: the annotation type A cannot contain attributes of the annotation type itself\n" + |
| 6358 |
"----------\n" + |
6365 |
"----------\n" + |
| 6359 |
"3. ERROR in A.java (at line 6)\r\n" + |
6366 |
"3. ERROR in A.java (at line 6)\n" + |
| 6360 |
" A circular();\r\n" + |
6367 |
" A circular();\n" + |
| 6361 |
" ^\n" + |
6368 |
" ^\n" + |
| 6362 |
"Cycle detected: a cycle exists between annotation attributes of B and A\n" + |
6369 |
"Cycle detected: a cycle exists between annotation attributes of B and A\n" + |
| 6363 |
"----------\n" |
6370 |
"----------\n" |
|
Lines 6374-6391
Link Here
|
| 6374 |
"}" |
6381 |
"}" |
| 6375 |
}, |
6382 |
}, |
| 6376 |
"----------\n" + |
6383 |
"----------\n" + |
| 6377 |
"1. ERROR in A.java (at line 2)\r\n" + |
6384 |
"1. ERROR in A.java (at line 2)\n" + |
| 6378 |
" A circular1();\r\n" + |
6385 |
" A circular1();\n" + |
| 6379 |
" ^\n" + |
6386 |
" ^\n" + |
| 6380 |
"Cycle detected: the annotation type A cannot contain attributes of the annotation type itself\n" + |
6387 |
"Cycle detected: the annotation type A cannot contain attributes of the annotation type itself\n" + |
| 6381 |
"----------\n" + |
6388 |
"----------\n" + |
| 6382 |
"2. ERROR in A.java (at line 3)\r\n" + |
6389 |
"2. ERROR in A.java (at line 3)\n" + |
| 6383 |
" B circular2();\r\n" + |
6390 |
" B circular2();\n" + |
| 6384 |
" ^\n" + |
6391 |
" ^\n" + |
| 6385 |
"Cycle detected: a cycle exists between annotation attributes of A and B\n" + |
6392 |
"Cycle detected: a cycle exists between annotation attributes of A and B\n" + |
| 6386 |
"----------\n" + |
6393 |
"----------\n" + |
| 6387 |
"3. ERROR in A.java (at line 6)\r\n" + |
6394 |
"3. ERROR in A.java (at line 6)\n" + |
| 6388 |
" A circular();\r\n" + |
6395 |
" A circular();\n" + |
| 6389 |
" ^\n" + |
6396 |
" ^\n" + |
| 6390 |
"Cycle detected: a cycle exists between annotation attributes of B and A\n" + |
6397 |
"Cycle detected: a cycle exists between annotation attributes of B and A\n" + |
| 6391 |
"----------\n" |
6398 |
"----------\n" |
|
Lines 7092-7099
Link Here
|
| 7092 |
if (new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6) { |
7099 |
if (new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6) { |
| 7093 |
this.runNegativeTest(sources, |
7100 |
this.runNegativeTest(sources, |
| 7094 |
"----------\n" + |
7101 |
"----------\n" + |
| 7095 |
"1. ERROR in Y.java (at line 3)\r\n" + |
7102 |
"1. ERROR in Y.java (at line 3)\n" + |
| 7096 |
" public void foo() {}\r\n" + |
7103 |
" public void foo() {}\n" + |
| 7097 |
" ^^^^^\n" + |
7104 |
" ^^^^^\n" + |
| 7098 |
"The method foo() of type Y must override a superclass method\n" + |
7105 |
"The method foo() of type Y must override a superclass method\n" + |
| 7099 |
"----------\n"); |
7106 |
"----------\n"); |
|
Lines 8148-8155
Link Here
|
| 8148 |
"}" |
8155 |
"}" |
| 8149 |
}, |
8156 |
}, |
| 8150 |
"----------\n" + |
8157 |
"----------\n" + |
| 8151 |
"1. ERROR in TestAnnotation.java (at line 2)\r\n" + |
8158 |
"1. ERROR in TestAnnotation.java (at line 2)\n" + |
| 8152 |
" String targetItem() default void.class;\r\n" + |
8159 |
" String targetItem() default void.class;\n" + |
| 8153 |
" ^^^^^^^^^^\n" + |
8160 |
" ^^^^^^^^^^\n" + |
| 8154 |
"Type mismatch: cannot convert from Class<Void> to String\n" + |
8161 |
"Type mismatch: cannot convert from Class<Void> to String\n" + |
| 8155 |
"----------\n"); |
8162 |
"----------\n"); |
|
Lines 9403-9406
Link Here
|
| 9403 |
expectedErrorString, |
9410 |
expectedErrorString, |
| 9404 |
JavacTestOptions.SKIP); |
9411 |
JavacTestOptions.SKIP); |
| 9405 |
} |
9412 |
} |
|
|
9413 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=304031 |
| 9414 |
public void test284() { |
| 9415 |
Map customOptions = getCompilerOptions(); |
| 9416 |
customOptions.put(CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, CompilerOptions.WARNING); |
| 9417 |
customOptions.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.ERROR); |
| 9418 |
customOptions.put(CompilerOptions.OPTION_SuppressOptionalErrors, CompilerOptions.ENABLED); |
| 9419 |
String testFiles [] = new String[] { |
| 9420 |
"X.java", |
| 9421 |
"public class X {\n" + |
| 9422 |
" void m() {\n" + |
| 9423 |
" @SuppressWarnings(\"cast\")\n" + |
| 9424 |
" int i= (int) 0;\n" + |
| 9425 |
" @SuppressWarnings(\"cast\")\n" + |
| 9426 |
" byte b= (byte) i;\n" + |
| 9427 |
" System.out.println(b);\n" + |
| 9428 |
" }\n" + |
| 9429 |
"}" |
| 9430 |
}; |
| 9431 |
String expectedErrorString = |
| 9432 |
"----------\n" + |
| 9433 |
"1. ERROR in X.java (at line 5)\n" + |
| 9434 |
" @SuppressWarnings(\"cast\")\n" + |
| 9435 |
" ^^^^^^\n" + |
| 9436 |
"Unnecessary @SuppressWarnings(\"cast\")\n" + |
| 9437 |
"----------\n"; |
| 9438 |
runNegativeTest( |
| 9439 |
true, |
| 9440 |
testFiles, |
| 9441 |
null, |
| 9442 |
customOptions, |
| 9443 |
expectedErrorString, |
| 9444 |
JavacTestOptions.SKIP); |
| 9445 |
} |
| 9446 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=304031 |
| 9447 |
public void test285() { |
| 9448 |
Map customOptions = getCompilerOptions(); |
| 9449 |
customOptions.put(CompilerOptions.OPTION_ReportUnnecessaryTypeCheck, CompilerOptions.ERROR); |
| 9450 |
customOptions.put(CompilerOptions.OPTION_ReportUnusedWarningToken, CompilerOptions.ERROR); |
| 9451 |
customOptions.put(CompilerOptions.OPTION_SuppressOptionalErrors, CompilerOptions.ENABLED); |
| 9452 |
String testFiles [] = new String[] { |
| 9453 |
"X.java", |
| 9454 |
"public class X {\n" + |
| 9455 |
" void m() {\n" + |
| 9456 |
" @SuppressWarnings(\"cast\")\n" + |
| 9457 |
" int i= (int) 0;\n" + |
| 9458 |
" @SuppressWarnings(\"cast\")\n" + |
| 9459 |
" byte b= (byte) i;\n" + |
| 9460 |
" System.out.println(b);\n" + |
| 9461 |
" }\n" + |
| 9462 |
"}" |
| 9463 |
}; |
| 9464 |
String expectedErrorString = |
| 9465 |
"----------\n" + |
| 9466 |
"1. ERROR in X.java (at line 5)\n" + |
| 9467 |
" @SuppressWarnings(\"cast\")\n" + |
| 9468 |
" ^^^^^^\n" + |
| 9469 |
"Unnecessary @SuppressWarnings(\"cast\")\n" + |
| 9470 |
"----------\n"; |
| 9471 |
runNegativeTest( |
| 9472 |
true, |
| 9473 |
testFiles, |
| 9474 |
null, |
| 9475 |
customOptions, |
| 9476 |
expectedErrorString, |
| 9477 |
JavacTestOptions.SKIP); |
| 9478 |
} |
| 9406 |
} |
9479 |
} |