Lines 11239-11262
Link Here
|
11239 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088 |
11239 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088 |
11240 |
public void test200() { |
11240 |
public void test200() { |
11241 |
Map options = getCompilerOptions(); |
11241 |
Map options = getCompilerOptions(); |
11242 |
String compliance = (String) options.get(JavaCore.COMPILER_COMPLIANCE); |
11242 |
String errorMessage = |
11243 |
String errorMessage = compliance == JavaCore.VERSION_1_6 ? |
|
|
11244 |
"----------\n" + |
11245 |
"1. WARNING in X.java (at line 3)\n" + |
11246 |
" int foo(Collection bar) { return 0; }\n" + |
11247 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
11248 |
"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + |
11249 |
"----------\n" + |
11250 |
"2. WARNING in X.java (at line 3)\n" + |
11251 |
" int foo(Collection bar) { return 0; }\n" + |
11252 |
" ^^^^^^^^^^\n" + |
11253 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
11254 |
"----------\n" + |
11255 |
"3. WARNING in X.java (at line 4)\n" + |
11256 |
" double foo(Collection<String> bar) {return 0; }\n" + |
11257 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
11258 |
"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + |
11259 |
"----------\n" : |
11260 |
"----------\n" + |
11243 |
"----------\n" + |
11261 |
"1. ERROR in X.java (at line 3)\n" + |
11244 |
"1. ERROR in X.java (at line 3)\n" + |
11262 |
" int foo(Collection bar) { return 0; }\n" + |
11245 |
" int foo(Collection bar) { return 0; }\n" + |
Lines 13512-13515
Link Here
|
13512 |
"Name clash: The method foo(A<Integer>) of type Sub has the same erasure as foo(A<Number>) of type Super but does not hide it\n" + |
13495 |
"Name clash: The method foo(A<Integer>) of type Sub has the same erasure as foo(A<Number>) of type Super but does not hide it\n" + |
13513 |
"----------\n"); |
13496 |
"----------\n"); |
13514 |
} |
13497 |
} |
|
|
13498 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=355838 |
13499 |
public void testBug355838() throws Exception { |
13500 |
String output = |
13501 |
"----------\n" + |
13502 |
"1. ERROR in ErasureBug.java (at line 4)\n" + |
13503 |
" public String output(List<String> integers) {\n" + |
13504 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
13505 |
"Method output(List<String>) has the same erasure output(List<E>) as another method in type ErasureBug\n" + |
13506 |
"----------\n" + |
13507 |
"2. ERROR in ErasureBug.java (at line 7)\n" + |
13508 |
" public String output(List doubles) {\n" + |
13509 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
13510 |
"Method output(List) has the same erasure output(List<E>) as another method in type ErasureBug\n" + |
13511 |
"----------\n" + |
13512 |
"3. WARNING in ErasureBug.java (at line 7)\n" + |
13513 |
" public String output(List doubles) {\n" + |
13514 |
" ^^^^\n" + |
13515 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
13516 |
"----------\n" + |
13517 |
"4. WARNING in ErasureBug.java (at line 10)\n" + |
13518 |
" public static void main(String[] args) { new ErasureBug().output(new ArrayList()); }\n" + |
13519 |
" ^^^^^^^^^^^^^^^\n" + |
13520 |
"Type safety: The expression of type ArrayList needs unchecked conversion to conform to List<String>\n" + |
13521 |
"----------\n" + |
13522 |
"5. WARNING in ErasureBug.java (at line 10)\n" + |
13523 |
" public static void main(String[] args) { new ErasureBug().output(new ArrayList()); }\n" + |
13524 |
" ^^^^^^^^^\n" + |
13525 |
"ArrayList is a raw type. References to generic type ArrayList<E> should be parameterized\n" + |
13526 |
"----------\n"; |
13527 |
this.runNegativeTest( |
13528 |
new String[] { |
13529 |
"ErasureBug.java", |
13530 |
"import java.util.ArrayList;\n" + |
13531 |
"import java.util.List;\n" + |
13532 |
"public class ErasureBug {\n" + |
13533 |
" public String output(List<String> integers) {\n" + |
13534 |
" return \"1\";\n" + |
13535 |
" }\n" + |
13536 |
" public String output(List doubles) {\n" + |
13537 |
" return \"2\";\n" + |
13538 |
" }\n" + |
13539 |
" public static void main(String[] args) { new ErasureBug().output(new ArrayList()); }\n" + |
13540 |
"}\n" |
13541 |
}, |
13542 |
output); |
13543 |
} |
13515 |
} |
13544 |
} |