Lines 6437-6442
Link Here
|
6437 |
" @Override void instanceCase2(Collection c) {}\n" + |
6437 |
" @Override void instanceCase2(Collection c) {}\n" + |
6438 |
"}" |
6438 |
"}" |
6439 |
}, |
6439 |
}, |
|
|
6440 |
this.complianceLevel < ClassFileConstants.JDK1_7 ? |
6440 |
"----------\n" + |
6441 |
"----------\n" + |
6441 |
"1. WARNING in Parent.java (at line 3)\n" + |
6442 |
"1. WARNING in Parent.java (at line 3)\n" + |
6442 |
" static void staticCase1(Collection c) {}\n" + |
6443 |
" static void staticCase1(Collection c) {}\n" + |
Lines 6462-6468
Link Here
|
6462 |
" @Override void instanceCase2(Collection c) {}\n" + |
6463 |
" @Override void instanceCase2(Collection c) {}\n" + |
6463 |
" ^^^^^^^^^^\n" + |
6464 |
" ^^^^^^^^^^\n" + |
6464 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6465 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6465 |
"----------\n" |
6466 |
"----------\n": |
|
|
6467 |
"----------\n" + |
6468 |
"1. WARNING in Parent.java (at line 3)\n" + |
6469 |
" static void staticCase1(Collection c) {}\n" + |
6470 |
" ^^^^^^^^^^\n" + |
6471 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6472 |
"----------\n" + |
6473 |
"2. WARNING in Parent.java (at line 5)\n" + |
6474 |
" void instanceCase1(Collection c) {}\n" + |
6475 |
" ^^^^^^^^^^\n" + |
6476 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6477 |
"----------\n" + |
6478 |
"3. ERROR in Parent.java (at line 9)\n" + |
6479 |
" static void staticCase1(Collection<String> c) {}\n" + |
6480 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
6481 |
"Name clash: The method staticCase1(Collection<String>) of type Child has the same erasure as staticCase1(Collection) of type Parent but does not hide it\n" + |
6482 |
"----------\n" + |
6483 |
"4. WARNING in Parent.java (at line 10)\n" + |
6484 |
" static void staticCase2(Collection c) {}\n" + |
6485 |
" ^^^^^^^^^^\n" + |
6486 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6487 |
"----------\n" + |
6488 |
"5. ERROR in Parent.java (at line 11)\n" + |
6489 |
" void instanceCase1(Collection<String> c) {}\n" + |
6490 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
6491 |
"Name clash: The method instanceCase1(Collection<String>) of type Child has the same erasure as instanceCase1(Collection) of type Parent but does not override it\n" + |
6492 |
"----------\n" + |
6493 |
"6. WARNING in Parent.java (at line 12)\n" + |
6494 |
" @Override void instanceCase2(Collection c) {}\n" + |
6495 |
" ^^^^^^^^^^\n" + |
6496 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
6497 |
"----------\n" |
6466 |
// @Override is an error for instanceCase1 |
6498 |
// @Override is an error for instanceCase1 |
6467 |
// name clash: instanceCase1(Collection<String>) in Child and instanceCase1(Collection) in Parent have the same erasure, yet neither overrides the other |
6499 |
// name clash: instanceCase1(Collection<String>) in Child and instanceCase1(Collection) in Parent have the same erasure, yet neither overrides the other |
6468 |
); |
6500 |
); |
Lines 9246-9285
Link Here
|
9246 |
"class X {}\n" + |
9278 |
"class X {}\n" + |
9247 |
"class Y<T> {}" |
9279 |
"class Y<T> {}" |
9248 |
}, |
9280 |
}, |
9249 |
"----------\n" + |
9281 |
this.complianceLevel < ClassFileConstants.JDK1_7 ? |
9250 |
"1. ERROR in B.java (at line 2)\n" + |
9282 |
"----------\n" + |
9251 |
" static void a(X x) {}\n" + |
9283 |
"1. ERROR in B.java (at line 2)\n" + |
9252 |
" ^^^^^^\n" + |
9284 |
" static void a(X x) {}\n" + |
9253 |
"This static method cannot hide the instance method from A\n" + |
9285 |
" ^^^^^^\n" + |
9254 |
"----------\n" + |
9286 |
"This static method cannot hide the instance method from A\n" + |
9255 |
"2. ERROR in B.java (at line 3)\n" + |
9287 |
"----------\n" + |
9256 |
" static void b(Y<String> y) {}\n" + |
9288 |
"----------\n" + |
9257 |
" ^^^^^^^^^^^^^^\n" + |
9289 |
"1. ERROR in B2.java (at line 2)\n" + |
9258 |
"Name clash: The method b(Y<String>) of type B has the same erasure as b(Y<Integer>) of type A but does not override it\n" + |
9290 |
" static void b(Y<Integer> y) {}\n" + |
9259 |
"----------\n" + |
9291 |
" ^^^^^^^^^^^^^^^\n" + |
9260 |
"----------\n" + |
9292 |
"This static method cannot hide the instance method from A\n" + |
9261 |
"1. ERROR in B2.java (at line 2)\n" + |
9293 |
"----------\n" + |
9262 |
" static void b(Y<Integer> y) {}\n" + |
9294 |
"----------\n" + |
9263 |
" ^^^^^^^^^^^^^^^\n" + |
9295 |
"1. ERROR in C.java (at line 3)\n" + |
9264 |
"This static method cannot hide the instance method from A\n" + |
9296 |
" void b(Y<String> y) {}\n" + |
9265 |
"----------\n" + |
9297 |
" ^^^^^^^^^^^^^^\n" + |
9266 |
"----------\n" + |
9298 |
"Name clash: The method b(Y<String>) of type C has the same erasure as b(Y<Integer>) of type A but does not override it\n" + |
9267 |
"1. ERROR in C.java (at line 3)\n" + |
9299 |
"----------\n" + |
9268 |
" void b(Y<String> y) {}\n" + |
9300 |
"2. ERROR in C.java (at line 4)\n" + |
9269 |
" ^^^^^^^^^^^^^^\n" + |
9301 |
" void c(X x) {}\n" + |
9270 |
"Name clash: The method b(Y<String>) of type C has the same erasure as b(Y<Integer>) of type A but does not override it\n" + |
9302 |
" ^^^^^^\n" + |
9271 |
"----------\n" + |
9303 |
"This instance method cannot override the static method from A\n" + |
9272 |
"2. ERROR in C.java (at line 4)\n" + |
9304 |
"----------\n" + |
9273 |
" void c(X x) {}\n" + |
9305 |
"----------\n" + |
9274 |
" ^^^^^^\n" + |
9306 |
"1. ERROR in C2.java (at line 3)\n" + |
9275 |
"This instance method cannot override the static method from A\n" + |
9307 |
" void d(Y<Integer> y) {}\n" + |
9276 |
"----------\n" + |
9308 |
" ^^^^^^^^^^^^^^^\n" + |
9277 |
"----------\n" + |
9309 |
"This instance method cannot override the static method from A\n" + |
9278 |
"1. ERROR in C2.java (at line 3)\n" + |
9310 |
"----------\n" : |
9279 |
" void d(Y<Integer> y) {}\n" + |
9311 |
"----------\n" + |
9280 |
" ^^^^^^^^^^^^^^^\n" + |
9312 |
"1. ERROR in B.java (at line 2)\n" + |
9281 |
"This instance method cannot override the static method from A\n" + |
9313 |
" static void a(X x) {}\n" + |
9282 |
"----------\n" |
9314 |
" ^^^^^^\n" + |
|
|
9315 |
"This static method cannot hide the instance method from A\n" + |
9316 |
"----------\n" + |
9317 |
"2. ERROR in B.java (at line 3)\n" + |
9318 |
" static void b(Y<String> y) {}\n" + |
9319 |
" ^^^^^^^^^^^^^^\n" + |
9320 |
"Name clash: The method b(Y<String>) of type B has the same erasure as b(Y<Integer>) of type A but does not hide it\n" + |
9321 |
"----------\n" + |
9322 |
"3. ERROR in B.java (at line 5)\n" + |
9323 |
" static void d(Y<String> y) {}\n" + |
9324 |
" ^^^^^^^^^^^^^^\n" + |
9325 |
"Name clash: The method d(Y<String>) of type B has the same erasure as d(Y<Integer>) of type A but does not hide it\n" + |
9326 |
"----------\n" + |
9327 |
"----------\n" + |
9328 |
"1. ERROR in B2.java (at line 2)\n" + |
9329 |
" static void b(Y<Integer> y) {}\n" + |
9330 |
" ^^^^^^^^^^^^^^^\n" + |
9331 |
"This static method cannot hide the instance method from A\n" + |
9332 |
"----------\n" + |
9333 |
"----------\n" + |
9334 |
"1. ERROR in C.java (at line 3)\n" + |
9335 |
" void b(Y<String> y) {}\n" + |
9336 |
" ^^^^^^^^^^^^^^\n" + |
9337 |
"Name clash: The method b(Y<String>) of type C has the same erasure as b(Y<Integer>) of type A but does not override it\n" + |
9338 |
"----------\n" + |
9339 |
"2. ERROR in C.java (at line 4)\n" + |
9340 |
" void c(X x) {}\n" + |
9341 |
" ^^^^^^\n" + |
9342 |
"This instance method cannot override the static method from A\n" + |
9343 |
"----------\n" + |
9344 |
"3. ERROR in C.java (at line 5)\n" + |
9345 |
" void d(Y<String> y) {}\n" + |
9346 |
" ^^^^^^^^^^^^^^\n" + |
9347 |
"Name clash: The method d(Y<String>) of type C has the same erasure as d(Y<Integer>) of type A but does not hide it\n" + |
9348 |
"----------\n" + |
9349 |
"----------\n" + |
9350 |
"1. ERROR in C2.java (at line 3)\n" + |
9351 |
" void d(Y<Integer> y) {}\n" + |
9352 |
" ^^^^^^^^^^^^^^^\n" + |
9353 |
"This instance method cannot override the static method from A\n" + |
9354 |
"----------\n" |
9283 |
); |
9355 |
); |
9284 |
} |
9356 |
} |
9285 |
public void test150() { |
9357 |
public void test150() { |
Lines 13420-13423
Link Here
|
13420 |
}, |
13492 |
}, |
13421 |
output); |
13493 |
output); |
13422 |
} |
13494 |
} |
|
|
13495 |
public void test345949a() throws Exception { |
13496 |
if (new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_7) return; |
13497 |
this.runNegativeTest( |
13498 |
new String[] { |
13499 |
"Sub.java", |
13500 |
"class A<T> {}\n" + |
13501 |
"class Super {\n" + |
13502 |
" public static void foo(A<Number> p) {}\n" + |
13503 |
"}\n" + |
13504 |
"public class Sub extends Super {\n" + |
13505 |
" public static void foo(A<Integer> p) {}\n" + |
13506 |
"}\n" |
13507 |
}, |
13508 |
"----------\n" + |
13509 |
"1. ERROR in Sub.java (at line 6)\n" + |
13510 |
" public static void foo(A<Integer> p) {}\n" + |
13511 |
" ^^^^^^^^^^^^^^^^^\n" + |
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" + |
13513 |
"----------\n"); |
13514 |
} |
13515 |
public void _test345949b() throws Exception { |
13516 |
this.runNegativeTest( |
13517 |
new String[] { |
13518 |
"Sub.java", |
13519 |
"class Super {\n" + |
13520 |
" public static void foo() {}\n" + |
13521 |
"}\n" + |
13522 |
"public class Sub extends Super {\n" + |
13523 |
" public static <T> void foo() {}\n" + |
13524 |
"}\n" |
13525 |
}, |
13526 |
""); |
13527 |
} |
13528 |
|
13423 |
} |
13529 |
} |