|
Lines 27-33
Link Here
|
| 27 |
|
27 |
|
| 28 |
public class MethodVerifyTest extends AbstractComparableTest { |
28 |
public class MethodVerifyTest extends AbstractComparableTest { |
| 29 |
static { |
29 |
static { |
| 30 |
// TESTS_NAMES = new String[] { "test339447" }; |
30 |
// TESTS_NAMES = new String[] { "testBug317719" }; |
| 31 |
// TESTS_NUMBERS = new int[] { 213 }; |
31 |
// TESTS_NUMBERS = new int[] { 213 }; |
| 32 |
// TESTS_RANGE = new int[] { 190, -1}; |
32 |
// TESTS_RANGE = new int[] { 190, -1}; |
| 33 |
} |
33 |
} |
|
Lines 3333-3338
Link Here
|
| 3333 |
|
3333 |
|
| 3334 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3334 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
| 3335 |
public void test048() { |
3335 |
public void test048() { |
|
|
3336 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 3337 |
"----------\n" + |
| 3338 |
"1. WARNING in X1.java (at line 2)\n" + |
| 3339 |
" public class X1 extends LinkedHashMap<String, String> {\n" + |
| 3340 |
" ^^\n" + |
| 3341 |
"The serializable class X1 does not declare a static final serialVersionUID field of type long\n" + |
| 3342 |
"----------\n" + |
| 3343 |
"2. WARNING in X1.java (at line 3)\n" + |
| 3344 |
" public Object putAll(Map<String,String> a) { return null; }\n" + |
| 3345 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 3346 |
"Name clash: The method putAll(Map<String,String>) of type X1 has the same erasure as putAll(Map<? extends K,? extends V>) of type HashMap<K,V> but does not override it\n" + |
| 3347 |
"----------\n": |
| 3348 |
"----------\n" + |
| 3349 |
"1. WARNING in X1.java (at line 2)\n" + |
| 3350 |
" public class X1 extends LinkedHashMap<String, String> {\n" + |
| 3351 |
" ^^\n" + |
| 3352 |
"The serializable class X1 does not declare a static final serialVersionUID field of type long\n" + |
| 3353 |
"----------\n" + |
| 3354 |
"2. ERROR in X1.java (at line 3)\n" + |
| 3355 |
" public Object putAll(Map<String,String> a) { return null; }\n" + |
| 3356 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 3357 |
"Name clash: The method putAll(Map<String,String>) of type X1 has the same erasure as putAll(Map<? extends K,? extends V>) of type HashMap<K,V> but does not override it\n" + |
| 3358 |
"----------\n"; |
| 3336 |
this.runNegativeTest( |
3359 |
this.runNegativeTest( |
| 3337 |
new String[] { |
3360 |
new String[] { |
| 3338 |
"X1.java", |
3361 |
"X1.java", |
|
Lines 3341-3357
Link Here
|
| 3341 |
" public Object putAll(Map<String,String> a) { return null; }\n" + |
3364 |
" public Object putAll(Map<String,String> a) { return null; }\n" + |
| 3342 |
"}\n" |
3365 |
"}\n" |
| 3343 |
}, |
3366 |
}, |
| 3344 |
"----------\n" + |
3367 |
expectedCompilerLog |
| 3345 |
"1. WARNING in X1.java (at line 2)\n" + |
|
|
| 3346 |
" public class X1 extends LinkedHashMap<String, String> {\n" + |
| 3347 |
" ^^\n" + |
| 3348 |
"The serializable class X1 does not declare a static final serialVersionUID field of type long\n" + |
| 3349 |
"----------\n" + |
| 3350 |
"2. ERROR in X1.java (at line 3)\n" + |
| 3351 |
" public Object putAll(Map<String,String> a) { return null; }\n" + |
| 3352 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 3353 |
"Name clash: The method putAll(Map<String,String>) of type X1 has the same erasure as putAll(Map<? extends K,? extends V>) of type HashMap<K,V> but does not override it\n" + |
| 3354 |
"----------\n" |
| 3355 |
); |
3368 |
); |
| 3356 |
/* javac 7 |
3369 |
/* javac 7 |
| 3357 |
X.java:4: name clash: putAll(Map<String,String>) in X1 and putAll(Map<? extends K,? extends V>) in HashMap have the same erasure, yet neither overrides the other |
3370 |
X.java:4: name clash: putAll(Map<String,String>) in X1 and putAll(Map<? extends K,? extends V>) in HashMap have the same erasure, yet neither overrides the other |
|
Lines 3365-3370
Link Here
|
| 3365 |
} |
3378 |
} |
| 3366 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3379 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
| 3367 |
public void test048a() { |
3380 |
public void test048a() { |
|
|
3381 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 3382 |
"----------\n" + |
| 3383 |
"1. WARNING in X2.java (at line 2)\n" + |
| 3384 |
" public Object foo(I<String> z) { return null; }\n" + |
| 3385 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3386 |
"Name clash: The method foo(I<String>) of type X2 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3387 |
"----------\n": |
| 3388 |
"----------\n" + |
| 3389 |
"1. ERROR in X2.java (at line 2)\n" + |
| 3390 |
" public Object foo(I<String> z) { return null; }\n" + |
| 3391 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3392 |
"Name clash: The method foo(I<String>) of type X2 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3393 |
"----------\n"; |
| 3368 |
this.runNegativeTest( |
3394 |
this.runNegativeTest( |
| 3369 |
new String[] { |
3395 |
new String[] { |
| 3370 |
"X2.java", |
3396 |
"X2.java", |
|
Lines 3378-3389
Link Here
|
| 3378 |
" public void foo(I<? extends T> a);\n" + |
3404 |
" public void foo(I<? extends T> a);\n" + |
| 3379 |
"}\n" |
3405 |
"}\n" |
| 3380 |
}, |
3406 |
}, |
| 3381 |
"----------\n" + |
3407 |
expectedCompilerLog |
| 3382 |
"1. ERROR in X2.java (at line 2)\n" + |
|
|
| 3383 |
" public Object foo(I<String> z) { return null; }\n" + |
| 3384 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3385 |
"Name clash: The method foo(I<String>) of type X2 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3386 |
"----------\n" |
| 3387 |
); |
3408 |
); |
| 3388 |
/* javac 7 |
3409 |
/* javac 7 |
| 3389 |
X.java:2: name clash: foo(I<String>) in X2 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other |
3410 |
X.java:2: name clash: foo(I<String>) in X2 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other |
|
Lines 3427-3432
Link Here
|
| 3427 |
} |
3448 |
} |
| 3428 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3449 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
| 3429 |
public void test048c() { |
3450 |
public void test048c() { |
|
|
3451 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 3452 |
"----------\n" + |
| 3453 |
"1. WARNING in X4.java (at line 2)\n" + |
| 3454 |
" public String foo(I<String> z) { return null; }\n" + |
| 3455 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3456 |
"Name clash: The method foo(I<String>) of type X4 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3457 |
"----------\n": |
| 3458 |
"----------\n" + |
| 3459 |
"1. ERROR in X4.java (at line 2)\n" + |
| 3460 |
" public String foo(I<String> z) { return null; }\n" + |
| 3461 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3462 |
"Name clash: The method foo(I<String>) of type X4 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3463 |
"----------\n"; |
| 3430 |
this.runNegativeTest( |
3464 |
this.runNegativeTest( |
| 3431 |
new String[] { |
3465 |
new String[] { |
| 3432 |
"X4.java", |
3466 |
"X4.java", |
|
Lines 3440-3451
Link Here
|
| 3440 |
" public Object foo(I<? extends T> a);\n" + |
3474 |
" public Object foo(I<? extends T> a);\n" + |
| 3441 |
"}\n" |
3475 |
"}\n" |
| 3442 |
}, |
3476 |
}, |
| 3443 |
"----------\n" + |
3477 |
expectedCompilerLog |
| 3444 |
"1. ERROR in X4.java (at line 2)\n" + |
|
|
| 3445 |
" public String foo(I<String> z) { return null; }\n" + |
| 3446 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3447 |
"Name clash: The method foo(I<String>) of type X4 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3448 |
"----------\n" |
| 3449 |
); |
3478 |
); |
| 3450 |
/* javac 7 |
3479 |
/* javac 7 |
| 3451 |
X.java:2: name clash: foo(I<String>) in X4 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other |
3480 |
X.java:2: name clash: foo(I<String>) in X4 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other |
|
Lines 3458-3463
Link Here
|
| 3458 |
} |
3487 |
} |
| 3459 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3488 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
| 3460 |
public void test048d() { |
3489 |
public void test048d() { |
|
|
3490 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 3491 |
"----------\n" + |
| 3492 |
"1. WARNING in X5.java (at line 2)\n" + |
| 3493 |
" public Object foo(I<String> z) { return null; }\n" + |
| 3494 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3495 |
"Name clash: The method foo(I<String>) of type X5 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3496 |
"----------\n": |
| 3497 |
"----------\n" + |
| 3498 |
"1. ERROR in X5.java (at line 2)\n" + |
| 3499 |
" public Object foo(I<String> z) { return null; }\n" + |
| 3500 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3501 |
"Name clash: The method foo(I<String>) of type X5 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3502 |
"----------\n"; |
| 3461 |
this.runNegativeTest( |
3503 |
this.runNegativeTest( |
| 3462 |
new String[] { |
3504 |
new String[] { |
| 3463 |
"X5.java", |
3505 |
"X5.java", |
|
Lines 3471-3482
Link Here
|
| 3471 |
" public String foo(I<? extends T> a);\n" + |
3513 |
" public String foo(I<? extends T> a);\n" + |
| 3472 |
"}\n" |
3514 |
"}\n" |
| 3473 |
}, |
3515 |
}, |
| 3474 |
"----------\n" + |
3516 |
expectedCompilerLog |
| 3475 |
"1. ERROR in X5.java (at line 2)\n" + |
|
|
| 3476 |
" public Object foo(I<String> z) { return null; }\n" + |
| 3477 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3478 |
"Name clash: The method foo(I<String>) of type X5 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3479 |
"----------\n" |
| 3480 |
); |
3517 |
); |
| 3481 |
/* javac 7 |
3518 |
/* javac 7 |
| 3482 |
X.java:2: name clash: foo(I<String>) in X5 and foo(I<? extends T>) in Y have the |
3519 |
X.java:2: name clash: foo(I<String>) in X5 and foo(I<? extends T>) in Y have the |
|
Lines 3490-3495
Link Here
|
| 3490 |
} |
3527 |
} |
| 3491 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3528 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
| 3492 |
public void test048e() { |
3529 |
public void test048e() { |
|
|
3530 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 3531 |
"----------\n" + |
| 3532 |
"1. WARNING in X6.java (at line 2)\n" + |
| 3533 |
" public void foo(I<String> z) {}\n" + |
| 3534 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3535 |
"Name clash: The method foo(I<String>) of type X6 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3536 |
"----------\n": |
| 3537 |
"----------\n" + |
| 3538 |
"1. ERROR in X6.java (at line 2)\n" + |
| 3539 |
" public void foo(I<String> z) {}\n" + |
| 3540 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3541 |
"Name clash: The method foo(I<String>) of type X6 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3542 |
"----------\n"; |
| 3493 |
this.runNegativeTest( |
3543 |
this.runNegativeTest( |
| 3494 |
new String[] { |
3544 |
new String[] { |
| 3495 |
"X6.java", |
3545 |
"X6.java", |
|
Lines 3503-3514
Link Here
|
| 3503 |
" public Object foo(I<? extends T> a);\n" + |
3553 |
" public Object foo(I<? extends T> a);\n" + |
| 3504 |
"}\n" |
3554 |
"}\n" |
| 3505 |
}, |
3555 |
}, |
| 3506 |
"----------\n" + |
3556 |
expectedCompilerLog |
| 3507 |
"1. ERROR in X6.java (at line 2)\n" + |
|
|
| 3508 |
" public void foo(I<String> z) {}\n" + |
| 3509 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3510 |
"Name clash: The method foo(I<String>) of type X6 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3511 |
"----------\n" |
| 3512 |
); |
3557 |
); |
| 3513 |
/* javac 7 |
3558 |
/* javac 7 |
| 3514 |
X.java:2: name clash: foo(I<String>) in X6 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other |
3559 |
X.java:2: name clash: foo(I<String>) in X6 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other |
|
Lines 3521-3526
Link Here
|
| 3521 |
} |
3566 |
} |
| 3522 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3567 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
| 3523 |
public void test048f() { |
3568 |
public void test048f() { |
|
|
3569 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 3570 |
"----------\n" + |
| 3571 |
"1. WARNING in X7.java (at line 2)\n" + |
| 3572 |
" public String foo(I<String> z) { return null; }\n" + |
| 3573 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3574 |
"Name clash: The method foo(I<String>) of type X7 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3575 |
"----------\n": |
| 3576 |
"----------\n" + |
| 3577 |
"1. ERROR in X7.java (at line 2)\n" + |
| 3578 |
" public String foo(I<String> z) { return null; }\n" + |
| 3579 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3580 |
"Name clash: The method foo(I<String>) of type X7 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3581 |
"----------\n"; |
| 3524 |
this.runNegativeTest( |
3582 |
this.runNegativeTest( |
| 3525 |
new String[] { |
3583 |
new String[] { |
| 3526 |
"X7.java", |
3584 |
"X7.java", |
|
Lines 3534-3545
Link Here
|
| 3534 |
" public T foo(I<? extends T> a);\n" + |
3592 |
" public T foo(I<? extends T> a);\n" + |
| 3535 |
"}\n" |
3593 |
"}\n" |
| 3536 |
}, |
3594 |
}, |
| 3537 |
"----------\n" + |
3595 |
expectedCompilerLog |
| 3538 |
"1. ERROR in X7.java (at line 2)\n" + |
|
|
| 3539 |
" public String foo(I<String> z) { return null; }\n" + |
| 3540 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3541 |
"Name clash: The method foo(I<String>) of type X7 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
| 3542 |
"----------\n" |
| 3543 |
); |
3596 |
); |
| 3544 |
/* javac 7 |
3597 |
/* javac 7 |
| 3545 |
X.java:2: name clash: foo(I<String>) in X7 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other |
3598 |
X.java:2: name clash: foo(I<String>) in X7 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other |
|
Lines 3642-3647
Link Here
|
| 3642 |
|
3695 |
|
| 3643 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754 |
3696 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754 |
| 3644 |
public void test050() { |
3697 |
public void test050() { |
|
|
3698 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 3699 |
"----------\n" + |
| 3700 |
"1. WARNING in X.java (at line 2)\n" + |
| 3701 |
" public static <S extends A> S foo() { System.out.print(\"A\"); return null; }\n" + |
| 3702 |
" ^^^^^\n" + |
| 3703 |
"Duplicate method foo() in type X\n" + |
| 3704 |
"----------\n" + |
| 3705 |
"2. WARNING in X.java (at line 3)\n" + |
| 3706 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
| 3707 |
" ^^^^^\n" + |
| 3708 |
"Duplicate method foo() in type X\n" + |
| 3709 |
"----------\n" + |
| 3710 |
"3. WARNING in X.java (at line 7)\n" + |
| 3711 |
" new X().<B>foo();\n" + |
| 3712 |
" ^^^^^^^^^^^^^^^^\n" + |
| 3713 |
"The static method foo() from the type X should be accessed in a static way\n" + |
| 3714 |
"----------\n": |
| 3715 |
"----------\n" + |
| 3716 |
"1. ERROR in X.java (at line 2)\n" + |
| 3717 |
" public static <S extends A> S foo() { System.out.print(\"A\"); return null; }\n" + |
| 3718 |
" ^^^^^\n" + |
| 3719 |
"Duplicate method foo() in type X\n" + |
| 3720 |
"----------\n" + |
| 3721 |
"2. ERROR in X.java (at line 3)\n" + |
| 3722 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
| 3723 |
" ^^^^^\n" + |
| 3724 |
"Duplicate method foo() in type X\n" + |
| 3725 |
"----------\n" + |
| 3726 |
"3. ERROR in X.java (at line 6)\n" + |
| 3727 |
" X.<B>foo();\n" + |
| 3728 |
" ^^^\n" + |
| 3729 |
"Bound mismatch: The generic method foo() of type X is not applicable for the arguments (). The inferred type B is not a valid substitute for the bounded parameter <S extends A>\n" + |
| 3730 |
"----------\n" + |
| 3731 |
"4. ERROR in X.java (at line 7)\n" + |
| 3732 |
" new X().<B>foo();\n" + |
| 3733 |
" ^^^\n" + |
| 3734 |
"Bound mismatch: The generic method foo() of type X is not applicable for the arguments (). The inferred type B is not a valid substitute for the bounded parameter <S extends A>\n" + |
| 3735 |
"----------\n"; |
| 3645 |
this.runNegativeTest( |
3736 |
this.runNegativeTest( |
| 3646 |
new String[] { |
3737 |
new String[] { |
| 3647 |
"X.java", |
3738 |
"X.java", |
|
Lines 3657-3683
Link Here
|
| 3657 |
"class A {}\n" + |
3748 |
"class A {}\n" + |
| 3658 |
"class B {}" |
3749 |
"class B {}" |
| 3659 |
}, |
3750 |
}, |
| 3660 |
"----------\n" + |
3751 |
expectedCompilerLog |
| 3661 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 3662 |
" public static <S extends A> S foo() { System.out.print(\"A\"); return null; }\n" + |
| 3663 |
" ^^^^^\n" + |
| 3664 |
"Duplicate method foo() in type X\n" + |
| 3665 |
"----------\n" + |
| 3666 |
"2. ERROR in X.java (at line 3)\n" + |
| 3667 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
| 3668 |
" ^^^^^\n" + |
| 3669 |
"Duplicate method foo() in type X\n" + |
| 3670 |
"----------\n" + |
| 3671 |
"3. ERROR in X.java (at line 6)\n" + |
| 3672 |
" X.<B>foo();\n" + |
| 3673 |
" ^^^\n" + |
| 3674 |
"Bound mismatch: The generic method foo() of type X is not applicable for the arguments (). The inferred type B is not a valid substitute for the bounded parameter <S extends A>\n" + |
| 3675 |
"----------\n" + |
| 3676 |
"4. ERROR in X.java (at line 7)\n" + |
| 3677 |
" new X().<B>foo();\n" + |
| 3678 |
" ^^^\n" + |
| 3679 |
"Bound mismatch: The generic method foo() of type X is not applicable for the arguments (). The inferred type B is not a valid substitute for the bounded parameter <S extends A>\n" + |
| 3680 |
"----------\n" |
| 3681 |
); |
3752 |
); |
| 3682 |
/* javac 7 |
3753 |
/* javac 7 |
| 3683 |
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure |
3754 |
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure |
|
Lines 3701-3706
Link Here
|
| 3701 |
} |
3772 |
} |
| 3702 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754 |
3773 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754 |
| 3703 |
public void test050a() { |
3774 |
public void test050a() { |
|
|
3775 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 3776 |
"----------\n" + |
| 3777 |
"1. WARNING in X.java (at line 2)\n" + |
| 3778 |
" public static <S extends A> void foo() { System.out.print(\"A\"); }\n" + |
| 3779 |
" ^^^^^\n" + |
| 3780 |
"Duplicate method foo() in type X\n" + |
| 3781 |
"----------\n" + |
| 3782 |
"2. WARNING in X.java (at line 3)\n" + |
| 3783 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
| 3784 |
" ^^^^^\n" + |
| 3785 |
"Duplicate method foo() in type X\n" + |
| 3786 |
"----------\n" + |
| 3787 |
"3. ERROR in X.java (at line 5)\n" + |
| 3788 |
" X.foo();\n" + |
| 3789 |
" ^^^\n" + |
| 3790 |
"The method foo() is ambiguous for the type X\n" + |
| 3791 |
"----------\n" + |
| 3792 |
"4. ERROR in X.java (at line 6)\n" + |
| 3793 |
" foo();\n" + |
| 3794 |
" ^^^\n" + |
| 3795 |
"The method foo() is ambiguous for the type X\n" + |
| 3796 |
"----------\n": |
| 3797 |
"----------\n" + |
| 3798 |
"1. ERROR in X.java (at line 2)\n" + |
| 3799 |
" public static <S extends A> void foo() { System.out.print(\"A\"); }\n" + |
| 3800 |
" ^^^^^\n" + |
| 3801 |
"Duplicate method foo() in type X\n" + |
| 3802 |
"----------\n" + |
| 3803 |
"2. ERROR in X.java (at line 3)\n" + |
| 3804 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
| 3805 |
" ^^^^^\n" + |
| 3806 |
"Duplicate method foo() in type X\n" + |
| 3807 |
"----------\n"; |
| 3704 |
this.runNegativeTest( |
3808 |
this.runNegativeTest( |
| 3705 |
new String[] { |
3809 |
new String[] { |
| 3706 |
"X.java", |
3810 |
"X.java", |
|
Lines 3715-3731
Link Here
|
| 3715 |
"class A {}\n" + |
3819 |
"class A {}\n" + |
| 3716 |
"class B {}" |
3820 |
"class B {}" |
| 3717 |
}, |
3821 |
}, |
| 3718 |
"----------\n" + |
3822 |
expectedCompilerLog |
| 3719 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 3720 |
" public static <S extends A> void foo() { System.out.print(\"A\"); }\n" + |
| 3721 |
" ^^^^^\n" + |
| 3722 |
"Duplicate method foo() in type X\n" + |
| 3723 |
"----------\n" + |
| 3724 |
"2. ERROR in X.java (at line 3)\n" + |
| 3725 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
| 3726 |
" ^^^^^\n" + |
| 3727 |
"Duplicate method foo() in type X\n" + |
| 3728 |
"----------\n" |
| 3729 |
); |
3823 |
); |
| 3730 |
/* javac 7 |
3824 |
/* javac 7 |
| 3731 |
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure |
3825 |
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure |
|
Lines 3740-3745
Link Here
|
| 3740 |
|
3834 |
|
| 3741 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
3835 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
| 3742 |
public void test050b() { |
3836 |
public void test050b() { |
|
|
3837 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 3838 |
"----------\n" + |
| 3839 |
"1. WARNING in X.java (at line 3)\n" + |
| 3840 |
" Y foo(Object o) { return null; } // duplicate\n" + |
| 3841 |
" ^^^^^^^^^^^^^\n" + |
| 3842 |
"Duplicate method foo(Object) in type X.C1\n" + |
| 3843 |
"----------\n" + |
| 3844 |
"2. WARNING in X.java (at line 4)\n" + |
| 3845 |
" Z foo(Object o) { return null; } // duplicate\n" + |
| 3846 |
" ^^^^^^^^^^^^^\n" + |
| 3847 |
"Duplicate method foo(Object) in type X.C1\n" + |
| 3848 |
"----------\n" + |
| 3849 |
"3. WARNING in X.java (at line 7)\n" + |
| 3850 |
" <T extends Y> T foo(Object o) { return null; } // duplicate\n" + |
| 3851 |
" ^^^^^^^^^^^^^\n" + |
| 3852 |
"Duplicate method foo(Object) in type X.C2\n" + |
| 3853 |
"----------\n" + |
| 3854 |
"4. WARNING in X.java (at line 8)\n" + |
| 3855 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
| 3856 |
" ^^^^^^^^^^^^^\n" + |
| 3857 |
"Duplicate method foo(Object) in type X.C2\n" + |
| 3858 |
"----------\n" + |
| 3859 |
"5. ERROR in X.java (at line 11)\n" + |
| 3860 |
" A<Y> foo(Object o) { return null; } // duplicate\n" + |
| 3861 |
" ^^^^^^^^^^^^^\n" + |
| 3862 |
"Duplicate method foo(Object) in type X.C3\n" + |
| 3863 |
"----------\n" + |
| 3864 |
"6. ERROR in X.java (at line 12)\n" + |
| 3865 |
" A<Z> foo(Object o) { return null; } // duplicate\n" + |
| 3866 |
" ^^^^^^^^^^^^^\n" + |
| 3867 |
"Duplicate method foo(Object) in type X.C3\n" + |
| 3868 |
"----------\n" + |
| 3869 |
"7. WARNING in X.java (at line 15)\n" + |
| 3870 |
" Y foo(Object o) { return null; } // duplicate\n" + |
| 3871 |
" ^^^^^^^^^^^^^\n" + |
| 3872 |
"Duplicate method foo(Object) in type X.C4\n" + |
| 3873 |
"----------\n" + |
| 3874 |
"8. WARNING in X.java (at line 16)\n" + |
| 3875 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
| 3876 |
" ^^^^^^^^^^^^^\n" + |
| 3877 |
"Duplicate method foo(Object) in type X.C4\n" + |
| 3878 |
"----------\n": |
| 3879 |
"----------\n" + |
| 3880 |
"1. ERROR in X.java (at line 3)\n" + |
| 3881 |
" Y foo(Object o) { return null; } // duplicate\n" + |
| 3882 |
" ^^^^^^^^^^^^^\n" + |
| 3883 |
"Duplicate method foo(Object) in type X.C1\n" + |
| 3884 |
"----------\n" + |
| 3885 |
"2. ERROR in X.java (at line 4)\n" + |
| 3886 |
" Z foo(Object o) { return null; } // duplicate\n" + |
| 3887 |
" ^^^^^^^^^^^^^\n" + |
| 3888 |
"Duplicate method foo(Object) in type X.C1\n" + |
| 3889 |
"----------\n" + |
| 3890 |
"3. ERROR in X.java (at line 7)\n" + |
| 3891 |
" <T extends Y> T foo(Object o) { return null; } // duplicate\n" + |
| 3892 |
" ^^^^^^^^^^^^^\n" + |
| 3893 |
"Duplicate method foo(Object) in type X.C2\n" + |
| 3894 |
"----------\n" + |
| 3895 |
"4. ERROR in X.java (at line 8)\n" + |
| 3896 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
| 3897 |
" ^^^^^^^^^^^^^\n" + |
| 3898 |
"Duplicate method foo(Object) in type X.C2\n" + |
| 3899 |
"----------\n" + |
| 3900 |
"5. ERROR in X.java (at line 11)\n" + |
| 3901 |
" A<Y> foo(Object o) { return null; } // duplicate\n" + |
| 3902 |
" ^^^^^^^^^^^^^\n" + |
| 3903 |
"Duplicate method foo(Object) in type X.C3\n" + |
| 3904 |
"----------\n" + |
| 3905 |
"6. ERROR in X.java (at line 12)\n" + |
| 3906 |
" A<Z> foo(Object o) { return null; } // duplicate\n" + |
| 3907 |
" ^^^^^^^^^^^^^\n" + |
| 3908 |
"Duplicate method foo(Object) in type X.C3\n" + |
| 3909 |
"----------\n" + |
| 3910 |
"7. ERROR in X.java (at line 15)\n" + |
| 3911 |
" Y foo(Object o) { return null; } // duplicate\n" + |
| 3912 |
" ^^^^^^^^^^^^^\n" + |
| 3913 |
"Duplicate method foo(Object) in type X.C4\n" + |
| 3914 |
"----------\n" + |
| 3915 |
"8. ERROR in X.java (at line 16)\n" + |
| 3916 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
| 3917 |
" ^^^^^^^^^^^^^\n" + |
| 3918 |
"Duplicate method foo(Object) in type X.C4\n" + |
| 3919 |
"----------\n"; |
| 3743 |
this.runNegativeTest( |
3920 |
this.runNegativeTest( |
| 3744 |
new String[] { |
3921 |
new String[] { |
| 3745 |
"X.java", |
3922 |
"X.java", |
|
Lines 3765-3811
Link Here
|
| 3765 |
"class Y {}\n" + |
3942 |
"class Y {}\n" + |
| 3766 |
"class Z {}" |
3943 |
"class Z {}" |
| 3767 |
}, |
3944 |
}, |
| 3768 |
"----------\n" + |
3945 |
expectedCompilerLog |
| 3769 |
"1. ERROR in X.java (at line 3)\n" + |
|
|
| 3770 |
" Y foo(Object o) { return null; } // duplicate\n" + |
| 3771 |
" ^^^^^^^^^^^^^\n" + |
| 3772 |
"Duplicate method foo(Object) in type X.C1\n" + |
| 3773 |
"----------\n" + |
| 3774 |
"2. ERROR in X.java (at line 4)\n" + |
| 3775 |
" Z foo(Object o) { return null; } // duplicate\n" + |
| 3776 |
" ^^^^^^^^^^^^^\n" + |
| 3777 |
"Duplicate method foo(Object) in type X.C1\n" + |
| 3778 |
"----------\n" + |
| 3779 |
"3. ERROR in X.java (at line 7)\n" + |
| 3780 |
" <T extends Y> T foo(Object o) { return null; } // duplicate\n" + |
| 3781 |
" ^^^^^^^^^^^^^\n" + |
| 3782 |
"Duplicate method foo(Object) in type X.C2\n" + |
| 3783 |
"----------\n" + |
| 3784 |
"4. ERROR in X.java (at line 8)\n" + |
| 3785 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
| 3786 |
" ^^^^^^^^^^^^^\n" + |
| 3787 |
"Duplicate method foo(Object) in type X.C2\n" + |
| 3788 |
"----------\n" + |
| 3789 |
"5. ERROR in X.java (at line 11)\n" + |
| 3790 |
" A<Y> foo(Object o) { return null; } // duplicate\n" + |
| 3791 |
" ^^^^^^^^^^^^^\n" + |
| 3792 |
"Duplicate method foo(Object) in type X.C3\n" + |
| 3793 |
"----------\n" + |
| 3794 |
"6. ERROR in X.java (at line 12)\n" + |
| 3795 |
" A<Z> foo(Object o) { return null; } // duplicate\n" + |
| 3796 |
" ^^^^^^^^^^^^^\n" + |
| 3797 |
"Duplicate method foo(Object) in type X.C3\n" + |
| 3798 |
"----------\n" + |
| 3799 |
"7. ERROR in X.java (at line 15)\n" + |
| 3800 |
" Y foo(Object o) { return null; } // duplicate\n" + |
| 3801 |
" ^^^^^^^^^^^^^\n" + |
| 3802 |
"Duplicate method foo(Object) in type X.C4\n" + |
| 3803 |
"----------\n" + |
| 3804 |
"8. ERROR in X.java (at line 16)\n" + |
| 3805 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
| 3806 |
" ^^^^^^^^^^^^^\n" + |
| 3807 |
"Duplicate method foo(Object) in type X.C4\n" + |
| 3808 |
"----------\n" |
| 3809 |
); |
3946 |
); |
| 3810 |
/* javac 7 |
3947 |
/* javac 7 |
| 3811 |
X.java:4: foo(Object) is already defined in X.C1 |
3948 |
X.java:4: foo(Object) is already defined in X.C1 |
|
Lines 3828-3833
Link Here
|
| 3828 |
} |
3965 |
} |
| 3829 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
3966 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
| 3830 |
public void test050c() { |
3967 |
public void test050c() { |
|
|
3968 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 3969 |
"----------\n" + |
| 3970 |
"1. ERROR in X.java (at line 3)\n" + |
| 3971 |
" A<Y> foo(A<Y> o) { return null; } // duplicate\n" + |
| 3972 |
" ^^^^^^^^^^^\n" + |
| 3973 |
"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + |
| 3974 |
"----------\n" + |
| 3975 |
"2. ERROR in X.java (at line 4)\n" + |
| 3976 |
" A<Z> foo(A<Z> o) { return null; } // duplicate\n" + |
| 3977 |
" ^^^^^^^^^^^\n" + |
| 3978 |
"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + |
| 3979 |
"----------\n" + |
| 3980 |
"3. WARNING in X.java (at line 7)\n" + |
| 3981 |
" <T extends Y> T foo(A<Y> o) { return null; } // ok\n" + |
| 3982 |
" ^^^^^^^^^^^\n" + |
| 3983 |
"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C6\n" + |
| 3984 |
"----------\n" + |
| 3985 |
"4. WARNING in X.java (at line 8)\n" + |
| 3986 |
" <T extends Z> T foo(A<Z> o) { return null; } // ok\n" + |
| 3987 |
" ^^^^^^^^^^^\n" + |
| 3988 |
"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C6\n" + |
| 3989 |
"----------\n": |
| 3990 |
"----------\n" + |
| 3991 |
"1. ERROR in X.java (at line 3)\n" + |
| 3992 |
" A<Y> foo(A<Y> o) { return null; } // duplicate\n" + |
| 3993 |
" ^^^^^^^^^^^\n" + |
| 3994 |
"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + |
| 3995 |
"----------\n" + |
| 3996 |
"2. ERROR in X.java (at line 4)\n" + |
| 3997 |
" A<Z> foo(A<Z> o) { return null; } // duplicate\n" + |
| 3998 |
" ^^^^^^^^^^^\n" + |
| 3999 |
"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + |
| 4000 |
"----------\n" + |
| 4001 |
"3. ERROR in X.java (at line 7)\n" + |
| 4002 |
" <T extends Y> T foo(A<Y> o) { return null; } // ok\n" + |
| 4003 |
" ^^^^^^^^^^^\n" + |
| 4004 |
"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C6\n" + |
| 4005 |
"----------\n" + |
| 4006 |
"4. ERROR in X.java (at line 8)\n" + |
| 4007 |
" <T extends Z> T foo(A<Z> o) { return null; } // ok\n" + |
| 4008 |
" ^^^^^^^^^^^\n" + |
| 4009 |
"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C6\n" + |
| 4010 |
"----------\n"; |
| 3831 |
this.runNegativeTest( |
4011 |
this.runNegativeTest( |
| 3832 |
new String[] { |
4012 |
new String[] { |
| 3833 |
"X.java", |
4013 |
"X.java", |
|
Lines 3845-3871
Link Here
|
| 3845 |
"class Y {}\n" + |
4025 |
"class Y {}\n" + |
| 3846 |
"class Z {}" |
4026 |
"class Z {}" |
| 3847 |
}, |
4027 |
}, |
| 3848 |
"----------\n" + |
4028 |
expectedCompilerLog |
| 3849 |
"1. ERROR in X.java (at line 3)\n" + |
|
|
| 3850 |
" A<Y> foo(A<Y> o) { return null; } // duplicate\n" + |
| 3851 |
" ^^^^^^^^^^^\n" + |
| 3852 |
"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + |
| 3853 |
"----------\n" + |
| 3854 |
"2. ERROR in X.java (at line 4)\n" + |
| 3855 |
" A<Z> foo(A<Z> o) { return null; } // duplicate\n" + |
| 3856 |
" ^^^^^^^^^^^\n" + |
| 3857 |
"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + |
| 3858 |
"----------\n" + |
| 3859 |
"3. ERROR in X.java (at line 7)\n" + |
| 3860 |
" <T extends Y> T foo(A<Y> o) { return null; } // ok\n" + |
| 3861 |
" ^^^^^^^^^^^\n" + |
| 3862 |
"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C6\n" + |
| 3863 |
"----------\n" + |
| 3864 |
"4. ERROR in X.java (at line 8)\n" + |
| 3865 |
" <T extends Z> T foo(A<Z> o) { return null; } // ok\n" + |
| 3866 |
" ^^^^^^^^^^^\n" + |
| 3867 |
"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C6\n" + |
| 3868 |
"----------\n" |
| 3869 |
); |
4029 |
); |
| 3870 |
/* javac 7 |
4030 |
/* javac 7 |
| 3871 |
X.java:4: name clash: foo(A<Z>) and foo(A<Y>) have the same erasure |
4031 |
X.java:4: name clash: foo(A<Z>) and foo(A<Y>) have the same erasure |
|
Lines 3882-3887
Link Here
|
| 3882 |
} |
4042 |
} |
| 3883 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
4043 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
| 3884 |
public void test050d() { |
4044 |
public void test050d() { |
|
|
4045 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 4046 |
"----------\n" + |
| 4047 |
"1. WARNING in X.java (at line 3)\n" + |
| 4048 |
" <T extends Y, U> T foo(Object o) { return null; } // ok\n" + |
| 4049 |
" ^^^^^^^^^^^^^\n" + |
| 4050 |
"Duplicate method foo(Object) in type X.C7\n" + |
| 4051 |
"----------\n" + |
| 4052 |
"2. WARNING in X.java (at line 4)\n" + |
| 4053 |
" <T extends Z> T foo(Object o) { return null; } // ok\n" + |
| 4054 |
" ^^^^^^^^^^^^^\n" + |
| 4055 |
"Duplicate method foo(Object) in type X.C7\n" + |
| 4056 |
"----------\n": |
| 4057 |
"----------\n" + |
| 4058 |
"1. ERROR in X.java (at line 3)\n" + |
| 4059 |
" <T extends Y, U> T foo(Object o) { return null; } // ok\n" + |
| 4060 |
" ^^^^^^^^^^^^^\n" + |
| 4061 |
"Duplicate method foo(Object) in type X.C7\n" + |
| 4062 |
"----------\n" + |
| 4063 |
"2. ERROR in X.java (at line 4)\n" + |
| 4064 |
" <T extends Z> T foo(Object o) { return null; } // ok\n" + |
| 4065 |
" ^^^^^^^^^^^^^\n" + |
| 4066 |
"Duplicate method foo(Object) in type X.C7\n" + |
| 4067 |
"----------\n"; |
| 3885 |
this.runNegativeTest( |
4068 |
this.runNegativeTest( |
| 3886 |
new String[] { |
4069 |
new String[] { |
| 3887 |
"X.java", |
4070 |
"X.java", |
|
Lines 3895-3911
Link Here
|
| 3895 |
"class Y {}\n" + |
4078 |
"class Y {}\n" + |
| 3896 |
"class Z {}" |
4079 |
"class Z {}" |
| 3897 |
}, |
4080 |
}, |
| 3898 |
"----------\n" + |
4081 |
expectedCompilerLog |
| 3899 |
"1. ERROR in X.java (at line 3)\n" + |
|
|
| 3900 |
" <T extends Y, U> T foo(Object o) { return null; } // ok\n" + |
| 3901 |
" ^^^^^^^^^^^^^\n" + |
| 3902 |
"Duplicate method foo(Object) in type X.C7\n" + |
| 3903 |
"----------\n" + |
| 3904 |
"2. ERROR in X.java (at line 4)\n" + |
| 3905 |
" <T extends Z> T foo(Object o) { return null; } // ok\n" + |
| 3906 |
" ^^^^^^^^^^^^^\n" + |
| 3907 |
"Duplicate method foo(Object) in type X.C7\n" + |
| 3908 |
"----------\n" |
| 3909 |
); |
4082 |
); |
| 3910 |
/* javac 7 |
4083 |
/* javac 7 |
| 3911 |
X.java:4: name clash: <T#1>foo(Object) and <T#2,U>foo(Object) have the same erasure |
4084 |
X.java:4: name clash: <T#1>foo(Object) and <T#2,U>foo(Object) have the same erasure |
|
Lines 3921-3926
Link Here
|
| 3921 |
|
4094 |
|
| 3922 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
4095 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
| 3923 |
public void test050e() { |
4096 |
public void test050e() { |
|
|
4097 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 4098 |
"----------\n" + |
| 4099 |
"1. WARNING in X.java (at line 2)\n" + |
| 4100 |
" <N extends B> N a(A<String> s) { return null; }\n" + |
| 4101 |
" ^^^^^^^^^^^^^^\n" + |
| 4102 |
"Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" + |
| 4103 |
"----------\n" + |
| 4104 |
"2. WARNING in X.java (at line 3)\n" + |
| 4105 |
" <N> Object a(A<Number> n) { return null; }\n" + |
| 4106 |
" ^^^^^^^^^^^^^^\n" + |
| 4107 |
"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + |
| 4108 |
"----------\n" + |
| 4109 |
"3. WARNING in X.java (at line 4)\n" + |
| 4110 |
" <N extends B> void b(A<String> s) {}\n" + |
| 4111 |
" ^^^^^^^^^^^^^^\n" + |
| 4112 |
"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + |
| 4113 |
"----------\n" + |
| 4114 |
"4. WARNING in X.java (at line 5)\n" + |
| 4115 |
" <N extends B> B b(A<Number> n) { return null; }\n" + |
| 4116 |
" ^^^^^^^^^^^^^^\n" + |
| 4117 |
"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + |
| 4118 |
"----------\n" + |
| 4119 |
"5. WARNING in X.java (at line 6)\n" + |
| 4120 |
" void c(A<String> s) {}\n" + |
| 4121 |
" ^^^^^^^^^^^^^^\n" + |
| 4122 |
"Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" + |
| 4123 |
"----------\n" + |
| 4124 |
"6. WARNING in X.java (at line 7)\n" + |
| 4125 |
" B c(A<Number> n) { return null; }\n" + |
| 4126 |
" ^^^^^^^^^^^^^^\n" + |
| 4127 |
"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + |
| 4128 |
"----------\n": |
| 4129 |
"----------\n" + |
| 4130 |
"1. ERROR in X.java (at line 2)\n" + |
| 4131 |
" <N extends B> N a(A<String> s) { return null; }\n" + |
| 4132 |
" ^^^^^^^^^^^^^^\n" + |
| 4133 |
"Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" + |
| 4134 |
"----------\n" + |
| 4135 |
"2. ERROR in X.java (at line 3)\n" + |
| 4136 |
" <N> Object a(A<Number> n) { return null; }\n" + |
| 4137 |
" ^^^^^^^^^^^^^^\n" + |
| 4138 |
"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + |
| 4139 |
"----------\n" + |
| 4140 |
"3. ERROR in X.java (at line 4)\n" + |
| 4141 |
" <N extends B> void b(A<String> s) {}\n" + |
| 4142 |
" ^^^^^^^^^^^^^^\n" + |
| 4143 |
"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + |
| 4144 |
"----------\n" + |
| 4145 |
"4. ERROR in X.java (at line 5)\n" + |
| 4146 |
" <N extends B> B b(A<Number> n) { return null; }\n" + |
| 4147 |
" ^^^^^^^^^^^^^^\n" + |
| 4148 |
"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + |
| 4149 |
"----------\n" + |
| 4150 |
"5. ERROR in X.java (at line 6)\n" + |
| 4151 |
" void c(A<String> s) {}\n" + |
| 4152 |
" ^^^^^^^^^^^^^^\n" + |
| 4153 |
"Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" + |
| 4154 |
"----------\n" + |
| 4155 |
"6. ERROR in X.java (at line 7)\n" + |
| 4156 |
" B c(A<Number> n) { return null; }\n" + |
| 4157 |
" ^^^^^^^^^^^^^^\n" + |
| 4158 |
"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + |
| 4159 |
"----------\n"; |
| 3924 |
this.runNegativeTest( |
4160 |
this.runNegativeTest( |
| 3925 |
new String[] { |
4161 |
new String[] { |
| 3926 |
"X.java", |
4162 |
"X.java", |
|
Lines 3935-3971
Link Here
|
| 3935 |
"class A<T> {}\n" + |
4171 |
"class A<T> {}\n" + |
| 3936 |
"class B {}\n" |
4172 |
"class B {}\n" |
| 3937 |
}, |
4173 |
}, |
| 3938 |
"----------\n" + |
4174 |
expectedCompilerLog |
| 3939 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 3940 |
" <N extends B> N a(A<String> s) { return null; }\n" + |
| 3941 |
" ^^^^^^^^^^^^^^\n" + |
| 3942 |
"Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" + |
| 3943 |
"----------\n" + |
| 3944 |
"2. ERROR in X.java (at line 3)\n" + |
| 3945 |
" <N> Object a(A<Number> n) { return null; }\n" + |
| 3946 |
" ^^^^^^^^^^^^^^\n" + |
| 3947 |
"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + |
| 3948 |
"----------\n" + |
| 3949 |
"3. ERROR in X.java (at line 4)\n" + |
| 3950 |
" <N extends B> void b(A<String> s) {}\n" + |
| 3951 |
" ^^^^^^^^^^^^^^\n" + |
| 3952 |
"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + |
| 3953 |
"----------\n" + |
| 3954 |
"4. ERROR in X.java (at line 5)\n" + |
| 3955 |
" <N extends B> B b(A<Number> n) { return null; }\n" + |
| 3956 |
" ^^^^^^^^^^^^^^\n" + |
| 3957 |
"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + |
| 3958 |
"----------\n" + |
| 3959 |
"5. ERROR in X.java (at line 6)\n" + |
| 3960 |
" void c(A<String> s) {}\n" + |
| 3961 |
" ^^^^^^^^^^^^^^\n" + |
| 3962 |
"Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" + |
| 3963 |
"----------\n" + |
| 3964 |
"6. ERROR in X.java (at line 7)\n" + |
| 3965 |
" B c(A<Number> n) { return null; }\n" + |
| 3966 |
" ^^^^^^^^^^^^^^\n" + |
| 3967 |
"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + |
| 3968 |
"----------\n" |
| 3969 |
); |
4175 |
); |
| 3970 |
/* javac 7 |
4176 |
/* javac 7 |
| 3971 |
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<String>) have the same erasure |
4177 |
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<String>) have the same erasure |
|
Lines 4088-4093
Link Here
|
| 4088 |
|
4294 |
|
| 4089 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
4295 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
| 4090 |
public void test050i() { |
4296 |
public void test050i() { |
|
|
4297 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 4298 |
"----------\n" + |
| 4299 |
"1. WARNING in X.java (at line 2)\n" + |
| 4300 |
" <N extends B> N a(A<Number> s) { return null; }\n" + |
| 4301 |
" ^^^^^^^^^^^^^^\n" + |
| 4302 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4303 |
"----------\n" + |
| 4304 |
"2. WARNING in X.java (at line 3)\n" + |
| 4305 |
" <N> Object a(A<Number> n) { return null; }\n" + |
| 4306 |
" ^^^^^^^^^^^^^^\n" + |
| 4307 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4308 |
"----------\n" + |
| 4309 |
"3. WARNING in X.java (at line 4)\n" + |
| 4310 |
" <N extends B> N b(A<Number> s) { return null; }\n" + |
| 4311 |
" ^^^^^^^^^^^^^^\n" + |
| 4312 |
"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + |
| 4313 |
"----------\n" + |
| 4314 |
"4. WARNING in X.java (at line 5)\n" + |
| 4315 |
" <N> Object b(A<String> n) { return null; }\n" + |
| 4316 |
" ^^^^^^^^^^^^^^\n" + |
| 4317 |
"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + |
| 4318 |
"----------\n": |
| 4319 |
"----------\n" + |
| 4320 |
"1. ERROR in X.java (at line 2)\n" + |
| 4321 |
" <N extends B> N a(A<Number> s) { return null; }\n" + |
| 4322 |
" ^^^^^^^^^^^^^^\n" + |
| 4323 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4324 |
"----------\n" + |
| 4325 |
"2. ERROR in X.java (at line 3)\n" + |
| 4326 |
" <N> Object a(A<Number> n) { return null; }\n" + |
| 4327 |
" ^^^^^^^^^^^^^^\n" + |
| 4328 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4329 |
"----------\n" + |
| 4330 |
"3. ERROR in X.java (at line 4)\n" + |
| 4331 |
" <N extends B> N b(A<Number> s) { return null; }\n" + |
| 4332 |
" ^^^^^^^^^^^^^^\n" + |
| 4333 |
"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + |
| 4334 |
"----------\n" + |
| 4335 |
"4. ERROR in X.java (at line 5)\n" + |
| 4336 |
" <N> Object b(A<String> n) { return null; }\n" + |
| 4337 |
" ^^^^^^^^^^^^^^\n" + |
| 4338 |
"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + |
| 4339 |
"----------\n"; |
| 4091 |
this.runNegativeTest( |
4340 |
this.runNegativeTest( |
| 4092 |
new String[] { |
4341 |
new String[] { |
| 4093 |
"X.java", |
4342 |
"X.java", |
|
Lines 4100-4126
Link Here
|
| 4100 |
"class A<T> {}\n" + |
4349 |
"class A<T> {}\n" + |
| 4101 |
"class B {}\n" |
4350 |
"class B {}\n" |
| 4102 |
}, |
4351 |
}, |
| 4103 |
"----------\n" + |
4352 |
expectedCompilerLog |
| 4104 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 4105 |
" <N extends B> N a(A<Number> s) { return null; }\n" + |
| 4106 |
" ^^^^^^^^^^^^^^\n" + |
| 4107 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4108 |
"----------\n" + |
| 4109 |
"2. ERROR in X.java (at line 3)\n" + |
| 4110 |
" <N> Object a(A<Number> n) { return null; }\n" + |
| 4111 |
" ^^^^^^^^^^^^^^\n" + |
| 4112 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4113 |
"----------\n" + |
| 4114 |
"3. ERROR in X.java (at line 4)\n" + |
| 4115 |
" <N extends B> N b(A<Number> s) { return null; }\n" + |
| 4116 |
" ^^^^^^^^^^^^^^\n" + |
| 4117 |
"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + |
| 4118 |
"----------\n" + |
| 4119 |
"4. ERROR in X.java (at line 5)\n" + |
| 4120 |
" <N> Object b(A<String> n) { return null; }\n" + |
| 4121 |
" ^^^^^^^^^^^^^^\n" + |
| 4122 |
"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + |
| 4123 |
"----------\n" |
| 4124 |
); |
4353 |
); |
| 4125 |
/* javac 7 |
4354 |
/* javac 7 |
| 4126 |
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<Number>) have the same erasure |
4355 |
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<Number>) have the same erasure |
|
Lines 4192-4197
Link Here
|
| 4192 |
} |
4421 |
} |
| 4193 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
4422 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
| 4194 |
public void test050k() { |
4423 |
public void test050k() { |
|
|
4424 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 4425 |
"----------\n" + |
| 4426 |
"1. WARNING in X.java (at line 2)\n" + |
| 4427 |
" <N extends B> void a(A<Number> s) {}\n" + |
| 4428 |
" ^^^^^^^^^^^^^^\n" + |
| 4429 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4430 |
"----------\n" + |
| 4431 |
"2. WARNING in X.java (at line 3)\n" + |
| 4432 |
" <N extends B> B a(A<Number> n) { return null; }\n" + |
| 4433 |
" ^^^^^^^^^^^^^^\n" + |
| 4434 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4435 |
"----------\n" + |
| 4436 |
"3. WARNING in X.java (at line 4)\n" + |
| 4437 |
" <N extends B> Object b(A<Number> s) { return null; }\n" + |
| 4438 |
" ^^^^^^^^^^^^^^\n" + |
| 4439 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4440 |
"----------\n" + |
| 4441 |
"4. WARNING in X.java (at line 5)\n" + |
| 4442 |
" <N extends B> B b(A<Number> n) { return null; }\n" + |
| 4443 |
" ^^^^^^^^^^^^^^\n" + |
| 4444 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4445 |
"----------\n": |
| 4446 |
"----------\n" + |
| 4447 |
"1. ERROR in X.java (at line 2)\n" + |
| 4448 |
" <N extends B> void a(A<Number> s) {}\n" + |
| 4449 |
" ^^^^^^^^^^^^^^\n" + |
| 4450 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4451 |
"----------\n" + |
| 4452 |
"2. ERROR in X.java (at line 3)\n" + |
| 4453 |
" <N extends B> B a(A<Number> n) { return null; }\n" + |
| 4454 |
" ^^^^^^^^^^^^^^\n" + |
| 4455 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4456 |
"----------\n" + |
| 4457 |
"3. ERROR in X.java (at line 4)\n" + |
| 4458 |
" <N extends B> Object b(A<Number> s) { return null; }\n" + |
| 4459 |
" ^^^^^^^^^^^^^^\n" + |
| 4460 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4461 |
"----------\n" + |
| 4462 |
"4. ERROR in X.java (at line 5)\n" + |
| 4463 |
" <N extends B> B b(A<Number> n) { return null; }\n" + |
| 4464 |
" ^^^^^^^^^^^^^^\n" + |
| 4465 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4466 |
"----------\n"; |
| 4195 |
this.runNegativeTest( |
4467 |
this.runNegativeTest( |
| 4196 |
new String[] { |
4468 |
new String[] { |
| 4197 |
"X.java", |
4469 |
"X.java", |
|
Lines 4204-4230
Link Here
|
| 4204 |
"class A<T> {}\n" + |
4476 |
"class A<T> {}\n" + |
| 4205 |
"class B {}\n" |
4477 |
"class B {}\n" |
| 4206 |
}, |
4478 |
}, |
| 4207 |
"----------\n" + |
4479 |
expectedCompilerLog |
| 4208 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 4209 |
" <N extends B> void a(A<Number> s) {}\n" + |
| 4210 |
" ^^^^^^^^^^^^^^\n" + |
| 4211 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4212 |
"----------\n" + |
| 4213 |
"2. ERROR in X.java (at line 3)\n" + |
| 4214 |
" <N extends B> B a(A<Number> n) { return null; }\n" + |
| 4215 |
" ^^^^^^^^^^^^^^\n" + |
| 4216 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4217 |
"----------\n" + |
| 4218 |
"3. ERROR in X.java (at line 4)\n" + |
| 4219 |
" <N extends B> Object b(A<Number> s) { return null; }\n" + |
| 4220 |
" ^^^^^^^^^^^^^^\n" + |
| 4221 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4222 |
"----------\n" + |
| 4223 |
"4. ERROR in X.java (at line 5)\n" + |
| 4224 |
" <N extends B> B b(A<Number> n) { return null; }\n" + |
| 4225 |
" ^^^^^^^^^^^^^^\n" + |
| 4226 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4227 |
"----------\n" |
| 4228 |
); |
4480 |
); |
| 4229 |
/* javac 7 |
4481 |
/* javac 7 |
| 4230 |
X.java:3: <N>a(A<Number>) is already defined in X |
4482 |
X.java:3: <N>a(A<Number>) is already defined in X |
|
Lines 4242-4247
Link Here
|
| 4242 |
} |
4494 |
} |
| 4243 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
4495 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
| 4244 |
public void test050l() { |
4496 |
public void test050l() { |
|
|
4497 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 4498 |
"----------\n" + |
| 4499 |
"1. WARNING in X.java (at line 2)\n" + |
| 4500 |
" void a(A<Number> s) {}\n" + |
| 4501 |
" ^^^^^^^^^^^^^^\n" + |
| 4502 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4503 |
"----------\n" + |
| 4504 |
"2. WARNING in X.java (at line 3)\n" + |
| 4505 |
" B a(A<Number> n) { return null; }\n" + |
| 4506 |
" ^^^^^^^^^^^^^^\n" + |
| 4507 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4508 |
"----------\n" + |
| 4509 |
"3. WARNING in X.java (at line 4)\n" + |
| 4510 |
" Object b(A<Number> s) {}\n" + |
| 4511 |
" ^^^^^^^^^^^^^^\n" + |
| 4512 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4513 |
"----------\n" + |
| 4514 |
"4. ERROR in X.java (at line 4)\n" + |
| 4515 |
" Object b(A<Number> s) {}\n" + |
| 4516 |
" ^^^^^^^^^^^^^^\n" + |
| 4517 |
"This method must return a result of type Object\n" + |
| 4518 |
"----------\n" + |
| 4519 |
"5. WARNING in X.java (at line 5)\n" + |
| 4520 |
" B b(A<Number> n) { return null; }\n" + |
| 4521 |
" ^^^^^^^^^^^^^^\n" + |
| 4522 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4523 |
"----------\n": |
| 4524 |
"----------\n" + |
| 4525 |
"1. ERROR in X.java (at line 2)\n" + |
| 4526 |
" void a(A<Number> s) {}\n" + |
| 4527 |
" ^^^^^^^^^^^^^^\n" + |
| 4528 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4529 |
"----------\n" + |
| 4530 |
"2. ERROR in X.java (at line 3)\n" + |
| 4531 |
" B a(A<Number> n) { return null; }\n" + |
| 4532 |
" ^^^^^^^^^^^^^^\n" + |
| 4533 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4534 |
"----------\n" + |
| 4535 |
"3. ERROR in X.java (at line 4)\n" + |
| 4536 |
" Object b(A<Number> s) {}\n" + |
| 4537 |
" ^^^^^^^^^^^^^^\n" + |
| 4538 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4539 |
"----------\n" + |
| 4540 |
"4. ERROR in X.java (at line 4)\n" + |
| 4541 |
" Object b(A<Number> s) {}\n" + |
| 4542 |
" ^^^^^^^^^^^^^^\n" + |
| 4543 |
"This method must return a result of type Object\n" + |
| 4544 |
"----------\n" + |
| 4545 |
"5. ERROR in X.java (at line 5)\n" + |
| 4546 |
" B b(A<Number> n) { return null; }\n" + |
| 4547 |
" ^^^^^^^^^^^^^^\n" + |
| 4548 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4549 |
"----------\n"; |
| 4245 |
this.runNegativeTest( |
4550 |
this.runNegativeTest( |
| 4246 |
new String[] { |
4551 |
new String[] { |
| 4247 |
"X.java", |
4552 |
"X.java", |
|
Lines 4254-4280
Link Here
|
| 4254 |
"class A<T> {}\n" + |
4559 |
"class A<T> {}\n" + |
| 4255 |
"class B {}\n" |
4560 |
"class B {}\n" |
| 4256 |
}, |
4561 |
}, |
| 4257 |
"----------\n" + |
4562 |
expectedCompilerLog |
| 4258 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 4259 |
" void a(A<Number> s) {}\n" + |
| 4260 |
" ^^^^^^^^^^^^^^\n" + |
| 4261 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4262 |
"----------\n" + |
| 4263 |
"2. ERROR in X.java (at line 3)\n" + |
| 4264 |
" B a(A<Number> n) { return null; }\n" + |
| 4265 |
" ^^^^^^^^^^^^^^\n" + |
| 4266 |
"Duplicate method a(A<Number>) in type X\n" + |
| 4267 |
"----------\n" + |
| 4268 |
"3. ERROR in X.java (at line 4)\n" + |
| 4269 |
" Object b(A<Number> s) {}\n" + |
| 4270 |
" ^^^^^^^^^^^^^^\n" + |
| 4271 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4272 |
"----------\n" + |
| 4273 |
"4. ERROR in X.java (at line 5)\n" + |
| 4274 |
" B b(A<Number> n) { return null; }\n" + |
| 4275 |
" ^^^^^^^^^^^^^^\n" + |
| 4276 |
"Duplicate method b(A<Number>) in type X\n" + |
| 4277 |
"----------\n" |
| 4278 |
); |
4563 |
); |
| 4279 |
/* javac 7 |
4564 |
/* javac 7 |
| 4280 |
X.java:3: a(A<Number>) is already defined in X |
4565 |
X.java:3: a(A<Number>) is already defined in X |
|
Lines 4347-4352
Link Here
|
| 4347 |
} |
4632 |
} |
| 4348 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 |
4633 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 |
| 4349 |
public void test051b() { |
4634 |
public void test051b() { |
|
|
4635 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 4636 |
"----------\n" + |
| 4637 |
"1. WARNING in X.java (at line 2)\n" + |
| 4638 |
" void foo(A<String> a) {}\n" + |
| 4639 |
" ^^^^^^^^^^^^^^^^\n" + |
| 4640 |
"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + |
| 4641 |
"----------\n" + |
| 4642 |
"2. WARNING in X.java (at line 3)\n" + |
| 4643 |
" Object foo(A<Integer> a) { return null; }\n" + |
| 4644 |
" ^^^^^^^^^^^^^^^^^\n" + |
| 4645 |
"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + |
| 4646 |
"----------\n": |
| 4647 |
"----------\n" + |
| 4648 |
"1. ERROR in X.java (at line 2)\n" + |
| 4649 |
" void foo(A<String> a) {}\n" + |
| 4650 |
" ^^^^^^^^^^^^^^^^\n" + |
| 4651 |
"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + |
| 4652 |
"----------\n" + |
| 4653 |
"2. ERROR in X.java (at line 3)\n" + |
| 4654 |
" Object foo(A<Integer> a) { return null; }\n" + |
| 4655 |
" ^^^^^^^^^^^^^^^^^\n" + |
| 4656 |
"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + |
| 4657 |
"----------\n"; |
| 4350 |
this.runNegativeTest( |
4658 |
this.runNegativeTest( |
| 4351 |
new String[] { |
4659 |
new String[] { |
| 4352 |
"X.java", |
4660 |
"X.java", |
|
Lines 4356-4372
Link Here
|
| 4356 |
"}\n" + |
4664 |
"}\n" + |
| 4357 |
"class A<T> {}\n", |
4665 |
"class A<T> {}\n", |
| 4358 |
}, |
4666 |
}, |
| 4359 |
"----------\n" + |
4667 |
expectedCompilerLog |
| 4360 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 4361 |
" void foo(A<String> a) {}\n" + |
| 4362 |
" ^^^^^^^^^^^^^^^^\n" + |
| 4363 |
"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + |
| 4364 |
"----------\n" + |
| 4365 |
"2. ERROR in X.java (at line 3)\n" + |
| 4366 |
" Object foo(A<Integer> a) { return null; }\n" + |
| 4367 |
" ^^^^^^^^^^^^^^^^^\n" + |
| 4368 |
"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + |
| 4369 |
"----------\n" |
| 4370 |
); |
4668 |
); |
| 4371 |
/* javac 7 |
4669 |
/* javac 7 |
| 4372 |
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure |
4670 |
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure |
|
Lines 4489-4494
Link Here
|
| 4489 |
|
4787 |
|
| 4490 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4788 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
| 4491 |
public void test054() { |
4789 |
public void test054() { |
|
|
4790 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 4791 |
"----------\n" + |
| 4792 |
"1. WARNING in X.java (at line 2)\n" + |
| 4793 |
" void a(Object x) {}\n" + |
| 4794 |
" ^^^^^^^^^^^\n" + |
| 4795 |
"Method a(Object) has the same erasure a(Object) as another method in type X\n" + |
| 4796 |
"----------\n" + |
| 4797 |
"2. WARNING in X.java (at line 3)\n" + |
| 4798 |
" <T> T a(T x) { return null; }\n" + |
| 4799 |
" ^^^^^^\n" + |
| 4800 |
"Method a(T) has the same erasure a(Object) as another method in type X\n" + |
| 4801 |
"----------\n": |
| 4802 |
"----------\n" + |
| 4803 |
"1. ERROR in X.java (at line 2)\n" + |
| 4804 |
" void a(Object x) {}\n" + |
| 4805 |
" ^^^^^^^^^^^\n" + |
| 4806 |
"Method a(Object) has the same erasure a(Object) as another method in type X\n" + |
| 4807 |
"----------\n" + |
| 4808 |
"2. ERROR in X.java (at line 3)\n" + |
| 4809 |
" <T> T a(T x) { return null; }\n" + |
| 4810 |
" ^^^^^^\n" + |
| 4811 |
"Method a(T) has the same erasure a(Object) as another method in type X\n" + |
| 4812 |
"----------\n"; |
| 4492 |
this.runNegativeTest( |
4813 |
this.runNegativeTest( |
| 4493 |
new String[] { |
4814 |
new String[] { |
| 4494 |
"X.java", |
4815 |
"X.java", |
|
Lines 4497-4513
Link Here
|
| 4497 |
" <T> T a(T x) { return null; }\n" + |
4818 |
" <T> T a(T x) { return null; }\n" + |
| 4498 |
"}\n" |
4819 |
"}\n" |
| 4499 |
}, |
4820 |
}, |
| 4500 |
"----------\n" + |
4821 |
expectedCompilerLog |
| 4501 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 4502 |
" void a(Object x) {}\n" + |
| 4503 |
" ^^^^^^^^^^^\n" + |
| 4504 |
"Method a(Object) has the same erasure a(Object) as another method in type X\n" + |
| 4505 |
"----------\n" + |
| 4506 |
"2. ERROR in X.java (at line 3)\n" + |
| 4507 |
" <T> T a(T x) { return null; }\n" + |
| 4508 |
" ^^^^^^\n" + |
| 4509 |
"Method a(T) has the same erasure a(Object) as another method in type X\n" + |
| 4510 |
"----------\n" |
| 4511 |
); |
4822 |
); |
| 4512 |
/* javac 7 |
4823 |
/* javac 7 |
| 4513 |
X.java:3: a(Object) is already defined in X |
4824 |
X.java:3: a(Object) is already defined in X |
|
Lines 4518-4523
Link Here
|
| 4518 |
} |
4829 |
} |
| 4519 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4830 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
| 4520 |
public void test054a() { |
4831 |
public void test054a() { |
|
|
4832 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 4833 |
"----------\n" + |
| 4834 |
"1. WARNING in X.java (at line 2)\n" + |
| 4835 |
" <T1, T2> String aaa(X x) { return null; }\n" + |
| 4836 |
" ^^^^^^^^\n" + |
| 4837 |
"Method aaa(X) has the same erasure aaa(X) as another method in type X\n" + |
| 4838 |
"----------\n" + |
| 4839 |
"2. WARNING in X.java (at line 3)\n" + |
| 4840 |
" <T extends X> T aaa(T x) { return null; }\n" + |
| 4841 |
" ^^^^^^^^\n" + |
| 4842 |
"Method aaa(T) has the same erasure aaa(X) as another method in type X\n" + |
| 4843 |
"----------\n" + |
| 4844 |
"3. WARNING in X.java (at line 4)\n" + |
| 4845 |
" <T> String aa(X x) { return null; }\n" + |
| 4846 |
" ^^^^^^^\n" + |
| 4847 |
"Method aa(X) has the same erasure aa(X) as another method in type X\n" + |
| 4848 |
"----------\n" + |
| 4849 |
"4. WARNING in X.java (at line 5)\n" + |
| 4850 |
" <T extends X> T aa(T x) { return null; }\n" + |
| 4851 |
" ^^^^^^^\n" + |
| 4852 |
"Method aa(T) has the same erasure aa(X) as another method in type X\n" + |
| 4853 |
"----------\n" + |
| 4854 |
"5. WARNING in X.java (at line 6)\n" + |
| 4855 |
" String a(X x) { return null; }\n" + |
| 4856 |
" ^^^^^^\n" + |
| 4857 |
"Method a(X) has the same erasure a(X) as another method in type X\n" + |
| 4858 |
"----------\n" + |
| 4859 |
"6. WARNING in X.java (at line 7)\n" + |
| 4860 |
" <T extends X> T a(T x) { return null; }\n" + |
| 4861 |
" ^^^^^^\n" + |
| 4862 |
"Method a(T) has the same erasure a(X) as another method in type X\n" + |
| 4863 |
"----------\n" + |
| 4864 |
"7. WARNING in X.java (at line 8)\n" + |
| 4865 |
" <T> String z(X x) { return null; }\n" + |
| 4866 |
" ^^^^^^\n" + |
| 4867 |
"Duplicate method z(X) in type X\n" + |
| 4868 |
"----------\n" + |
| 4869 |
"8. WARNING in X.java (at line 9)\n" + |
| 4870 |
" <T, S> Object z(X x) { return null; }\n" + |
| 4871 |
" ^^^^^^\n" + |
| 4872 |
"Duplicate method z(X) in type X\n" + |
| 4873 |
"----------\n": |
| 4874 |
"----------\n" + |
| 4875 |
"1. ERROR in X.java (at line 2)\n" + |
| 4876 |
" <T1, T2> String aaa(X x) { return null; }\n" + |
| 4877 |
" ^^^^^^^^\n" + |
| 4878 |
"Method aaa(X) has the same erasure aaa(X) as another method in type X\n" + |
| 4879 |
"----------\n" + |
| 4880 |
"2. ERROR in X.java (at line 3)\n" + |
| 4881 |
" <T extends X> T aaa(T x) { return null; }\n" + |
| 4882 |
" ^^^^^^^^\n" + |
| 4883 |
"Method aaa(T) has the same erasure aaa(X) as another method in type X\n" + |
| 4884 |
"----------\n" + |
| 4885 |
"3. ERROR in X.java (at line 4)\n" + |
| 4886 |
" <T> String aa(X x) { return null; }\n" + |
| 4887 |
" ^^^^^^^\n" + |
| 4888 |
"Method aa(X) has the same erasure aa(X) as another method in type X\n" + |
| 4889 |
"----------\n" + |
| 4890 |
"4. ERROR in X.java (at line 5)\n" + |
| 4891 |
" <T extends X> T aa(T x) { return null; }\n" + |
| 4892 |
" ^^^^^^^\n" + |
| 4893 |
"Method aa(T) has the same erasure aa(X) as another method in type X\n" + |
| 4894 |
"----------\n" + |
| 4895 |
"5. ERROR in X.java (at line 6)\n" + |
| 4896 |
" String a(X x) { return null; }\n" + |
| 4897 |
" ^^^^^^\n" + |
| 4898 |
"Method a(X) has the same erasure a(X) as another method in type X\n" + |
| 4899 |
"----------\n" + |
| 4900 |
"6. ERROR in X.java (at line 7)\n" + |
| 4901 |
" <T extends X> T a(T x) { return null; }\n" + |
| 4902 |
" ^^^^^^\n" + |
| 4903 |
"Method a(T) has the same erasure a(X) as another method in type X\n" + |
| 4904 |
"----------\n" + |
| 4905 |
"7. ERROR in X.java (at line 8)\n" + |
| 4906 |
" <T> String z(X x) { return null; }\n" + |
| 4907 |
" ^^^^^^\n" + |
| 4908 |
"Duplicate method z(X) in type X\n" + |
| 4909 |
"----------\n" + |
| 4910 |
"8. ERROR in X.java (at line 9)\n" + |
| 4911 |
" <T, S> Object z(X x) { return null; }\n" + |
| 4912 |
" ^^^^^^\n" + |
| 4913 |
"Duplicate method z(X) in type X\n" + |
| 4914 |
"----------\n"; |
| 4521 |
this.runNegativeTest( |
4915 |
this.runNegativeTest( |
| 4522 |
new String[] { |
4916 |
new String[] { |
| 4523 |
"X.java", |
4917 |
"X.java", |
|
Lines 4532-4578
Link Here
|
| 4532 |
" <T, S> Object z(X x) { return null; }\n" + |
4926 |
" <T, S> Object z(X x) { return null; }\n" + |
| 4533 |
"}\n" |
4927 |
"}\n" |
| 4534 |
}, |
4928 |
}, |
| 4535 |
"----------\n" + |
4929 |
expectedCompilerLog |
| 4536 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 4537 |
" <T1, T2> String aaa(X x) { return null; }\n" + |
| 4538 |
" ^^^^^^^^\n" + |
| 4539 |
"Method aaa(X) has the same erasure aaa(X) as another method in type X\n" + |
| 4540 |
"----------\n" + |
| 4541 |
"2. ERROR in X.java (at line 3)\n" + |
| 4542 |
" <T extends X> T aaa(T x) { return null; }\n" + |
| 4543 |
" ^^^^^^^^\n" + |
| 4544 |
"Method aaa(T) has the same erasure aaa(X) as another method in type X\n" + |
| 4545 |
"----------\n" + |
| 4546 |
"3. ERROR in X.java (at line 4)\n" + |
| 4547 |
" <T> String aa(X x) { return null; }\n" + |
| 4548 |
" ^^^^^^^\n" + |
| 4549 |
"Method aa(X) has the same erasure aa(X) as another method in type X\n" + |
| 4550 |
"----------\n" + |
| 4551 |
"4. ERROR in X.java (at line 5)\n" + |
| 4552 |
" <T extends X> T aa(T x) { return null; }\n" + |
| 4553 |
" ^^^^^^^\n" + |
| 4554 |
"Method aa(T) has the same erasure aa(X) as another method in type X\n" + |
| 4555 |
"----------\n" + |
| 4556 |
"5. ERROR in X.java (at line 6)\n" + |
| 4557 |
" String a(X x) { return null; }\n" + |
| 4558 |
" ^^^^^^\n" + |
| 4559 |
"Method a(X) has the same erasure a(X) as another method in type X\n" + |
| 4560 |
"----------\n" + |
| 4561 |
"6. ERROR in X.java (at line 7)\n" + |
| 4562 |
" <T extends X> T a(T x) { return null; }\n" + |
| 4563 |
" ^^^^^^\n" + |
| 4564 |
"Method a(T) has the same erasure a(X) as another method in type X\n" + |
| 4565 |
"----------\n" + |
| 4566 |
"7. ERROR in X.java (at line 8)\n" + |
| 4567 |
" <T> String z(X x) { return null; }\n" + |
| 4568 |
" ^^^^^^\n" + |
| 4569 |
"Duplicate method z(X) in type X\n" + |
| 4570 |
"----------\n" + |
| 4571 |
"8. ERROR in X.java (at line 9)\n" + |
| 4572 |
" <T, S> Object z(X x) { return null; }\n" + |
| 4573 |
" ^^^^^^\n" + |
| 4574 |
"Duplicate method z(X) in type X\n" + |
| 4575 |
"----------\n" |
| 4576 |
); |
4930 |
); |
| 4577 |
/* javac 7 |
4931 |
/* javac 7 |
| 4578 |
X.java:3: name clash: <T>aaa(T) and <T1,T2>aaa(X) have the same erasure |
4932 |
X.java:3: name clash: <T>aaa(T) and <T1,T2>aaa(X) have the same erasure |
|
Lines 4603-4608
Link Here
|
| 4603 |
} |
4957 |
} |
| 4604 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4958 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
| 4605 |
public void test054b() { |
4959 |
public void test054b() { |
|
|
4960 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 4961 |
"----------\n" + |
| 4962 |
"1. WARNING in X.java (at line 2)\n" + |
| 4963 |
" Object foo(X<T> t) { return null; }\n" + |
| 4964 |
" ^^^^^^^^^^^\n" + |
| 4965 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
| 4966 |
"----------\n" + |
| 4967 |
"2. WARNING in X.java (at line 3)\n" + |
| 4968 |
" <S> String foo(X<T> s) { return null; }\n" + |
| 4969 |
" ^^^^^^^^^^^\n" + |
| 4970 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
| 4971 |
"----------\n": |
| 4972 |
"----------\n" + |
| 4973 |
"1. ERROR in X.java (at line 2)\n" + |
| 4974 |
" Object foo(X<T> t) { return null; }\n" + |
| 4975 |
" ^^^^^^^^^^^\n" + |
| 4976 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
| 4977 |
"----------\n" + |
| 4978 |
"2. ERROR in X.java (at line 3)\n" + |
| 4979 |
" <S> String foo(X<T> s) { return null; }\n" + |
| 4980 |
" ^^^^^^^^^^^\n" + |
| 4981 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
| 4982 |
"----------\n"; |
| 4606 |
this.runNegativeTest( |
4983 |
this.runNegativeTest( |
| 4607 |
new String[] { |
4984 |
new String[] { |
| 4608 |
"X.java", |
4985 |
"X.java", |
|
Lines 4611-4627
Link Here
|
| 4611 |
" <S> String foo(X<T> s) { return null; }\n" + |
4988 |
" <S> String foo(X<T> s) { return null; }\n" + |
| 4612 |
"}\n" |
4989 |
"}\n" |
| 4613 |
}, |
4990 |
}, |
| 4614 |
"----------\n" + |
4991 |
expectedCompilerLog |
| 4615 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 4616 |
" Object foo(X<T> t) { return null; }\n" + |
| 4617 |
" ^^^^^^^^^^^\n" + |
| 4618 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
| 4619 |
"----------\n" + |
| 4620 |
"2. ERROR in X.java (at line 3)\n" + |
| 4621 |
" <S> String foo(X<T> s) { return null; }\n" + |
| 4622 |
" ^^^^^^^^^^^\n" + |
| 4623 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
| 4624 |
"----------\n" |
| 4625 |
); |
4992 |
); |
| 4626 |
/* javac 7 |
4993 |
/* javac 7 |
| 4627 |
X.java:3: name clash: <S>foo(X<T>) and foo(X<T>) have the same erasure |
4994 |
X.java:3: name clash: <S>foo(X<T>) and foo(X<T>) have the same erasure |
|
Lines 4635-4640
Link Here
|
| 4635 |
} |
5002 |
} |
| 4636 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
5003 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
| 4637 |
public void test054c() { |
5004 |
public void test054c() { |
|
|
5005 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 5006 |
"----------\n" + |
| 5007 |
"1. WARNING in X.java (at line 2)\n" + |
| 5008 |
" <T1 extends X<T1>> void dupT() {}\n" + |
| 5009 |
" ^^^^^^\n" + |
| 5010 |
"Duplicate method dupT() in type X<T>\n" + |
| 5011 |
"----------\n" + |
| 5012 |
"2. WARNING in X.java (at line 3)\n" + |
| 5013 |
" <T2 extends X<T2>> Object dupT() {return null;}\n" + |
| 5014 |
" ^^^^^^\n" + |
| 5015 |
"Duplicate method dupT() in type X<T>\n" + |
| 5016 |
"----------\n": |
| 5017 |
"----------\n" + |
| 5018 |
"1. ERROR in X.java (at line 2)\n" + |
| 5019 |
" <T1 extends X<T1>> void dupT() {}\n" + |
| 5020 |
" ^^^^^^\n" + |
| 5021 |
"Duplicate method dupT() in type X<T>\n" + |
| 5022 |
"----------\n" + |
| 5023 |
"2. ERROR in X.java (at line 3)\n" + |
| 5024 |
" <T2 extends X<T2>> Object dupT() {return null;}\n" + |
| 5025 |
" ^^^^^^\n" + |
| 5026 |
"Duplicate method dupT() in type X<T>\n" + |
| 5027 |
"----------\n"; |
| 4638 |
this.runNegativeTest( |
5028 |
this.runNegativeTest( |
| 4639 |
new String[] { |
5029 |
new String[] { |
| 4640 |
"X.java", |
5030 |
"X.java", |
|
Lines 4643-4659
Link Here
|
| 4643 |
" <T2 extends X<T2>> Object dupT() {return null;}\n" + |
5033 |
" <T2 extends X<T2>> Object dupT() {return null;}\n" + |
| 4644 |
"}\n" |
5034 |
"}\n" |
| 4645 |
}, |
5035 |
}, |
| 4646 |
"----------\n" + |
5036 |
expectedCompilerLog |
| 4647 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 4648 |
" <T1 extends X<T1>> void dupT() {}\n" + |
| 4649 |
" ^^^^^^\n" + |
| 4650 |
"Duplicate method dupT() in type X<T>\n" + |
| 4651 |
"----------\n" + |
| 4652 |
"2. ERROR in X.java (at line 3)\n" + |
| 4653 |
" <T2 extends X<T2>> Object dupT() {return null;}\n" + |
| 4654 |
" ^^^^^^\n" + |
| 4655 |
"Duplicate method dupT() in type X<T>\n" + |
| 4656 |
"----------\n" |
| 4657 |
); |
5037 |
); |
| 4658 |
/* javac 7 |
5038 |
/* javac 7 |
| 4659 |
X.java:3: <T1>dupT() is already defined in X |
5039 |
X.java:3: <T1>dupT() is already defined in X |
|
Lines 4666-4671
Link Here
|
| 4666 |
} |
5046 |
} |
| 4667 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
5047 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
| 4668 |
public void test054d() { |
5048 |
public void test054d() { |
|
|
5049 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 5050 |
"----------\n" + |
| 5051 |
"1. WARNING in X.java (at line 2)\n" + |
| 5052 |
" <T> T a(A<T> t) {return null;}\n" + |
| 5053 |
" ^^^^^^^^^\n" + |
| 5054 |
"Method a(A<T>) has the same erasure a(A<T>) as another method in type X\n" + |
| 5055 |
"----------\n" + |
| 5056 |
"2. WARNING in X.java (at line 3)\n" + |
| 5057 |
" <T> String a(A<Object> o) {return null;}\n" + |
| 5058 |
" ^^^^^^^^^^^^^^\n" + |
| 5059 |
"Method a(A<Object>) has the same erasure a(A<T>) as another method in type X\n" + |
| 5060 |
"----------\n" + |
| 5061 |
"3. WARNING in X.java (at line 4)\n" + |
| 5062 |
" <T> T aa(A<T> t) {return null;}\n" + |
| 5063 |
" ^^^^^^^^^^\n" + |
| 5064 |
"Method aa(A<T>) has the same erasure aa(A<T>) as another method in type X\n" + |
| 5065 |
"----------\n" + |
| 5066 |
"4. WARNING in X.java (at line 5)\n" + |
| 5067 |
" String aa(A<Object> o) {return null;}\n" + |
| 5068 |
" ^^^^^^^^^^^^^^^\n" + |
| 5069 |
"Method aa(A<Object>) has the same erasure aa(A<T>) as another method in type X\n" + |
| 5070 |
"----------\n": |
| 5071 |
"----------\n" + |
| 5072 |
"1. ERROR in X.java (at line 2)\n" + |
| 5073 |
" <T> T a(A<T> t) {return null;}\n" + |
| 5074 |
" ^^^^^^^^^\n" + |
| 5075 |
"Method a(A<T>) has the same erasure a(A<T>) as another method in type X\n" + |
| 5076 |
"----------\n" + |
| 5077 |
"2. ERROR in X.java (at line 3)\n" + |
| 5078 |
" <T> String a(A<Object> o) {return null;}\n" + |
| 5079 |
" ^^^^^^^^^^^^^^\n" + |
| 5080 |
"Method a(A<Object>) has the same erasure a(A<T>) as another method in type X\n" + |
| 5081 |
"----------\n" + |
| 5082 |
"3. ERROR in X.java (at line 4)\n" + |
| 5083 |
" <T> T aa(A<T> t) {return null;}\n" + |
| 5084 |
" ^^^^^^^^^^\n" + |
| 5085 |
"Method aa(A<T>) has the same erasure aa(A<T>) as another method in type X\n" + |
| 5086 |
"----------\n" + |
| 5087 |
"4. ERROR in X.java (at line 5)\n" + |
| 5088 |
" String aa(A<Object> o) {return null;}\n" + |
| 5089 |
" ^^^^^^^^^^^^^^^\n" + |
| 5090 |
"Method aa(A<Object>) has the same erasure aa(A<T>) as another method in type X\n" + |
| 5091 |
"----------\n"; |
| 4669 |
this.runNegativeTest( |
5092 |
this.runNegativeTest( |
| 4670 |
new String[] { |
5093 |
new String[] { |
| 4671 |
"X.java", |
5094 |
"X.java", |
|
Lines 4677-4703
Link Here
|
| 4677 |
"}\n" + |
5100 |
"}\n" + |
| 4678 |
"class A<T> {}\n", |
5101 |
"class A<T> {}\n", |
| 4679 |
}, |
5102 |
}, |
| 4680 |
"----------\n" + |
5103 |
expectedCompilerLog |
| 4681 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
| 4682 |
" <T> T a(A<T> t) {return null;}\n" + |
| 4683 |
" ^^^^^^^^^\n" + |
| 4684 |
"Method a(A<T>) has the same erasure a(A<T>) as another method in type X\n" + |
| 4685 |
"----------\n" + |
| 4686 |
"2. ERROR in X.java (at line 3)\n" + |
| 4687 |
" <T> String a(A<Object> o) {return null;}\n" + |
| 4688 |
" ^^^^^^^^^^^^^^\n" + |
| 4689 |
"Method a(A<Object>) has the same erasure a(A<T>) as another method in type X\n" + |
| 4690 |
"----------\n" + |
| 4691 |
"3. ERROR in X.java (at line 4)\n" + |
| 4692 |
" <T> T aa(A<T> t) {return null;}\n" + |
| 4693 |
" ^^^^^^^^^^\n" + |
| 4694 |
"Method aa(A<T>) has the same erasure aa(A<T>) as another method in type X\n" + |
| 4695 |
"----------\n" + |
| 4696 |
"4. ERROR in X.java (at line 5)\n" + |
| 4697 |
" String aa(A<Object> o) {return null;}\n" + |
| 4698 |
" ^^^^^^^^^^^^^^^\n" + |
| 4699 |
"Method aa(A<Object>) has the same erasure aa(A<T>) as another method in type X\n" + |
| 4700 |
"----------\n" |
| 4701 |
); |
5104 |
); |
| 4702 |
/* javac 7 |
5105 |
/* javac 7 |
| 4703 |
X.java:3: name clash: <T#1>a(A<Object>) and <T#2>a(A<T#2>) have the same erasure |
5106 |
X.java:3: name clash: <T#1>a(A<Object>) and <T#2>a(A<T#2>) have the same erasure |
|
Lines 4821-4826
Link Here
|
| 4821 |
} |
5224 |
} |
| 4822 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
5225 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
| 4823 |
public void test058a() { |
5226 |
public void test058a() { |
|
|
5227 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 5228 |
"----------\n" + |
| 5229 |
"1. ERROR in X.java (at line 3)\n" + |
| 5230 |
" new X<Object>().foo(\"X\");\n" + |
| 5231 |
" ^^^\n" + |
| 5232 |
"The method foo(String) is ambiguous for the type X<Object>\n" + |
| 5233 |
"----------\n" + |
| 5234 |
"2. ERROR in X.java (at line 4)\n" + |
| 5235 |
" new X<Object>().foo2(\"X\");\n" + |
| 5236 |
" ^^^^\n" + |
| 5237 |
"The method foo2(String) is ambiguous for the type X<Object>\n" + |
| 5238 |
"----------\n" + |
| 5239 |
"3. WARNING in X.java (at line 6)\n" + |
| 5240 |
" <T> T foo(T t) {return null;}\n" + |
| 5241 |
" ^^^^^^^^\n" + |
| 5242 |
"Method foo(T) has the same erasure foo(Object) as another method in type X<A>\n" + |
| 5243 |
"----------\n" + |
| 5244 |
"4. WARNING in X.java (at line 7)\n" + |
| 5245 |
" void foo(A a) {}\n" + |
| 5246 |
" ^^^^^^^^\n" + |
| 5247 |
"Method foo(A) has the same erasure foo(Object) as another method in type X<A>\n" + |
| 5248 |
"----------\n" + |
| 5249 |
"5. WARNING in X.java (at line 8)\n" + |
| 5250 |
" <T> T foo2(T t) {return null;}\n" + |
| 5251 |
" ^^^^^^^^^\n" + |
| 5252 |
"Method foo2(T) has the same erasure foo2(Object) as another method in type X<A>\n" + |
| 5253 |
"----------\n" + |
| 5254 |
"6. WARNING in X.java (at line 9)\n" + |
| 5255 |
" <T> void foo2(A a) {}\n" + |
| 5256 |
" ^^^^^^^^^\n" + |
| 5257 |
"Method foo2(A) has the same erasure foo2(Object) as another method in type X<A>\n" + |
| 5258 |
"----------\n": |
| 5259 |
"----------\n" + |
| 5260 |
"1. ERROR in X.java (at line 6)\n" + |
| 5261 |
" <T> T foo(T t) {return null;}\n" + |
| 5262 |
" ^^^^^^^^\n" + |
| 5263 |
"Method foo(T) has the same erasure foo(Object) as another method in type X<A>\n" + |
| 5264 |
"----------\n" + |
| 5265 |
"2. ERROR in X.java (at line 7)\n" + |
| 5266 |
" void foo(A a) {}\n" + |
| 5267 |
" ^^^^^^^^\n" + |
| 5268 |
"Method foo(A) has the same erasure foo(Object) as another method in type X<A>\n" + |
| 5269 |
"----------\n" + |
| 5270 |
"3. ERROR in X.java (at line 8)\n" + |
| 5271 |
" <T> T foo2(T t) {return null;}\n" + |
| 5272 |
" ^^^^^^^^^\n" + |
| 5273 |
"Method foo2(T) has the same erasure foo2(Object) as another method in type X<A>\n" + |
| 5274 |
"----------\n" + |
| 5275 |
"4. ERROR in X.java (at line 9)\n" + |
| 5276 |
" <T> void foo2(A a) {}\n" + |
| 5277 |
" ^^^^^^^^^\n" + |
| 5278 |
"Method foo2(A) has the same erasure foo2(Object) as another method in type X<A>\n" + |
| 5279 |
"----------\n"; |
| 4824 |
this.runNegativeTest( |
5280 |
this.runNegativeTest( |
| 4825 |
new String[] { |
5281 |
new String[] { |
| 4826 |
"X.java", |
5282 |
"X.java", |
|
Lines 4835-4861
Link Here
|
| 4835 |
" <T> void foo2(A a) {}\n" + |
5291 |
" <T> void foo2(A a) {}\n" + |
| 4836 |
"}\n" |
5292 |
"}\n" |
| 4837 |
}, |
5293 |
}, |
| 4838 |
"----------\n" + |
5294 |
expectedCompilerLog |
| 4839 |
"1. ERROR in X.java (at line 6)\n" + |
|
|
| 4840 |
" <T> T foo(T t) {return null;}\n" + |
| 4841 |
" ^^^^^^^^\n" + |
| 4842 |
"Method foo(T) has the same erasure foo(Object) as another method in type X<A>\n" + |
| 4843 |
"----------\n" + |
| 4844 |
"2. ERROR in X.java (at line 7)\n" + |
| 4845 |
" void foo(A a) {}\n" + |
| 4846 |
" ^^^^^^^^\n" + |
| 4847 |
"Method foo(A) has the same erasure foo(Object) as another method in type X<A>\n" + |
| 4848 |
"----------\n" + |
| 4849 |
"3. ERROR in X.java (at line 8)\n" + |
| 4850 |
" <T> T foo2(T t) {return null;}\n" + |
| 4851 |
" ^^^^^^^^^\n" + |
| 4852 |
"Method foo2(T) has the same erasure foo2(Object) as another method in type X<A>\n" + |
| 4853 |
"----------\n" + |
| 4854 |
"4. ERROR in X.java (at line 9)\n" + |
| 4855 |
" <T> void foo2(A a) {}\n" + |
| 4856 |
" ^^^^^^^^^\n" + |
| 4857 |
"Method foo2(A) has the same erasure foo2(Object) as another method in type X<A>\n" + |
| 4858 |
"----------\n" |
| 4859 |
); |
5295 |
); |
| 4860 |
/* javac 7 |
5296 |
/* javac 7 |
| 4861 |
X.java:7: name clash: foo(A) and <T>foo(T) have the same erasure |
5297 |
X.java:7: name clash: foo(A) and <T>foo(T) have the same erasure |
|
Lines 4876-4881
Link Here
|
| 4876 |
} |
5312 |
} |
| 4877 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
5313 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
| 4878 |
public void test058b() { |
5314 |
public void test058b() { |
|
|
5315 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 5316 |
"----------\n" + |
| 5317 |
"1. ERROR in X.java (at line 3)\n" + |
| 5318 |
" new X<Object>().foo(\"X\");\n" + |
| 5319 |
" ^^^\n" + |
| 5320 |
"The method foo(String) is ambiguous for the type X<Object>\n" + |
| 5321 |
"----------\n" + |
| 5322 |
"2. ERROR in X.java (at line 4)\n" + |
| 5323 |
" new X<Object>().foo2(\"X\");\n" + |
| 5324 |
" ^^^^\n" + |
| 5325 |
"The method foo2(String) is ambiguous for the type X<Object>\n" + |
| 5326 |
"----------\n" + |
| 5327 |
"3. WARNING in X.java (at line 6)\n" + |
| 5328 |
" <T> T foo(T t) {return null;}\n" + |
| 5329 |
" ^^^^^^^^\n" + |
| 5330 |
"Name clash: The method foo(T) of type X<A> has the same erasure as foo(A) of type Y<A> but does not override it\n" + |
| 5331 |
"----------\n" + |
| 5332 |
"4. WARNING in X.java (at line 7)\n" + |
| 5333 |
" <T> T foo2(T t) {return null;}\n" + |
| 5334 |
" ^^^^^^^^^\n" + |
| 5335 |
"Name clash: The method foo2(T) of type X<A> has the same erasure as foo2(A) of type Y<A> but does not override it\n" + |
| 5336 |
"----------\n": |
| 5337 |
"----------\n" + |
| 5338 |
"1. ERROR in X.java (at line 3)\n" + |
| 5339 |
" new X<Object>().foo(\"X\");\n" + |
| 5340 |
" ^^^\n" + |
| 5341 |
"The method foo(String) is ambiguous for the type X<Object>\n" + |
| 5342 |
"----------\n" + |
| 5343 |
"2. ERROR in X.java (at line 4)\n" + |
| 5344 |
" new X<Object>().foo2(\"X\");\n" + |
| 5345 |
" ^^^^\n" + |
| 5346 |
"The method foo2(String) is ambiguous for the type X<Object>\n" + |
| 5347 |
"----------\n" + |
| 5348 |
"3. ERROR in X.java (at line 6)\n" + |
| 5349 |
" <T> T foo(T t) {return null;}\n" + |
| 5350 |
" ^^^^^^^^\n" + |
| 5351 |
"Name clash: The method foo(T) of type X<A> has the same erasure as foo(A) of type Y<A> but does not override it\n" + |
| 5352 |
"----------\n" + |
| 5353 |
"4. ERROR in X.java (at line 7)\n" + |
| 5354 |
" <T> T foo2(T t) {return null;}\n" + |
| 5355 |
" ^^^^^^^^^\n" + |
| 5356 |
"Name clash: The method foo2(T) of type X<A> has the same erasure as foo2(A) of type Y<A> but does not override it\n" + |
| 5357 |
"----------\n"; |
| 4879 |
this.runNegativeTest( |
5358 |
this.runNegativeTest( |
| 4880 |
new String[] { |
5359 |
new String[] { |
| 4881 |
"X.java", |
5360 |
"X.java", |
|
Lines 4892-4918
Link Here
|
| 4892 |
" <T> void foo2(A a) {}\n" + |
5371 |
" <T> void foo2(A a) {}\n" + |
| 4893 |
"}" |
5372 |
"}" |
| 4894 |
}, |
5373 |
}, |
| 4895 |
"----------\n" + |
5374 |
expectedCompilerLog |
| 4896 |
"1. ERROR in X.java (at line 3)\n" + |
|
|
| 4897 |
" new X<Object>().foo(\"X\");\n" + |
| 4898 |
" ^^^\n" + |
| 4899 |
"The method foo(String) is ambiguous for the type X<Object>\n" + |
| 4900 |
"----------\n" + |
| 4901 |
"2. ERROR in X.java (at line 4)\n" + |
| 4902 |
" new X<Object>().foo2(\"X\");\n" + |
| 4903 |
" ^^^^\n" + |
| 4904 |
"The method foo2(String) is ambiguous for the type X<Object>\n" + |
| 4905 |
"----------\n" + |
| 4906 |
"3. ERROR in X.java (at line 6)\n" + |
| 4907 |
" <T> T foo(T t) {return null;}\n" + |
| 4908 |
" ^^^^^^^^\n" + |
| 4909 |
"Name clash: The method foo(T) of type X<A> has the same erasure as foo(A) of type Y<A> but does not override it\n" + |
| 4910 |
"----------\n" + |
| 4911 |
"4. ERROR in X.java (at line 7)\n" + |
| 4912 |
" <T> T foo2(T t) {return null;}\n" + |
| 4913 |
" ^^^^^^^^^\n" + |
| 4914 |
"Name clash: The method foo2(T) of type X<A> has the same erasure as foo2(A) of type Y<A> but does not override it\n" + |
| 4915 |
"----------\n" |
| 4916 |
); |
5375 |
); |
| 4917 |
/* javac 7 |
5376 |
/* javac 7 |
| 4918 |
X.java:3: reference to foo is ambiguous, both method foo(A) in Y and method <T>foo(T) in X match |
5377 |
X.java:3: reference to foo is ambiguous, both method foo(A) in Y and method <T>foo(T) in X match |
|
Lines 6877-6882
Link Here
|
| 6877 |
|
7336 |
|
| 6878 |
// name conflict |
7337 |
// name conflict |
| 6879 |
public void test101() { |
7338 |
public void test101() { |
|
|
7339 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 7340 |
"----------\n" + |
| 7341 |
"1. WARNING in X.java (at line 3)\n" + |
| 7342 |
" Integer getX(List<Integer> l) {\n" + |
| 7343 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 7344 |
"Method getX(List<Integer>) has the same erasure getX(List<E>) as another method in type X\n" + |
| 7345 |
"----------\n" + |
| 7346 |
"2. WARNING in X.java (at line 6)\n" + |
| 7347 |
" String getX(List<String> l) {\n" + |
| 7348 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 7349 |
"Method getX(List<String>) has the same erasure getX(List<E>) as another method in type X\n" + |
| 7350 |
"----------\n" + |
| 7351 |
"3. WARNING in X.java (at line 11)\n" + |
| 7352 |
" Integer getX(List<Integer> l) {\n" + |
| 7353 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 7354 |
"Duplicate method getX(List<Integer>) in type Y\n" + |
| 7355 |
"----------\n" + |
| 7356 |
"4. WARNING in X.java (at line 14)\n" + |
| 7357 |
" String getX(List<Integer> l) {\n" + |
| 7358 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 7359 |
"Duplicate method getX(List<Integer>) in type Y\n" + |
| 7360 |
"----------\n": |
| 7361 |
"----------\n" + |
| 7362 |
"1. ERROR in X.java (at line 3)\n" + |
| 7363 |
" Integer getX(List<Integer> l) {\n" + |
| 7364 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 7365 |
"Method getX(List<Integer>) has the same erasure getX(List<E>) as another method in type X\n" + |
| 7366 |
"----------\n" + |
| 7367 |
"2. ERROR in X.java (at line 6)\n" + |
| 7368 |
" String getX(List<String> l) {\n" + |
| 7369 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 7370 |
"Method getX(List<String>) has the same erasure getX(List<E>) as another method in type X\n" + |
| 7371 |
"----------\n" + |
| 7372 |
"3. ERROR in X.java (at line 11)\n" + |
| 7373 |
" Integer getX(List<Integer> l) {\n" + |
| 7374 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 7375 |
"Duplicate method getX(List<Integer>) in type Y\n" + |
| 7376 |
"----------\n" + |
| 7377 |
"4. ERROR in X.java (at line 14)\n" + |
| 7378 |
" String getX(List<Integer> l) {\n" + |
| 7379 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 7380 |
"Duplicate method getX(List<Integer>) in type Y\n" + |
| 7381 |
"----------\n"; |
| 6880 |
this.runNegativeTest( |
7382 |
this.runNegativeTest( |
| 6881 |
new String[] { |
7383 |
new String[] { |
| 6882 |
"X.java", |
7384 |
"X.java", |
|
Lines 6898-6924
Link Here
|
| 6898 |
" }\n" + |
7400 |
" }\n" + |
| 6899 |
"}" |
7401 |
"}" |
| 6900 |
}, |
7402 |
}, |
| 6901 |
"----------\n" + |
7403 |
expectedCompilerLog |
| 6902 |
"1. ERROR in X.java (at line 3)\n" + |
|
|
| 6903 |
" Integer getX(List<Integer> l) {\n" + |
| 6904 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 6905 |
"Method getX(List<Integer>) has the same erasure getX(List<E>) as another method in type X\n" + |
| 6906 |
"----------\n" + |
| 6907 |
"2. ERROR in X.java (at line 6)\n" + |
| 6908 |
" String getX(List<String> l) {\n" + |
| 6909 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 6910 |
"Method getX(List<String>) has the same erasure getX(List<E>) as another method in type X\n" + |
| 6911 |
"----------\n" + |
| 6912 |
"3. ERROR in X.java (at line 11)\n" + |
| 6913 |
" Integer getX(List<Integer> l) {\n" + |
| 6914 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 6915 |
"Duplicate method getX(List<Integer>) in type Y\n" + |
| 6916 |
"----------\n" + |
| 6917 |
"4. ERROR in X.java (at line 14)\n" + |
| 6918 |
" String getX(List<Integer> l) {\n" + |
| 6919 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 6920 |
"Duplicate method getX(List<Integer>) in type Y\n" + |
| 6921 |
"----------\n" |
| 6922 |
); |
7404 |
); |
| 6923 |
} |
7405 |
} |
| 6924 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159973 |
7406 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=159973 |
|
Lines 7971-7976
Link Here
|
| 7971 |
} |
8453 |
} |
| 7972 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830 |
8454 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830 |
| 7973 |
public void test120a() { |
8455 |
public void test120a() { |
|
|
8456 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 8457 |
"----------\n" + |
| 8458 |
"1. WARNING in Bar.java (at line 2)\n" + |
| 8459 |
" int getThing(V v) { return 1; }\n" + |
| 8460 |
" ^^^^^^^^^^^^^\n" + |
| 8461 |
"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
| 8462 |
"----------\n" + |
| 8463 |
"2. WARNING in Bar.java (at line 3)\n" + |
| 8464 |
" boolean getThing(E e) { return true; }\n" + |
| 8465 |
" ^^^^^^^^^^^^^\n" + |
| 8466 |
"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
| 8467 |
"----------\n": |
| 8468 |
"----------\n" + |
| 8469 |
"1. ERROR in Bar.java (at line 2)\n" + |
| 8470 |
" int getThing(V v) { return 1; }\n" + |
| 8471 |
" ^^^^^^^^^^^^^\n" + |
| 8472 |
"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
| 8473 |
"----------\n" + |
| 8474 |
"2. ERROR in Bar.java (at line 3)\n" + |
| 8475 |
" boolean getThing(E e) { return true; }\n" + |
| 8476 |
" ^^^^^^^^^^^^^\n" + |
| 8477 |
"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
| 8478 |
"----------\n"; |
| 7974 |
this.runNegativeTest( |
8479 |
this.runNegativeTest( |
| 7975 |
new String[] { |
8480 |
new String[] { |
| 7976 |
"Bar.java", |
8481 |
"Bar.java", |
|
Lines 7980-7996
Link Here
|
| 7980 |
"}\n" + |
8485 |
"}\n" + |
| 7981 |
"public class Bar<V,E> extends Foo<V,E> {}" |
8486 |
"public class Bar<V,E> extends Foo<V,E> {}" |
| 7982 |
}, |
8487 |
}, |
| 7983 |
"----------\n" + |
8488 |
expectedCompilerLog |
| 7984 |
"1. ERROR in Bar.java (at line 2)\n" + |
|
|
| 7985 |
" int getThing(V v) { return 1; }\n" + |
| 7986 |
" ^^^^^^^^^^^^^\n" + |
| 7987 |
"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
| 7988 |
"----------\n" + |
| 7989 |
"2. ERROR in Bar.java (at line 3)\n" + |
| 7990 |
" boolean getThing(E e) { return true; }\n" + |
| 7991 |
" ^^^^^^^^^^^^^\n" + |
| 7992 |
"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
| 7993 |
"----------\n" |
| 7994 |
); |
8489 |
); |
| 7995 |
} |
8490 |
} |
| 7996 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=173477 |
8491 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=173477 |
|
Lines 9700-9705
Link Here
|
| 9700 |
// JDK7 (7b100) behavior. (earlier we would issue an extra name clash) |
10195 |
// JDK7 (7b100) behavior. (earlier we would issue an extra name clash) |
| 9701 |
public void test177() { |
10196 |
public void test177() { |
| 9702 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_6) { // see test187() |
10197 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_6) { // see test187() |
|
|
10198 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
| 10199 |
"----------\n" + |
| 10200 |
"1. WARNING in X.java (at line 3)\n" + |
| 10201 |
" class A extends LinkedHashMap {\n" + |
| 10202 |
" ^\n" + |
| 10203 |
"The serializable class A does not declare a static final serialVersionUID field of type long\n" + |
| 10204 |
"----------\n" + |
| 10205 |
"2. WARNING in X.java (at line 3)\n" + |
| 10206 |
" class A extends LinkedHashMap {\n" + |
| 10207 |
" ^^^^^^^^^^^^^\n" + |
| 10208 |
"LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized\n" + |
| 10209 |
"----------\n" + |
| 10210 |
"3. WARNING in X.java (at line 4)\n" + |
| 10211 |
" public A foo(Collection c) { return this; }\n" + |
| 10212 |
" ^^^^^^^^^^\n" + |
| 10213 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
| 10214 |
"----------\n" + |
| 10215 |
"4. WARNING in X.java (at line 6)\n" + |
| 10216 |
" class X extends A implements I {\n" + |
| 10217 |
" ^\n" + |
| 10218 |
"The serializable class X does not declare a static final serialVersionUID field of type long\n" + |
| 10219 |
"----------\n" + |
| 10220 |
"5. WARNING in X.java (at line 7)\n" + |
| 10221 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
| 10222 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 10223 |
"Name clash: The method foo(Collection<?>) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + |
| 10224 |
"----------\n": |
| 10225 |
"----------\n" + |
| 10226 |
"1. WARNING in X.java (at line 3)\n" + |
| 10227 |
" class A extends LinkedHashMap {\n" + |
| 10228 |
" ^\n" + |
| 10229 |
"The serializable class A does not declare a static final serialVersionUID field of type long\n" + |
| 10230 |
"----------\n" + |
| 10231 |
"2. WARNING in X.java (at line 3)\n" + |
| 10232 |
" class A extends LinkedHashMap {\n" + |
| 10233 |
" ^^^^^^^^^^^^^\n" + |
| 10234 |
"LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized\n" + |
| 10235 |
"----------\n" + |
| 10236 |
"3. WARNING in X.java (at line 4)\n" + |
| 10237 |
" public A foo(Collection c) { return this; }\n" + |
| 10238 |
" ^^^^^^^^^^\n" + |
| 10239 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
| 10240 |
"----------\n" + |
| 10241 |
"4. WARNING in X.java (at line 6)\n" + |
| 10242 |
" class X extends A implements I {\n" + |
| 10243 |
" ^\n" + |
| 10244 |
"The serializable class X does not declare a static final serialVersionUID field of type long\n" + |
| 10245 |
"----------\n" + |
| 10246 |
"5. ERROR in X.java (at line 7)\n" + |
| 10247 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
| 10248 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 10249 |
"Name clash: The method foo(Collection<?>) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + |
| 10250 |
"----------\n"; |
| 9703 |
this.runNegativeTest( |
10251 |
this.runNegativeTest( |
| 9704 |
new String[] { |
10252 |
new String[] { |
| 9705 |
"X.java", |
10253 |
"X.java", |
|
Lines 9712-9743
Link Here
|
| 9712 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
10260 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
| 9713 |
"}" |
10261 |
"}" |
| 9714 |
}, |
10262 |
}, |
| 9715 |
"----------\n" + |
10263 |
expectedCompilerLog |
| 9716 |
"1. WARNING in X.java (at line 3)\n" + |
|
|
| 9717 |
" class A extends LinkedHashMap {\n" + |
| 9718 |
" ^\n" + |
| 9719 |
"The serializable class A does not declare a static final serialVersionUID field of type long\n" + |
| 9720 |
"----------\n" + |
| 9721 |
"2. WARNING in X.java (at line 3)\n" + |
| 9722 |
" class A extends LinkedHashMap {\n" + |
| 9723 |
" ^^^^^^^^^^^^^\n" + |
| 9724 |
"LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized\n" + |
| 9725 |
"----------\n" + |
| 9726 |
"3. WARNING in X.java (at line 4)\n" + |
| 9727 |
" public A foo(Collection c) { return this; }\n" + |
| 9728 |
" ^^^^^^^^^^\n" + |
| 9729 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
| 9730 |
"----------\n" + |
| 9731 |
"4. WARNING in X.java (at line 6)\n" + |
| 9732 |
" class X extends A implements I {\n" + |
| 9733 |
" ^\n" + |
| 9734 |
"The serializable class X does not declare a static final serialVersionUID field of type long\n" + |
| 9735 |
"----------\n" + |
| 9736 |
"5. ERROR in X.java (at line 7)\n" + |
| 9737 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
| 9738 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 9739 |
"Name clash: The method foo(Collection<?>) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + |
| 9740 |
"----------\n" |
| 9741 |
); |
10264 |
); |
| 9742 |
} else { |
10265 |
} else { |
| 9743 |
this.runNegativeTest( |
10266 |
this.runNegativeTest( |
|
Lines 9777-9783
Link Here
|
| 9777 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
10300 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
| 9778 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
10301 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 9779 |
"Name clash: The method foo(Collection<?>) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + |
10302 |
"Name clash: The method foo(Collection<?>) of type X has the same erasure as foo(Collection) of type A but does not override it\n" + |
| 9780 |
"----------\n" + |
10303 |
"----------\n" + |
| 9781 |
"6. ERROR in X.java (at line 7)\n" + |
10304 |
"6. ERROR in X.java (at line 7)\n" + |
| 9782 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
10305 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
| 9783 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
10306 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
|
Lines 10246-10251
Link Here
|
| 10246 |
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 |
10769 |
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 |
| 10247 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=? |
10770 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=? |
| 10248 |
public void test187() { |
10771 |
public void test187() { |
|
|
10772 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6 )? |
| 10773 |
"----------\n" + |
| 10774 |
"1. WARNING in X.java (at line 6)\n" + |
| 10775 |
" double f(List<Integer> l) {return 0;}\n" + |
| 10776 |
" ^^^^^^^^^^^^^^^^^^\n" + |
| 10777 |
"Name clash: The method f(List<Integer>) of type Y has the same erasure as f(List<String>) of type X but does not override it\n" + |
| 10778 |
"----------\n" + |
| 10779 |
"2. WARNING in X.java (at line 13)\n" + |
| 10780 |
" int f(List<String> l) {return 0;}\n" + |
| 10781 |
" ^^^^^^^^^^^^^^^^^\n" + |
| 10782 |
"Method f(List<String>) has the same erasure f(List<E>) as another method in type XX\n" + |
| 10783 |
"----------\n" + |
| 10784 |
"3. WARNING in X.java (at line 14)\n" + |
| 10785 |
" double f(List<Integer> l) {return 0;}\n" + |
| 10786 |
" ^^^^^^^^^^^^^^^^^^\n" + |
| 10787 |
"Method f(List<Integer>) has the same erasure f(List<E>) as another method in type XX\n" + |
| 10788 |
"----------\n": |
| 10789 |
"----------\n" + |
| 10790 |
"1. ERROR in X.java (at line 6)\n" + |
| 10791 |
" double f(List<Integer> l) {return 0;}\n" + |
| 10792 |
" ^^^^^^^^^^^^^^^^^^\n" + |
| 10793 |
"Name clash: The method f(List<Integer>) of type Y has the same erasure as f(List<String>) of type X but does not override it\n" + |
| 10794 |
"----------\n" + |
| 10795 |
"2. ERROR in X.java (at line 13)\n" + |
| 10796 |
" int f(List<String> l) {return 0;}\n" + |
| 10797 |
" ^^^^^^^^^^^^^^^^^\n" + |
| 10798 |
"Method f(List<String>) has the same erasure f(List<E>) as another method in type XX\n" + |
| 10799 |
"----------\n" + |
| 10800 |
"3. ERROR in X.java (at line 14)\n" + |
| 10801 |
" double f(List<Integer> l) {return 0;}\n" + |
| 10802 |
" ^^^^^^^^^^^^^^^^^^\n" + |
| 10803 |
"Method f(List<Integer>) has the same erasure f(List<E>) as another method in type XX\n" + |
| 10804 |
"----------\n"; |
| 10249 |
this.runNegativeTest( |
10805 |
this.runNegativeTest( |
| 10250 |
new String[] { |
10806 |
new String[] { |
| 10251 |
"X.java", |
10807 |
"X.java", |
|
Lines 10265-10286
Link Here
|
| 10265 |
"double f(List<Integer> l) {return 0;}\n" +// name clash in 1.5 & 7 |
10821 |
"double f(List<Integer> l) {return 0;}\n" +// name clash in 1.5 & 7 |
| 10266 |
"}" |
10822 |
"}" |
| 10267 |
}, |
10823 |
}, |
| 10268 |
"----------\n" + |
10824 |
expectedCompilerLog |
| 10269 |
"1. ERROR in X.java (at line 6)\n" + |
|
|
| 10270 |
" double f(List<Integer> l) {return 0;}\n" + |
| 10271 |
" ^^^^^^^^^^^^^^^^^^\n" + |
| 10272 |
"Name clash: The method f(List<Integer>) of type Y has the same erasure as f(List<String>) of type X but does not override it\n" + |
| 10273 |
"----------\n" + |
| 10274 |
"2. ERROR in X.java (at line 13)\n" + |
| 10275 |
" int f(List<String> l) {return 0;}\n" + |
| 10276 |
" ^^^^^^^^^^^^^^^^^\n" + |
| 10277 |
"Method f(List<String>) has the same erasure f(List<E>) as another method in type XX\n" + |
| 10278 |
"----------\n" + |
| 10279 |
"3. ERROR in X.java (at line 14)\n" + |
| 10280 |
" double f(List<Integer> l) {return 0;}\n" + |
| 10281 |
" ^^^^^^^^^^^^^^^^^^\n" + |
| 10282 |
"Method f(List<Integer>) has the same erasure f(List<E>) as another method in type XX\n" + |
| 10283 |
"----------\n" |
| 10284 |
); |
10825 |
); |
| 10285 |
} |
10826 |
} |
| 10286 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=279836 |
10827 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=279836 |
|
Lines 10702-10707
Link Here
|
| 10702 |
} |
11243 |
} |
| 10703 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088 |
11244 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088 |
| 10704 |
public void test200() { |
11245 |
public void test200() { |
|
|
11246 |
Map options = getCompilerOptions(); |
| 11247 |
String compliance = (String) options.get(JavaCore.COMPILER_COMPLIANCE); |
| 11248 |
String errorMessage = compliance == JavaCore.VERSION_1_6 ? |
| 11249 |
"----------\n" + |
| 11250 |
"1. WARNING in X.java (at line 3)\n" + |
| 11251 |
" int foo(Collection bar) { return 0; }\n" + |
| 11252 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
| 11253 |
"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + |
| 11254 |
"----------\n" + |
| 11255 |
"2. WARNING in X.java (at line 3)\n" + |
| 11256 |
" int foo(Collection bar) { return 0; }\n" + |
| 11257 |
" ^^^^^^^^^^\n" + |
| 11258 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
| 11259 |
"----------\n" + |
| 11260 |
"3. WARNING in X.java (at line 4)\n" + |
| 11261 |
" double foo(Collection<String> bar) {return 0; }\n" + |
| 11262 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 11263 |
"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + |
| 11264 |
"----------\n" : |
| 11265 |
"----------\n" + |
| 11266 |
"1. ERROR in X.java (at line 3)\n" + |
| 11267 |
" int foo(Collection bar) { return 0; }\n" + |
| 11268 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
| 11269 |
"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + |
| 11270 |
"----------\n" + |
| 11271 |
"2. WARNING in X.java (at line 3)\n" + |
| 11272 |
" int foo(Collection bar) { return 0; }\n" + |
| 11273 |
" ^^^^^^^^^^\n" + |
| 11274 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
| 11275 |
"----------\n" + |
| 11276 |
"3. ERROR in X.java (at line 4)\n" + |
| 11277 |
" double foo(Collection<String> bar) {return 0; }\n" + |
| 11278 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 11279 |
"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + |
| 11280 |
"----------\n"; |
| 10705 |
this.runNegativeTest( |
11281 |
this.runNegativeTest( |
| 10706 |
new String[] { |
11282 |
new String[] { |
| 10707 |
"X.java", |
11283 |
"X.java", |
|
Lines 10711-10732
Link Here
|
| 10711 |
" double foo(Collection<String> bar) {return 0; }\n" + |
11287 |
" double foo(Collection<String> bar) {return 0; }\n" + |
| 10712 |
"}" |
11288 |
"}" |
| 10713 |
}, |
11289 |
}, |
| 10714 |
"----------\n" + |
11290 |
errorMessage |
| 10715 |
"1. ERROR in X.java (at line 3)\n" + |
|
|
| 10716 |
" int foo(Collection bar) { return 0; }\n" + |
| 10717 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
| 10718 |
"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + |
| 10719 |
"----------\n" + |
| 10720 |
"2. WARNING in X.java (at line 3)\n" + |
| 10721 |
" int foo(Collection bar) { return 0; }\n" + |
| 10722 |
" ^^^^^^^^^^\n" + |
| 10723 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
| 10724 |
"----------\n" + |
| 10725 |
"3. ERROR in X.java (at line 4)\n" + |
| 10726 |
" double foo(Collection<String> bar) {return 0; }\n" + |
| 10727 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 10728 |
"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + |
| 10729 |
"----------\n" |
| 10730 |
); |
11291 |
); |
| 10731 |
/* javac 7 |
11292 |
/* javac 7 |
| 10732 |
X.java:4: foo(Collection) is already defined in X |
11293 |
X.java:4: foo(Collection) is already defined in X |
|
Lines 12342-12357
Link Here
|
| 12342 |
"}\n" + |
12903 |
"}\n" + |
| 12343 |
"interface C extends A, B { \n" + |
12904 |
"interface C extends A, B { \n" + |
| 12344 |
"int get(List l); // name clash error here\n" + |
12905 |
"int get(List l); // name clash error here\n" + |
| 12345 |
"}\n" + |
12906 |
"}\n" + |
| 12346 |
"public class X {\n" + |
12907 |
"public class X {\n" + |
| 12347 |
" public static void main(String [] args) {\n" + |
12908 |
" public static void main(String [] args) {\n" + |
| 12348 |
" System.out.println(\"Built OK\");\n" + |
12909 |
" System.out.println(\"Built OK\");\n" + |
| 12349 |
" }\n" + |
12910 |
" }\n" + |
| 12350 |
"}" |
12911 |
"}" |
| 12351 |
}, |
12912 |
}, |
| 12352 |
"Built OK"); |
12913 |
"Built OK"); |
| 12353 |
} |
12914 |
} |
| 12354 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=353089 |
12915 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=353089 |
| 12355 |
public void test353089b() throws Exception { |
12916 |
public void test353089b() throws Exception { |
| 12356 |
this.runNegativeTest( |
12917 |
this.runNegativeTest( |
| 12357 |
new String[] { |
12918 |
new String[] { |
|
Lines 12411-12417
Link Here
|
| 12411 |
"Zork cannot be resolved to a type\n" + |
12972 |
"Zork cannot be resolved to a type\n" + |
| 12412 |
"----------\n"); |
12973 |
"----------\n"); |
| 12413 |
} |
12974 |
} |
| 12414 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=353089 |
12975 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=353089 |
| 12415 |
public void test353089c() throws Exception { |
12976 |
public void test353089c() throws Exception { |
| 12416 |
this.runNegativeTest( |
12977 |
this.runNegativeTest( |
| 12417 |
new String[] { |
12978 |
new String[] { |
|
Lines 12436-12439
Link Here
|
| 12436 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
12997 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
| 12437 |
"----------\n"); |
12998 |
"----------\n"); |
| 12438 |
} |
12999 |
} |
|
|
13000 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719 |
| 13001 |
public void testBug317719() throws Exception { |
| 13002 |
String output = this.complianceLevel == ClassFileConstants.JDK1_6 ? |
| 13003 |
"----------\n" + |
| 13004 |
"1. WARNING in X.java (at line 4)\n" + |
| 13005 |
" public <T extends List> T foo() { return null; }\n" + |
| 13006 |
" ^^^^\n" + |
| 13007 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
| 13008 |
"----------\n" + |
| 13009 |
"2. WARNING in X.java (at line 4)\n" + |
| 13010 |
" public <T extends List> T foo() { return null; }\n" + |
| 13011 |
" ^^^^^\n" + |
| 13012 |
"Duplicate method foo() in type X\n" + |
| 13013 |
"----------\n" + |
| 13014 |
"3. WARNING in X.java (at line 5)\n" + |
| 13015 |
" public <T extends Set> T foo() { return null; }\n" + |
| 13016 |
" ^^^\n" + |
| 13017 |
"Set is a raw type. References to generic type Set<E> should be parameterized\n" + |
| 13018 |
"----------\n" + |
| 13019 |
"4. WARNING in X.java (at line 5)\n" + |
| 13020 |
" public <T extends Set> T foo() { return null; }\n" + |
| 13021 |
" ^^^^^\n" + |
| 13022 |
"Duplicate method foo() in type X\n" + |
| 13023 |
"----------\n" + |
| 13024 |
"5. ERROR in X.java (at line 6)\n" + |
| 13025 |
" Zork z;\n" + |
| 13026 |
" ^^^^\n" + |
| 13027 |
"Zork cannot be resolved to a type\n" + |
| 13028 |
"----------\n": |
| 13029 |
"----------\n" + |
| 13030 |
"1. WARNING in X.java (at line 4)\n" + |
| 13031 |
" public <T extends List> T foo() { return null; }\n" + |
| 13032 |
" ^^^^\n" + |
| 13033 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
| 13034 |
"----------\n" + |
| 13035 |
"2. ERROR in X.java (at line 4)\n" + |
| 13036 |
" public <T extends List> T foo() { return null; }\n" + |
| 13037 |
" ^^^^^\n" + |
| 13038 |
"Duplicate method foo() in type X\n" + |
| 13039 |
"----------\n" + |
| 13040 |
"3. WARNING in X.java (at line 5)\n" + |
| 13041 |
" public <T extends Set> T foo() { return null; }\n" + |
| 13042 |
" ^^^\n" + |
| 13043 |
"Set is a raw type. References to generic type Set<E> should be parameterized\n" + |
| 13044 |
"----------\n" + |
| 13045 |
"4. ERROR in X.java (at line 5)\n" + |
| 13046 |
" public <T extends Set> T foo() { return null; }\n" + |
| 13047 |
" ^^^^^\n" + |
| 13048 |
"Duplicate method foo() in type X\n" + |
| 13049 |
"----------\n" + |
| 13050 |
"5. ERROR in X.java (at line 6)\n" + |
| 13051 |
" Zork z;\n" + |
| 13052 |
" ^^^^\n" + |
| 13053 |
"Zork cannot be resolved to a type\n" + |
| 13054 |
"----------\n"; |
| 13055 |
this.runNegativeTest( |
| 13056 |
new String[] { |
| 13057 |
"X.java", |
| 13058 |
"import java.util.List;\n" + |
| 13059 |
"import java.util.Set;\n" + |
| 13060 |
"class X {\n" + |
| 13061 |
" public <T extends List> T foo() { return null; }\n" + |
| 13062 |
" public <T extends Set> T foo() { return null; }\n" + |
| 13063 |
" Zork z;\n" + |
| 13064 |
"}\n" |
| 13065 |
}, |
| 13066 |
output); |
| 13067 |
} |
| 13068 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719 |
| 13069 |
public void testBug317719a() throws Exception { |
| 13070 |
String output = this.complianceLevel == ClassFileConstants.JDK1_6 ? |
| 13071 |
"----------\n" + |
| 13072 |
"1. WARNING in X.java (at line 4)\n" + |
| 13073 |
" public Integer same(List<Integer> a) { return null; }\n" + |
| 13074 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13075 |
"Method same(List<Integer>) has the same erasure same(List<E>) as another method in type X\n" + |
| 13076 |
"----------\n" + |
| 13077 |
"2. WARNING in X.java (at line 5)\n" + |
| 13078 |
" public String same(List<String> b) { return null; }\n" + |
| 13079 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 13080 |
"Method same(List<String>) has the same erasure same(List<E>) as another method in type X\n" + |
| 13081 |
"----------\n" + |
| 13082 |
"3. ERROR in X.java (at line 6)\n" + |
| 13083 |
" Zork z;\n" + |
| 13084 |
" ^^^^\n" + |
| 13085 |
"Zork cannot be resolved to a type\n" + |
| 13086 |
"----------\n": |
| 13087 |
"----------\n" + |
| 13088 |
"1. ERROR in X.java (at line 4)\n" + |
| 13089 |
" public Integer same(List<Integer> a) { return null; }\n" + |
| 13090 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13091 |
"Method same(List<Integer>) has the same erasure same(List<E>) as another method in type X\n" + |
| 13092 |
"----------\n" + |
| 13093 |
"2. ERROR in X.java (at line 5)\n" + |
| 13094 |
" public String same(List<String> b) { return null; }\n" + |
| 13095 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 13096 |
"Method same(List<String>) has the same erasure same(List<E>) as another method in type X\n" + |
| 13097 |
"----------\n" + |
| 13098 |
"3. ERROR in X.java (at line 6)\n" + |
| 13099 |
" Zork z;\n" + |
| 13100 |
" ^^^^\n" + |
| 13101 |
"Zork cannot be resolved to a type\n" + |
| 13102 |
"----------\n"; |
| 13103 |
this.runNegativeTest( |
| 13104 |
new String[] { |
| 13105 |
"X.java", |
| 13106 |
"import java.util.List;\n" + |
| 13107 |
"import java.util.Set;\n" + |
| 13108 |
"class X {\n" + |
| 13109 |
" public Integer same(List<Integer> a) { return null; }\n" + |
| 13110 |
" public String same(List<String> b) { return null; }\n" + |
| 13111 |
" Zork z;\n" + |
| 13112 |
"}\n" |
| 13113 |
}, |
| 13114 |
output); |
| 13115 |
} |
| 13116 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719 |
| 13117 |
public void testBug317719b() throws Exception { |
| 13118 |
String output = this.complianceLevel == ClassFileConstants.JDK1_6 ? |
| 13119 |
"----------\n" + |
| 13120 |
"1. WARNING in X.java (at line 3)\n" + |
| 13121 |
" public static String doIt(final List<String> arg) { return null; }\n" + |
| 13122 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13123 |
"Method doIt(List<String>) has the same erasure doIt(List<E>) as another method in type X\n" + |
| 13124 |
"----------\n" + |
| 13125 |
"2. WARNING in X.java (at line 4)\n" + |
| 13126 |
" public static CharSequence doIt(final List<CharSequence> arg) { return null; }\n" + |
| 13127 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13128 |
"Method doIt(List<CharSequence>) has the same erasure doIt(List<E>) as another method in type X\n" + |
| 13129 |
"----------\n" + |
| 13130 |
"3. ERROR in X.java (at line 5)\n" + |
| 13131 |
" Zork z;\n" + |
| 13132 |
" ^^^^\n" + |
| 13133 |
"Zork cannot be resolved to a type\n" + |
| 13134 |
"----------\n": |
| 13135 |
"----------\n" + |
| 13136 |
"1. ERROR in X.java (at line 3)\n" + |
| 13137 |
" public static String doIt(final List<String> arg) { return null; }\n" + |
| 13138 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13139 |
"Method doIt(List<String>) has the same erasure doIt(List<E>) as another method in type X\n" + |
| 13140 |
"----------\n" + |
| 13141 |
"2. ERROR in X.java (at line 4)\n" + |
| 13142 |
" public static CharSequence doIt(final List<CharSequence> arg) { return null; }\n" + |
| 13143 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13144 |
"Method doIt(List<CharSequence>) has the same erasure doIt(List<E>) as another method in type X\n" + |
| 13145 |
"----------\n" + |
| 13146 |
"3. ERROR in X.java (at line 5)\n" + |
| 13147 |
" Zork z;\n" + |
| 13148 |
" ^^^^\n" + |
| 13149 |
"Zork cannot be resolved to a type\n" + |
| 13150 |
"----------\n"; |
| 13151 |
this.runNegativeTest( |
| 13152 |
new String[] { |
| 13153 |
"X.java", |
| 13154 |
"import java.util.List;\n" + |
| 13155 |
"class X {\n" + |
| 13156 |
" public static String doIt(final List<String> arg) { return null; }\n" + |
| 13157 |
" public static CharSequence doIt(final List<CharSequence> arg) { return null; }\n" + |
| 13158 |
" Zork z;\n" + |
| 13159 |
"}\n" |
| 13160 |
}, |
| 13161 |
output); |
| 13162 |
} |
| 13163 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719 |
| 13164 |
public void testBug317719c() throws Exception { |
| 13165 |
String output = this.complianceLevel == ClassFileConstants.JDK1_6 ? |
| 13166 |
"----------\n" + |
| 13167 |
"1. WARNING in X.java (at line 3)\n" + |
| 13168 |
" protected static <T extends String> T same(Collection<? extends T> p_col) { return null; }\n" + |
| 13169 |
" ^^^^^^\n" + |
| 13170 |
"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + |
| 13171 |
"----------\n" + |
| 13172 |
"2. WARNING in X.java (at line 3)\n" + |
| 13173 |
" protected static <T extends String> T same(Collection<? extends T> p_col) { return null; }\n" + |
| 13174 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13175 |
"Method same(Collection<? extends T>) has the same erasure same(Collection<E>) as another method in type X\n" + |
| 13176 |
"----------\n" + |
| 13177 |
"3. WARNING in X.java (at line 4)\n" + |
| 13178 |
" protected static <T extends Number> T same(Collection<? extends T> p_col) { return null; }\n" + |
| 13179 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13180 |
"Method same(Collection<? extends T>) has the same erasure same(Collection<E>) as another method in type X\n" + |
| 13181 |
"----------\n" + |
| 13182 |
"4. ERROR in X.java (at line 5)\n" + |
| 13183 |
" Zork z;\n" + |
| 13184 |
" ^^^^\n" + |
| 13185 |
"Zork cannot be resolved to a type\n" + |
| 13186 |
"----------\n": |
| 13187 |
"----------\n" + |
| 13188 |
"1. WARNING in X.java (at line 3)\n" + |
| 13189 |
" protected static <T extends String> T same(Collection<? extends T> p_col) { return null; }\n" + |
| 13190 |
" ^^^^^^\n" + |
| 13191 |
"The type parameter T should not be bounded by the final type String. Final types cannot be further extended\n" + |
| 13192 |
"----------\n" + |
| 13193 |
"2. ERROR in X.java (at line 3)\n" + |
| 13194 |
" protected static <T extends String> T same(Collection<? extends T> p_col) { return null; }\n" + |
| 13195 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13196 |
"Method same(Collection<? extends T>) has the same erasure same(Collection<E>) as another method in type X\n" + |
| 13197 |
"----------\n" + |
| 13198 |
"3. ERROR in X.java (at line 4)\n" + |
| 13199 |
" protected static <T extends Number> T same(Collection<? extends T> p_col) { return null; }\n" + |
| 13200 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13201 |
"Method same(Collection<? extends T>) has the same erasure same(Collection<E>) as another method in type X\n" + |
| 13202 |
"----------\n" + |
| 13203 |
"4. ERROR in X.java (at line 5)\n" + |
| 13204 |
" Zork z;\n" + |
| 13205 |
" ^^^^\n" + |
| 13206 |
"Zork cannot be resolved to a type\n" + |
| 13207 |
"----------\n"; |
| 13208 |
this.runNegativeTest( |
| 13209 |
new String[] { |
| 13210 |
"X.java", |
| 13211 |
"import java.util.Collection;\n" + |
| 13212 |
"class X {\n" + |
| 13213 |
" protected static <T extends String> T same(Collection<? extends T> p_col) { return null; }\n" + |
| 13214 |
" protected static <T extends Number> T same(Collection<? extends T> p_col) { return null; }\n" + |
| 13215 |
" Zork z;\n" + |
| 13216 |
"}\n" |
| 13217 |
}, |
| 13218 |
output); |
| 13219 |
} |
| 13220 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719 |
| 13221 |
public void testBug317719d() throws Exception { |
| 13222 |
String output = this.complianceLevel == ClassFileConstants.JDK1_6 ? |
| 13223 |
"----------\n" + |
| 13224 |
"1. WARNING in X.java (at line 3)\n" + |
| 13225 |
" public static boolean foo(List<String> x) { return true; }\n" + |
| 13226 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
| 13227 |
"Method foo(List<String>) has the same erasure foo(List<E>) as another method in type X\n" + |
| 13228 |
"----------\n" + |
| 13229 |
"2. WARNING in X.java (at line 4)\n" + |
| 13230 |
" public static int foo(List<Integer> x) { return 2; }\n" + |
| 13231 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 13232 |
"Method foo(List<Integer>) has the same erasure foo(List<E>) as another method in type X\n" + |
| 13233 |
"----------\n" + |
| 13234 |
"3. ERROR in X.java (at line 5)\n" + |
| 13235 |
" Zork z;\n" + |
| 13236 |
" ^^^^\n" + |
| 13237 |
"Zork cannot be resolved to a type\n" + |
| 13238 |
"----------\n": |
| 13239 |
"----------\n" + |
| 13240 |
"1. ERROR in X.java (at line 3)\n" + |
| 13241 |
" public static boolean foo(List<String> x) { return true; }\n" + |
| 13242 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
| 13243 |
"Method foo(List<String>) has the same erasure foo(List<E>) as another method in type X\n" + |
| 13244 |
"----------\n" + |
| 13245 |
"2. ERROR in X.java (at line 4)\n" + |
| 13246 |
" public static int foo(List<Integer> x) { return 2; }\n" + |
| 13247 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
| 13248 |
"Method foo(List<Integer>) has the same erasure foo(List<E>) as another method in type X\n" + |
| 13249 |
"----------\n" + |
| 13250 |
"3. ERROR in X.java (at line 5)\n" + |
| 13251 |
" Zork z;\n" + |
| 13252 |
" ^^^^\n" + |
| 13253 |
"Zork cannot be resolved to a type\n" + |
| 13254 |
"----------\n"; |
| 13255 |
this.runNegativeTest( |
| 13256 |
new String[] { |
| 13257 |
"X.java", |
| 13258 |
"import java.util.List;\n" + |
| 13259 |
"class X {\n" + |
| 13260 |
" public static boolean foo(List<String> x) { return true; }\n" + |
| 13261 |
" public static int foo(List<Integer> x) { return 2; }\n" + |
| 13262 |
" Zork z;\n" + |
| 13263 |
"}\n" |
| 13264 |
}, |
| 13265 |
output); |
| 13266 |
} |
| 13267 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719 |
| 13268 |
public void testBug317719e() throws Exception { |
| 13269 |
String output = this.complianceLevel == ClassFileConstants.JDK1_6 ? |
| 13270 |
"----------\n" + |
| 13271 |
"1. WARNING in X.java (at line 3)\n" + |
| 13272 |
" public String getFirst (ArrayList<String> ss) { return ss.get(0); }\n" + |
| 13273 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13274 |
"Method getFirst(ArrayList<String>) has the same erasure getFirst(ArrayList<E>) as another method in type X\n" + |
| 13275 |
"----------\n" + |
| 13276 |
"2. WARNING in X.java (at line 4)\n" + |
| 13277 |
" public Integer getFirst (ArrayList<Integer> ss) { return ss.get(0); }\n" + |
| 13278 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13279 |
"Method getFirst(ArrayList<Integer>) has the same erasure getFirst(ArrayList<E>) as another method in type X\n" + |
| 13280 |
"----------\n" + |
| 13281 |
"3. ERROR in X.java (at line 5)\n" + |
| 13282 |
" Zork z;\n" + |
| 13283 |
" ^^^^\n" + |
| 13284 |
"Zork cannot be resolved to a type\n" + |
| 13285 |
"----------\n": |
| 13286 |
"----------\n" + |
| 13287 |
"1. ERROR in X.java (at line 3)\n" + |
| 13288 |
" public String getFirst (ArrayList<String> ss) { return ss.get(0); }\n" + |
| 13289 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13290 |
"Method getFirst(ArrayList<String>) has the same erasure getFirst(ArrayList<E>) as another method in type X\n" + |
| 13291 |
"----------\n" + |
| 13292 |
"2. ERROR in X.java (at line 4)\n" + |
| 13293 |
" public Integer getFirst (ArrayList<Integer> ss) { return ss.get(0); }\n" + |
| 13294 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13295 |
"Method getFirst(ArrayList<Integer>) has the same erasure getFirst(ArrayList<E>) as another method in type X\n" + |
| 13296 |
"----------\n" + |
| 13297 |
"3. ERROR in X.java (at line 5)\n" + |
| 13298 |
" Zork z;\n" + |
| 13299 |
" ^^^^\n" + |
| 13300 |
"Zork cannot be resolved to a type\n" + |
| 13301 |
"----------\n"; |
| 13302 |
this.runNegativeTest( |
| 13303 |
new String[] { |
| 13304 |
"X.java", |
| 13305 |
"import java.util.ArrayList;\n" + |
| 13306 |
"class X {\n" + |
| 13307 |
" public String getFirst (ArrayList<String> ss) { return ss.get(0); }\n" + |
| 13308 |
" public Integer getFirst (ArrayList<Integer> ss) { return ss.get(0); }\n" + |
| 13309 |
" Zork z;\n" + |
| 13310 |
"}\n" |
| 13311 |
}, |
| 13312 |
output); |
| 13313 |
} |
| 13314 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719 |
| 13315 |
public void testBug317719f() throws Exception { |
| 13316 |
String output = this.complianceLevel == ClassFileConstants.JDK1_6 ? |
| 13317 |
"----------\n" + |
| 13318 |
"1. WARNING in X.java (at line 3)\n" + |
| 13319 |
" public static <R extends Object> X<R> forAccountSet(List list) { return null; }\n" + |
| 13320 |
" ^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13321 |
"Method forAccountSet(List) has the same erasure forAccountSet(List<E>) as another method in type X<Z>\n" + |
| 13322 |
"----------\n" + |
| 13323 |
"2. WARNING in X.java (at line 3)\n" + |
| 13324 |
" public static <R extends Object> X<R> forAccountSet(List list) { return null; }\n" + |
| 13325 |
" ^^^^\n" + |
| 13326 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
| 13327 |
"----------\n" + |
| 13328 |
"3. WARNING in X.java (at line 4)\n" + |
| 13329 |
" public static <R extends Object> ChildX<R> forAccountSet(List<R> list) { return null; }\n" + |
| 13330 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13331 |
"Method forAccountSet(List<R>) has the same erasure forAccountSet(List<E>) as another method in type X<Z>\n" + |
| 13332 |
"----------\n" + |
| 13333 |
"4. ERROR in X.java (at line 5)\n" + |
| 13334 |
" Zork z;\n" + |
| 13335 |
" ^^^^\n" + |
| 13336 |
"Zork cannot be resolved to a type\n" + |
| 13337 |
"----------\n": |
| 13338 |
"----------\n" + |
| 13339 |
"1. ERROR in X.java (at line 3)\n" + |
| 13340 |
" public static <R extends Object> X<R> forAccountSet(List list) { return null; }\n" + |
| 13341 |
" ^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13342 |
"Method forAccountSet(List) has the same erasure forAccountSet(List<E>) as another method in type X<Z>\n" + |
| 13343 |
"----------\n" + |
| 13344 |
"2. WARNING in X.java (at line 3)\n" + |
| 13345 |
" public static <R extends Object> X<R> forAccountSet(List list) { return null; }\n" + |
| 13346 |
" ^^^^\n" + |
| 13347 |
"List is a raw type. References to generic type List<E> should be parameterized\n" + |
| 13348 |
"----------\n" + |
| 13349 |
"3. ERROR in X.java (at line 4)\n" + |
| 13350 |
" public static <R extends Object> ChildX<R> forAccountSet(List<R> list) { return null; }\n" + |
| 13351 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13352 |
"Method forAccountSet(List<R>) has the same erasure forAccountSet(List<E>) as another method in type X<Z>\n" + |
| 13353 |
"----------\n" + |
| 13354 |
"4. ERROR in X.java (at line 5)\n" + |
| 13355 |
" Zork z;\n" + |
| 13356 |
" ^^^^\n" + |
| 13357 |
"Zork cannot be resolved to a type\n" + |
| 13358 |
"----------\n"; |
| 13359 |
this.runNegativeTest( |
| 13360 |
new String[] { |
| 13361 |
"X.java", |
| 13362 |
"import java.util.List;\n" + |
| 13363 |
"class X<Z> {\n" + |
| 13364 |
" public static <R extends Object> X<R> forAccountSet(List list) { return null; }\n" + |
| 13365 |
" public static <R extends Object> ChildX<R> forAccountSet(List<R> list) { return null; }\n" + |
| 13366 |
" Zork z;\n" + |
| 13367 |
"}\n" + |
| 13368 |
"class ChildX<Z> extends X<Z>{}\n" |
| 13369 |
}, |
| 13370 |
output); |
| 13371 |
} |
| 13372 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719 |
| 13373 |
public void testBug317719g() throws Exception { |
| 13374 |
String output = this.complianceLevel == ClassFileConstants.JDK1_6 ? |
| 13375 |
"----------\n" + |
| 13376 |
"1. WARNING in X.java (at line 3)\n" + |
| 13377 |
" public static int[] doIt(Collection<int[]> col) { return new int[1]; }\n" + |
| 13378 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13379 |
"Method doIt(Collection<int[]>) has the same erasure doIt(Collection<E>) as another method in type X<Z>\n" + |
| 13380 |
"----------\n" + |
| 13381 |
"2. WARNING in X.java (at line 4)\n" + |
| 13382 |
" public static int[][] doIt(Collection<int[][]> col) { return new int[0][0]; }\n" + |
| 13383 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13384 |
"Method doIt(Collection<int[][]>) has the same erasure doIt(Collection<E>) as another method in type X<Z>\n" + |
| 13385 |
"----------\n" + |
| 13386 |
"3. WARNING in X.java (at line 5)\n" + |
| 13387 |
" public int[] doIt2(Collection<int[]> col) { return new int[0]; }\n" + |
| 13388 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13389 |
"Method doIt2(Collection<int[]>) has the same erasure doIt2(Collection<E>) as another method in type X<Z>\n" + |
| 13390 |
"----------\n" + |
| 13391 |
"4. WARNING in X.java (at line 6)\n" + |
| 13392 |
" public int[][] doIt2(Collection<int[][]> col) { return new int[0][0]; }\n" + |
| 13393 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13394 |
"Method doIt2(Collection<int[][]>) has the same erasure doIt2(Collection<E>) as another method in type X<Z>\n" + |
| 13395 |
"----------\n" + |
| 13396 |
"5. ERROR in X.java (at line 7)\n" + |
| 13397 |
" Zork z;\n" + |
| 13398 |
" ^^^^\n" + |
| 13399 |
"Zork cannot be resolved to a type\n" + |
| 13400 |
"----------\n": |
| 13401 |
"----------\n" + |
| 13402 |
"1. ERROR in X.java (at line 3)\n" + |
| 13403 |
" public static int[] doIt(Collection<int[]> col) { return new int[1]; }\n" + |
| 13404 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13405 |
"Method doIt(Collection<int[]>) has the same erasure doIt(Collection<E>) as another method in type X<Z>\n" + |
| 13406 |
"----------\n" + |
| 13407 |
"2. ERROR in X.java (at line 4)\n" + |
| 13408 |
" public static int[][] doIt(Collection<int[][]> col) { return new int[0][0]; }\n" + |
| 13409 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13410 |
"Method doIt(Collection<int[][]>) has the same erasure doIt(Collection<E>) as another method in type X<Z>\n" + |
| 13411 |
"----------\n" + |
| 13412 |
"3. ERROR in X.java (at line 5)\n" + |
| 13413 |
" public int[] doIt2(Collection<int[]> col) { return new int[0]; }\n" + |
| 13414 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13415 |
"Method doIt2(Collection<int[]>) has the same erasure doIt2(Collection<E>) as another method in type X<Z>\n" + |
| 13416 |
"----------\n" + |
| 13417 |
"4. ERROR in X.java (at line 6)\n" + |
| 13418 |
" public int[][] doIt2(Collection<int[][]> col) { return new int[0][0]; }\n" + |
| 13419 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
| 13420 |
"Method doIt2(Collection<int[][]>) has the same erasure doIt2(Collection<E>) as another method in type X<Z>\n" + |
| 13421 |
"----------\n" + |
| 13422 |
"5. ERROR in X.java (at line 7)\n" + |
| 13423 |
" Zork z;\n" + |
| 13424 |
" ^^^^\n" + |
| 13425 |
"Zork cannot be resolved to a type\n" + |
| 13426 |
"----------\n"; |
| 13427 |
this.runNegativeTest( |
| 13428 |
new String[] { |
| 13429 |
"X.java", |
| 13430 |
"import java.util.Collection;\n" + |
| 13431 |
"class X<Z> {\n" + |
| 13432 |
" public static int[] doIt(Collection<int[]> col) { return new int[1]; }\n" + |
| 13433 |
" public static int[][] doIt(Collection<int[][]> col) { return new int[0][0]; }\n" + |
| 13434 |
" public int[] doIt2(Collection<int[]> col) { return new int[0]; }\n" + |
| 13435 |
" public int[][] doIt2(Collection<int[][]> col) { return new int[0][0]; }\n" + |
| 13436 |
" Zork z;\n" + |
| 13437 |
"}\n" + |
| 13438 |
"class ChildX<Z> extends X<Z>{}\n" |
| 13439 |
}, |
| 13440 |
output); |
| 13441 |
} |
| 13442 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=317719 |
| 13443 |
public void testBug317719h() throws Exception { |
| 13444 |
String output = this.complianceLevel == ClassFileConstants.JDK1_6 ? |
| 13445 |
"----------\n" + |
| 13446 |
"1. WARNING in Test.java (at line 3)\n" + |
| 13447 |
" public class Test<Key, Value> extends LinkedHashMap<Key, Collection<Value>> {\n" + |
| 13448 |
" ^^^^\n" + |
| 13449 |
"The serializable class Test does not declare a static final serialVersionUID field of type long\n" + |
| 13450 |
"----------\n" + |
| 13451 |
"2. WARNING in Test.java (at line 4)\n" + |
| 13452 |
" public Collection<Value> put(Key k, Value v) { return null; }\n" + |
| 13453 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
| 13454 |
"Name clash: The method put(Key, Value) of type Test<Key,Value> has the same erasure as put(K, V) of type HashMap<K,V> but does not override it\n" + |
| 13455 |
"----------\n" + |
| 13456 |
"3. WARNING in Test.java (at line 5)\n" + |
| 13457 |
" public Collection<Value> get(Key k) { return null; }\n" + |
| 13458 |
" ^^^^^^^^^^\n" + |
| 13459 |
"Name clash: The method get(Key) of type Test<Key,Value> has the same erasure as get(Object) of type LinkedHashMap<K,V> but does not override it\n" + |
| 13460 |
"----------\n" + |
| 13461 |
"4. ERROR in Test.java (at line 6)\n" + |
| 13462 |
" Zork z;\n" + |
| 13463 |
" ^^^^\n" + |
| 13464 |
"Zork cannot be resolved to a type\n" + |
| 13465 |
"----------\n": |
| 13466 |
"----------\n" + |
| 13467 |
"1. WARNING in Test.java (at line 3)\n" + |
| 13468 |
" public class Test<Key, Value> extends LinkedHashMap<Key, Collection<Value>> {\n" + |
| 13469 |
" ^^^^\n" + |
| 13470 |
"The serializable class Test does not declare a static final serialVersionUID field of type long\n" + |
| 13471 |
"----------\n" + |
| 13472 |
"2. ERROR in Test.java (at line 4)\n" + |
| 13473 |
" public Collection<Value> put(Key k, Value v) { return null; }\n" + |
| 13474 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
| 13475 |
"Name clash: The method put(Key, Value) of type Test<Key,Value> has the same erasure as put(K, V) of type HashMap<K,V> but does not override it\n" + |
| 13476 |
"----------\n" + |
| 13477 |
"3. ERROR in Test.java (at line 5)\n" + |
| 13478 |
" public Collection<Value> get(Key k) { return null; }\n" + |
| 13479 |
" ^^^^^^^^^^\n" + |
| 13480 |
"Name clash: The method get(Key) of type Test<Key,Value> has the same erasure as get(Object) of type LinkedHashMap<K,V> but does not override it\n" + |
| 13481 |
"----------\n" + |
| 13482 |
"4. ERROR in Test.java (at line 6)\n" + |
| 13483 |
" Zork z;\n" + |
| 13484 |
" ^^^^\n" + |
| 13485 |
"Zork cannot be resolved to a type\n" + |
| 13486 |
"----------\n"; |
| 13487 |
this.runNegativeTest( |
| 13488 |
new String[] { |
| 13489 |
"Test.java", |
| 13490 |
"import java.util.Collection;\n" + |
| 13491 |
"import java.util.LinkedHashMap;\n" + |
| 13492 |
"public class Test<Key, Value> extends LinkedHashMap<Key, Collection<Value>> {\n" + |
| 13493 |
" public Collection<Value> put(Key k, Value v) { return null; }\n" + |
| 13494 |
" public Collection<Value> get(Key k) { return null; }\n" + |
| 13495 |
" Zork z;\n" + |
| 13496 |
"}\n" |
| 13497 |
}, |
| 13498 |
output); |
| 13499 |
} |
| 12439 |
} |
13500 |
} |