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[] { "test050l" }; |
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. ERROR 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. ERROR 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 4254-4279
Link Here
|
4254 |
"class A<T> {}\n" + |
4483 |
"class A<T> {}\n" + |
4255 |
"class B {}\n" |
4484 |
"class B {}\n" |
4256 |
}, |
4485 |
}, |
4257 |
"----------\n" + |
4486 |
"----------\n" + |
4258 |
"1. ERROR in X.java (at line 2)\n" + |
4487 |
"1. ERROR in X.java (at line 2)\n" + |
4259 |
" void a(A<Number> s) {}\n" + |
4488 |
" void a(A<Number> s) {}\n" + |
4260 |
" ^^^^^^^^^^^^^^\n" + |
4489 |
" ^^^^^^^^^^^^^^\n" + |
4261 |
"Duplicate method a(A<Number>) in type X\n" + |
4490 |
"Duplicate method a(A<Number>) in type X\n" + |
4262 |
"----------\n" + |
4491 |
"----------\n" + |
4263 |
"2. ERROR in X.java (at line 3)\n" + |
4492 |
"2. ERROR in X.java (at line 3)\n" + |
4264 |
" B a(A<Number> n) { return null; }\n" + |
4493 |
" B a(A<Number> n) { return null; }\n" + |
4265 |
" ^^^^^^^^^^^^^^\n" + |
4494 |
" ^^^^^^^^^^^^^^\n" + |
4266 |
"Duplicate method a(A<Number>) in type X\n" + |
4495 |
"Duplicate method a(A<Number>) in type X\n" + |
4267 |
"----------\n" + |
4496 |
"----------\n" + |
4268 |
"3. ERROR in X.java (at line 4)\n" + |
4497 |
"3. ERROR in X.java (at line 4)\n" + |
4269 |
" Object b(A<Number> s) {}\n" + |
4498 |
" Object b(A<Number> s) {}\n" + |
4270 |
" ^^^^^^^^^^^^^^\n" + |
4499 |
" ^^^^^^^^^^^^^^\n" + |
4271 |
"Duplicate method b(A<Number>) in type X\n" + |
4500 |
"Duplicate method b(A<Number>) in type X\n" + |
4272 |
"----------\n" + |
4501 |
"----------\n" + |
4273 |
"4. ERROR in X.java (at line 5)\n" + |
4502 |
"4. ERROR in X.java (at line 4)\n" + |
4274 |
" B b(A<Number> n) { return null; }\n" + |
4503 |
" Object b(A<Number> s) {}\n" + |
4275 |
" ^^^^^^^^^^^^^^\n" + |
4504 |
" ^^^^^^^^^^^^^^\n" + |
4276 |
"Duplicate method b(A<Number>) in type X\n" + |
4505 |
"This method must return a result of type Object\n" + |
|
|
4506 |
"----------\n" + |
4507 |
"5. ERROR in X.java (at line 5)\n" + |
4508 |
" B b(A<Number> n) { return null; }\n" + |
4509 |
" ^^^^^^^^^^^^^^\n" + |
4510 |
"Duplicate method b(A<Number>) in type X\n" + |
4277 |
"----------\n" |
4511 |
"----------\n" |
4278 |
); |
4512 |
); |
4279 |
/* javac 7 |
4513 |
/* javac 7 |
Lines 4347-4352
Link Here
|
4347 |
} |
4581 |
} |
4348 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 |
4582 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 |
4349 |
public void test051b() { |
4583 |
public void test051b() { |
|
|
4584 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
4585 |
"----------\n" + |
4586 |
"1. WARNING in X.java (at line 2)\n" + |
4587 |
" void foo(A<String> a) {}\n" + |
4588 |
" ^^^^^^^^^^^^^^^^\n" + |
4589 |
"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + |
4590 |
"----------\n" + |
4591 |
"2. WARNING in X.java (at line 3)\n" + |
4592 |
" Object foo(A<Integer> a) { return null; }\n" + |
4593 |
" ^^^^^^^^^^^^^^^^^\n" + |
4594 |
"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + |
4595 |
"----------\n": |
4596 |
"----------\n" + |
4597 |
"1. ERROR in X.java (at line 2)\n" + |
4598 |
" void foo(A<String> a) {}\n" + |
4599 |
" ^^^^^^^^^^^^^^^^\n" + |
4600 |
"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + |
4601 |
"----------\n" + |
4602 |
"2. ERROR in X.java (at line 3)\n" + |
4603 |
" Object foo(A<Integer> a) { return null; }\n" + |
4604 |
" ^^^^^^^^^^^^^^^^^\n" + |
4605 |
"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + |
4606 |
"----------\n"; |
4350 |
this.runNegativeTest( |
4607 |
this.runNegativeTest( |
4351 |
new String[] { |
4608 |
new String[] { |
4352 |
"X.java", |
4609 |
"X.java", |
Lines 4356-4372
Link Here
|
4356 |
"}\n" + |
4613 |
"}\n" + |
4357 |
"class A<T> {}\n", |
4614 |
"class A<T> {}\n", |
4358 |
}, |
4615 |
}, |
4359 |
"----------\n" + |
4616 |
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 |
); |
4617 |
); |
4371 |
/* javac 7 |
4618 |
/* javac 7 |
4372 |
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure |
4619 |
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure |
Lines 4489-4494
Link Here
|
4489 |
|
4736 |
|
4490 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4737 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4491 |
public void test054() { |
4738 |
public void test054() { |
|
|
4739 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
4740 |
"----------\n" + |
4741 |
"1. WARNING in X.java (at line 2)\n" + |
4742 |
" void a(Object x) {}\n" + |
4743 |
" ^^^^^^^^^^^\n" + |
4744 |
"Method a(Object) has the same erasure a(Object) as another method in type X\n" + |
4745 |
"----------\n" + |
4746 |
"2. WARNING in X.java (at line 3)\n" + |
4747 |
" <T> T a(T x) { return null; }\n" + |
4748 |
" ^^^^^^\n" + |
4749 |
"Method a(T) has the same erasure a(Object) as another method in type X\n" + |
4750 |
"----------\n": |
4751 |
"----------\n" + |
4752 |
"1. ERROR in X.java (at line 2)\n" + |
4753 |
" void a(Object x) {}\n" + |
4754 |
" ^^^^^^^^^^^\n" + |
4755 |
"Method a(Object) has the same erasure a(Object) as another method in type X\n" + |
4756 |
"----------\n" + |
4757 |
"2. ERROR in X.java (at line 3)\n" + |
4758 |
" <T> T a(T x) { return null; }\n" + |
4759 |
" ^^^^^^\n" + |
4760 |
"Method a(T) has the same erasure a(Object) as another method in type X\n" + |
4761 |
"----------\n"; |
4492 |
this.runNegativeTest( |
4762 |
this.runNegativeTest( |
4493 |
new String[] { |
4763 |
new String[] { |
4494 |
"X.java", |
4764 |
"X.java", |
Lines 4497-4513
Link Here
|
4497 |
" <T> T a(T x) { return null; }\n" + |
4767 |
" <T> T a(T x) { return null; }\n" + |
4498 |
"}\n" |
4768 |
"}\n" |
4499 |
}, |
4769 |
}, |
4500 |
"----------\n" + |
4770 |
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 |
); |
4771 |
); |
4512 |
/* javac 7 |
4772 |
/* javac 7 |
4513 |
X.java:3: a(Object) is already defined in X |
4773 |
X.java:3: a(Object) is already defined in X |
Lines 4518-4523
Link Here
|
4518 |
} |
4778 |
} |
4519 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4779 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4520 |
public void test054a() { |
4780 |
public void test054a() { |
|
|
4781 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
4782 |
"----------\n" + |
4783 |
"1. WARNING in X.java (at line 2)\n" + |
4784 |
" <T1, T2> String aaa(X x) { return null; }\n" + |
4785 |
" ^^^^^^^^\n" + |
4786 |
"Method aaa(X) has the same erasure aaa(X) as another method in type X\n" + |
4787 |
"----------\n" + |
4788 |
"2. WARNING in X.java (at line 3)\n" + |
4789 |
" <T extends X> T aaa(T x) { return null; }\n" + |
4790 |
" ^^^^^^^^\n" + |
4791 |
"Method aaa(T) has the same erasure aaa(X) as another method in type X\n" + |
4792 |
"----------\n" + |
4793 |
"3. WARNING in X.java (at line 4)\n" + |
4794 |
" <T> String aa(X x) { return null; }\n" + |
4795 |
" ^^^^^^^\n" + |
4796 |
"Method aa(X) has the same erasure aa(X) as another method in type X\n" + |
4797 |
"----------\n" + |
4798 |
"4. WARNING in X.java (at line 5)\n" + |
4799 |
" <T extends X> T aa(T x) { return null; }\n" + |
4800 |
" ^^^^^^^\n" + |
4801 |
"Method aa(T) has the same erasure aa(X) as another method in type X\n" + |
4802 |
"----------\n" + |
4803 |
"5. WARNING in X.java (at line 6)\n" + |
4804 |
" String a(X x) { return null; }\n" + |
4805 |
" ^^^^^^\n" + |
4806 |
"Method a(X) has the same erasure a(X) as another method in type X\n" + |
4807 |
"----------\n" + |
4808 |
"6. WARNING in X.java (at line 7)\n" + |
4809 |
" <T extends X> T a(T x) { return null; }\n" + |
4810 |
" ^^^^^^\n" + |
4811 |
"Method a(T) has the same erasure a(X) as another method in type X\n" + |
4812 |
"----------\n" + |
4813 |
"7. WARNING in X.java (at line 8)\n" + |
4814 |
" <T> String z(X x) { return null; }\n" + |
4815 |
" ^^^^^^\n" + |
4816 |
"Duplicate method z(X) in type X\n" + |
4817 |
"----------\n" + |
4818 |
"8. WARNING in X.java (at line 9)\n" + |
4819 |
" <T, S> Object z(X x) { return null; }\n" + |
4820 |
" ^^^^^^\n" + |
4821 |
"Duplicate method z(X) in type X\n" + |
4822 |
"----------\n": |
4823 |
"----------\n" + |
4824 |
"1. ERROR in X.java (at line 2)\n" + |
4825 |
" <T1, T2> String aaa(X x) { return null; }\n" + |
4826 |
" ^^^^^^^^\n" + |
4827 |
"Method aaa(X) has the same erasure aaa(X) as another method in type X\n" + |
4828 |
"----------\n" + |
4829 |
"2. ERROR in X.java (at line 3)\n" + |
4830 |
" <T extends X> T aaa(T x) { return null; }\n" + |
4831 |
" ^^^^^^^^\n" + |
4832 |
"Method aaa(T) has the same erasure aaa(X) as another method in type X\n" + |
4833 |
"----------\n" + |
4834 |
"3. ERROR in X.java (at line 4)\n" + |
4835 |
" <T> String aa(X x) { return null; }\n" + |
4836 |
" ^^^^^^^\n" + |
4837 |
"Method aa(X) has the same erasure aa(X) as another method in type X\n" + |
4838 |
"----------\n" + |
4839 |
"4. ERROR in X.java (at line 5)\n" + |
4840 |
" <T extends X> T aa(T x) { return null; }\n" + |
4841 |
" ^^^^^^^\n" + |
4842 |
"Method aa(T) has the same erasure aa(X) as another method in type X\n" + |
4843 |
"----------\n" + |
4844 |
"5. ERROR in X.java (at line 6)\n" + |
4845 |
" String a(X x) { return null; }\n" + |
4846 |
" ^^^^^^\n" + |
4847 |
"Method a(X) has the same erasure a(X) as another method in type X\n" + |
4848 |
"----------\n" + |
4849 |
"6. ERROR in X.java (at line 7)\n" + |
4850 |
" <T extends X> T a(T x) { return null; }\n" + |
4851 |
" ^^^^^^\n" + |
4852 |
"Method a(T) has the same erasure a(X) as another method in type X\n" + |
4853 |
"----------\n" + |
4854 |
"7. ERROR in X.java (at line 8)\n" + |
4855 |
" <T> String z(X x) { return null; }\n" + |
4856 |
" ^^^^^^\n" + |
4857 |
"Duplicate method z(X) in type X\n" + |
4858 |
"----------\n" + |
4859 |
"8. ERROR in X.java (at line 9)\n" + |
4860 |
" <T, S> Object z(X x) { return null; }\n" + |
4861 |
" ^^^^^^\n" + |
4862 |
"Duplicate method z(X) in type X\n" + |
4863 |
"----------\n"; |
4521 |
this.runNegativeTest( |
4864 |
this.runNegativeTest( |
4522 |
new String[] { |
4865 |
new String[] { |
4523 |
"X.java", |
4866 |
"X.java", |
Lines 4532-4578
Link Here
|
4532 |
" <T, S> Object z(X x) { return null; }\n" + |
4875 |
" <T, S> Object z(X x) { return null; }\n" + |
4533 |
"}\n" |
4876 |
"}\n" |
4534 |
}, |
4877 |
}, |
4535 |
"----------\n" + |
4878 |
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 |
); |
4879 |
); |
4577 |
/* javac 7 |
4880 |
/* javac 7 |
4578 |
X.java:3: name clash: <T>aaa(T) and <T1,T2>aaa(X) have the same erasure |
4881 |
X.java:3: name clash: <T>aaa(T) and <T1,T2>aaa(X) have the same erasure |
Lines 4603-4608
Link Here
|
4603 |
} |
4906 |
} |
4604 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4907 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4605 |
public void test054b() { |
4908 |
public void test054b() { |
|
|
4909 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
4910 |
"----------\n" + |
4911 |
"1. WARNING in X.java (at line 2)\n" + |
4912 |
" Object foo(X<T> t) { return null; }\n" + |
4913 |
" ^^^^^^^^^^^\n" + |
4914 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
4915 |
"----------\n" + |
4916 |
"2. WARNING in X.java (at line 3)\n" + |
4917 |
" <S> String foo(X<T> s) { return null; }\n" + |
4918 |
" ^^^^^^^^^^^\n" + |
4919 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
4920 |
"----------\n": |
4921 |
"----------\n" + |
4922 |
"1. ERROR in X.java (at line 2)\n" + |
4923 |
" Object foo(X<T> t) { return null; }\n" + |
4924 |
" ^^^^^^^^^^^\n" + |
4925 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
4926 |
"----------\n" + |
4927 |
"2. ERROR in X.java (at line 3)\n" + |
4928 |
" <S> String foo(X<T> s) { return null; }\n" + |
4929 |
" ^^^^^^^^^^^\n" + |
4930 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
4931 |
"----------\n"; |
4606 |
this.runNegativeTest( |
4932 |
this.runNegativeTest( |
4607 |
new String[] { |
4933 |
new String[] { |
4608 |
"X.java", |
4934 |
"X.java", |
Lines 4611-4627
Link Here
|
4611 |
" <S> String foo(X<T> s) { return null; }\n" + |
4937 |
" <S> String foo(X<T> s) { return null; }\n" + |
4612 |
"}\n" |
4938 |
"}\n" |
4613 |
}, |
4939 |
}, |
4614 |
"----------\n" + |
4940 |
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 |
); |
4941 |
); |
4626 |
/* javac 7 |
4942 |
/* javac 7 |
4627 |
X.java:3: name clash: <S>foo(X<T>) and foo(X<T>) have the same erasure |
4943 |
X.java:3: name clash: <S>foo(X<T>) and foo(X<T>) have the same erasure |
Lines 4666-4671
Link Here
|
4666 |
} |
4982 |
} |
4667 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4983 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4668 |
public void test054d() { |
4984 |
public void test054d() { |
|
|
4985 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
4986 |
"----------\n" + |
4987 |
"1. WARNING in X.java (at line 2)\n" + |
4988 |
" <T> T a(A<T> t) {return null;}\n" + |
4989 |
" ^^^^^^^^^\n" + |
4990 |
"Method a(A<T>) has the same erasure a(A<T>) as another method in type X\n" + |
4991 |
"----------\n" + |
4992 |
"2. WARNING in X.java (at line 3)\n" + |
4993 |
" <T> String a(A<Object> o) {return null;}\n" + |
4994 |
" ^^^^^^^^^^^^^^\n" + |
4995 |
"Method a(A<Object>) has the same erasure a(A<T>) as another method in type X\n" + |
4996 |
"----------\n" + |
4997 |
"3. WARNING in X.java (at line 4)\n" + |
4998 |
" <T> T aa(A<T> t) {return null;}\n" + |
4999 |
" ^^^^^^^^^^\n" + |
5000 |
"Method aa(A<T>) has the same erasure aa(A<T>) as another method in type X\n" + |
5001 |
"----------\n" + |
5002 |
"4. WARNING in X.java (at line 5)\n" + |
5003 |
" String aa(A<Object> o) {return null;}\n" + |
5004 |
" ^^^^^^^^^^^^^^^\n" + |
5005 |
"Method aa(A<Object>) has the same erasure aa(A<T>) as another method in type X\n" + |
5006 |
"----------\n": |
5007 |
"----------\n" + |
5008 |
"1. ERROR in X.java (at line 2)\n" + |
5009 |
" <T> T a(A<T> t) {return null;}\n" + |
5010 |
" ^^^^^^^^^\n" + |
5011 |
"Method a(A<T>) has the same erasure a(A<T>) as another method in type X\n" + |
5012 |
"----------\n" + |
5013 |
"2. ERROR in X.java (at line 3)\n" + |
5014 |
" <T> String a(A<Object> o) {return null;}\n" + |
5015 |
" ^^^^^^^^^^^^^^\n" + |
5016 |
"Method a(A<Object>) has the same erasure a(A<T>) as another method in type X\n" + |
5017 |
"----------\n" + |
5018 |
"3. ERROR in X.java (at line 4)\n" + |
5019 |
" <T> T aa(A<T> t) {return null;}\n" + |
5020 |
" ^^^^^^^^^^\n" + |
5021 |
"Method aa(A<T>) has the same erasure aa(A<T>) as another method in type X\n" + |
5022 |
"----------\n" + |
5023 |
"4. ERROR in X.java (at line 5)\n" + |
5024 |
" String aa(A<Object> o) {return null;}\n" + |
5025 |
" ^^^^^^^^^^^^^^^\n" + |
5026 |
"Method aa(A<Object>) has the same erasure aa(A<T>) as another method in type X\n" + |
5027 |
"----------\n"; |
4669 |
this.runNegativeTest( |
5028 |
this.runNegativeTest( |
4670 |
new String[] { |
5029 |
new String[] { |
4671 |
"X.java", |
5030 |
"X.java", |
Lines 4677-4703
Link Here
|
4677 |
"}\n" + |
5036 |
"}\n" + |
4678 |
"class A<T> {}\n", |
5037 |
"class A<T> {}\n", |
4679 |
}, |
5038 |
}, |
4680 |
"----------\n" + |
5039 |
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 |
); |
5040 |
); |
4702 |
/* javac 7 |
5041 |
/* javac 7 |
4703 |
X.java:3: name clash: <T#1>a(A<Object>) and <T#2>a(A<T#2>) have the same erasure |
5042 |
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 |
} |
5160 |
} |
4822 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
5161 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
4823 |
public void test058a() { |
5162 |
public void test058a() { |
|
|
5163 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
5164 |
"----------\n" + |
5165 |
"1. ERROR in X.java (at line 3)\n" + |
5166 |
" new X<Object>().foo(\"X\");\n" + |
5167 |
" ^^^\n" + |
5168 |
"The method foo(String) is ambiguous for the type X<Object>\n" + |
5169 |
"----------\n" + |
5170 |
"2. ERROR in X.java (at line 4)\n" + |
5171 |
" new X<Object>().foo2(\"X\");\n" + |
5172 |
" ^^^^\n" + |
5173 |
"The method foo2(String) is ambiguous for the type X<Object>\n" + |
5174 |
"----------\n" + |
5175 |
"3. WARNING in X.java (at line 6)\n" + |
5176 |
" <T> T foo(T t) {return null;}\n" + |
5177 |
" ^^^^^^^^\n" + |
5178 |
"Method foo(T) has the same erasure foo(Object) as another method in type X<A>\n" + |
5179 |
"----------\n" + |
5180 |
"4. WARNING in X.java (at line 7)\n" + |
5181 |
" void foo(A a) {}\n" + |
5182 |
" ^^^^^^^^\n" + |
5183 |
"Method foo(A) has the same erasure foo(Object) as another method in type X<A>\n" + |
5184 |
"----------\n" + |
5185 |
"5. WARNING in X.java (at line 8)\n" + |
5186 |
" <T> T foo2(T t) {return null;}\n" + |
5187 |
" ^^^^^^^^^\n" + |
5188 |
"Method foo2(T) has the same erasure foo2(Object) as another method in type X<A>\n" + |
5189 |
"----------\n" + |
5190 |
"6. WARNING in X.java (at line 9)\n" + |
5191 |
" <T> void foo2(A a) {}\n" + |
5192 |
" ^^^^^^^^^\n" + |
5193 |
"Method foo2(A) has the same erasure foo2(Object) as another method in type X<A>\n" + |
5194 |
"----------\n": |
5195 |
"----------\n" + |
5196 |
"1. ERROR in X.java (at line 6)\n" + |
5197 |
" <T> T foo(T t) {return null;}\n" + |
5198 |
" ^^^^^^^^\n" + |
5199 |
"Method foo(T) has the same erasure foo(Object) as another method in type X<A>\n" + |
5200 |
"----------\n" + |
5201 |
"2. ERROR in X.java (at line 7)\n" + |
5202 |
" void foo(A a) {}\n" + |
5203 |
" ^^^^^^^^\n" + |
5204 |
"Method foo(A) has the same erasure foo(Object) as another method in type X<A>\n" + |
5205 |
"----------\n" + |
5206 |
"3. ERROR in X.java (at line 8)\n" + |
5207 |
" <T> T foo2(T t) {return null;}\n" + |
5208 |
" ^^^^^^^^^\n" + |
5209 |
"Method foo2(T) has the same erasure foo2(Object) as another method in type X<A>\n" + |
5210 |
"----------\n" + |
5211 |
"4. ERROR in X.java (at line 9)\n" + |
5212 |
" <T> void foo2(A a) {}\n" + |
5213 |
" ^^^^^^^^^\n" + |
5214 |
"Method foo2(A) has the same erasure foo2(Object) as another method in type X<A>\n" + |
5215 |
"----------\n"; |
4824 |
this.runNegativeTest( |
5216 |
this.runNegativeTest( |
4825 |
new String[] { |
5217 |
new String[] { |
4826 |
"X.java", |
5218 |
"X.java", |
Lines 4835-4861
Link Here
|
4835 |
" <T> void foo2(A a) {}\n" + |
5227 |
" <T> void foo2(A a) {}\n" + |
4836 |
"}\n" |
5228 |
"}\n" |
4837 |
}, |
5229 |
}, |
4838 |
"----------\n" + |
5230 |
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 |
); |
5231 |
); |
4860 |
/* javac 7 |
5232 |
/* javac 7 |
4861 |
X.java:7: name clash: foo(A) and <T>foo(T) have the same erasure |
5233 |
X.java:7: name clash: foo(A) and <T>foo(T) have the same erasure |
Lines 4876-4881
Link Here
|
4876 |
} |
5248 |
} |
4877 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
5249 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
4878 |
public void test058b() { |
5250 |
public void test058b() { |
|
|
5251 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
5252 |
"----------\n" + |
5253 |
"1. ERROR in X.java (at line 3)\n" + |
5254 |
" new X<Object>().foo(\"X\");\n" + |
5255 |
" ^^^\n" + |
5256 |
"The method foo(String) is ambiguous for the type X<Object>\n" + |
5257 |
"----------\n" + |
5258 |
"2. ERROR in X.java (at line 4)\n" + |
5259 |
" new X<Object>().foo2(\"X\");\n" + |
5260 |
" ^^^^\n" + |
5261 |
"The method foo2(String) is ambiguous for the type X<Object>\n" + |
5262 |
"----------\n" + |
5263 |
"3. WARNING in X.java (at line 6)\n" + |
5264 |
" <T> T foo(T t) {return null;}\n" + |
5265 |
" ^^^^^^^^\n" + |
5266 |
"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" + |
5267 |
"----------\n" + |
5268 |
"4. WARNING in X.java (at line 7)\n" + |
5269 |
" <T> T foo2(T t) {return null;}\n" + |
5270 |
" ^^^^^^^^^\n" + |
5271 |
"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" + |
5272 |
"----------\n": |
5273 |
"----------\n" + |
5274 |
"1. ERROR in X.java (at line 3)\n" + |
5275 |
" new X<Object>().foo(\"X\");\n" + |
5276 |
" ^^^\n" + |
5277 |
"The method foo(String) is ambiguous for the type X<Object>\n" + |
5278 |
"----------\n" + |
5279 |
"2. ERROR in X.java (at line 4)\n" + |
5280 |
" new X<Object>().foo2(\"X\");\n" + |
5281 |
" ^^^^\n" + |
5282 |
"The method foo2(String) is ambiguous for the type X<Object>\n" + |
5283 |
"----------\n" + |
5284 |
"3. ERROR in X.java (at line 6)\n" + |
5285 |
" <T> T foo(T t) {return null;}\n" + |
5286 |
" ^^^^^^^^\n" + |
5287 |
"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" + |
5288 |
"----------\n" + |
5289 |
"4. ERROR in X.java (at line 7)\n" + |
5290 |
" <T> T foo2(T t) {return null;}\n" + |
5291 |
" ^^^^^^^^^\n" + |
5292 |
"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" + |
5293 |
"----------\n"; |
4879 |
this.runNegativeTest( |
5294 |
this.runNegativeTest( |
4880 |
new String[] { |
5295 |
new String[] { |
4881 |
"X.java", |
5296 |
"X.java", |
Lines 4892-4918
Link Here
|
4892 |
" <T> void foo2(A a) {}\n" + |
5307 |
" <T> void foo2(A a) {}\n" + |
4893 |
"}" |
5308 |
"}" |
4894 |
}, |
5309 |
}, |
4895 |
"----------\n" + |
5310 |
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 |
); |
5311 |
); |
4917 |
/* javac 7 |
5312 |
/* 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 |
5313 |
X.java:3: reference to foo is ambiguous, both method foo(A) in Y and method <T>foo(T) in X match |
Lines 7971-7976
Link Here
|
7971 |
} |
8366 |
} |
7972 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830 |
8367 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830 |
7973 |
public void test120a() { |
8368 |
public void test120a() { |
|
|
8369 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
8370 |
"----------\n" + |
8371 |
"1. WARNING in Bar.java (at line 2)\n" + |
8372 |
" int getThing(V v) { return 1; }\n" + |
8373 |
" ^^^^^^^^^^^^^\n" + |
8374 |
"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
8375 |
"----------\n" + |
8376 |
"2. WARNING in Bar.java (at line 3)\n" + |
8377 |
" boolean getThing(E e) { return true; }\n" + |
8378 |
" ^^^^^^^^^^^^^\n" + |
8379 |
"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
8380 |
"----------\n": |
8381 |
"----------\n" + |
8382 |
"1. ERROR in Bar.java (at line 2)\n" + |
8383 |
" int getThing(V v) { return 1; }\n" + |
8384 |
" ^^^^^^^^^^^^^\n" + |
8385 |
"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
8386 |
"----------\n" + |
8387 |
"2. ERROR in Bar.java (at line 3)\n" + |
8388 |
" boolean getThing(E e) { return true; }\n" + |
8389 |
" ^^^^^^^^^^^^^\n" + |
8390 |
"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
8391 |
"----------\n"; |
7974 |
this.runNegativeTest( |
8392 |
this.runNegativeTest( |
7975 |
new String[] { |
8393 |
new String[] { |
7976 |
"Bar.java", |
8394 |
"Bar.java", |
Lines 7980-7996
Link Here
|
7980 |
"}\n" + |
8398 |
"}\n" + |
7981 |
"public class Bar<V,E> extends Foo<V,E> {}" |
8399 |
"public class Bar<V,E> extends Foo<V,E> {}" |
7982 |
}, |
8400 |
}, |
7983 |
"----------\n" + |
8401 |
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 |
); |
8402 |
); |
7995 |
} |
8403 |
} |
7996 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=173477 |
8404 |
//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) |
10108 |
// JDK7 (7b100) behavior. (earlier we would issue an extra name clash) |
9701 |
public void test177() { |
10109 |
public void test177() { |
9702 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_6) { // see test187() |
10110 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_6) { // see test187() |
|
|
10111 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6)? |
10112 |
"----------\n" + |
10113 |
"1. WARNING in X.java (at line 3)\n" + |
10114 |
" class A extends LinkedHashMap {\n" + |
10115 |
" ^\n" + |
10116 |
"The serializable class A does not declare a static final serialVersionUID field of type long\n" + |
10117 |
"----------\n" + |
10118 |
"2. WARNING in X.java (at line 3)\n" + |
10119 |
" class A extends LinkedHashMap {\n" + |
10120 |
" ^^^^^^^^^^^^^\n" + |
10121 |
"LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized\n" + |
10122 |
"----------\n" + |
10123 |
"3. WARNING in X.java (at line 4)\n" + |
10124 |
" public A foo(Collection c) { return this; }\n" + |
10125 |
" ^^^^^^^^^^\n" + |
10126 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
10127 |
"----------\n" + |
10128 |
"4. WARNING in X.java (at line 6)\n" + |
10129 |
" class X extends A implements I {\n" + |
10130 |
" ^\n" + |
10131 |
"The serializable class X does not declare a static final serialVersionUID field of type long\n" + |
10132 |
"----------\n" + |
10133 |
"5. WARNING in X.java (at line 7)\n" + |
10134 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
10135 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
10136 |
"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" + |
10137 |
"----------\n": |
10138 |
"----------\n" + |
10139 |
"1. WARNING in X.java (at line 3)\n" + |
10140 |
" class A extends LinkedHashMap {\n" + |
10141 |
" ^\n" + |
10142 |
"The serializable class A does not declare a static final serialVersionUID field of type long\n" + |
10143 |
"----------\n" + |
10144 |
"2. WARNING in X.java (at line 3)\n" + |
10145 |
" class A extends LinkedHashMap {\n" + |
10146 |
" ^^^^^^^^^^^^^\n" + |
10147 |
"LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized\n" + |
10148 |
"----------\n" + |
10149 |
"3. WARNING in X.java (at line 4)\n" + |
10150 |
" public A foo(Collection c) { return this; }\n" + |
10151 |
" ^^^^^^^^^^\n" + |
10152 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
10153 |
"----------\n" + |
10154 |
"4. WARNING in X.java (at line 6)\n" + |
10155 |
" class X extends A implements I {\n" + |
10156 |
" ^\n" + |
10157 |
"The serializable class X does not declare a static final serialVersionUID field of type long\n" + |
10158 |
"----------\n" + |
10159 |
"5. ERROR in X.java (at line 7)\n" + |
10160 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
10161 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
10162 |
"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" + |
10163 |
"----------\n"; |
9703 |
this.runNegativeTest( |
10164 |
this.runNegativeTest( |
9704 |
new String[] { |
10165 |
new String[] { |
9705 |
"X.java", |
10166 |
"X.java", |
Lines 9712-9743
Link Here
|
9712 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
10173 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
9713 |
"}" |
10174 |
"}" |
9714 |
}, |
10175 |
}, |
9715 |
"----------\n" + |
10176 |
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 |
); |
10177 |
); |
9742 |
} else { |
10178 |
} else { |
9743 |
this.runNegativeTest( |
10179 |
this.runNegativeTest( |
Lines 9777-9783
Link Here
|
9777 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
10213 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
9778 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
10214 |
" ^^^^^^^^^^^^^^^^^^^^\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" + |
10215 |
"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" + |
10216 |
"----------\n" + |
9781 |
"6. ERROR in X.java (at line 7)\n" + |
10217 |
"6. ERROR in X.java (at line 7)\n" + |
9782 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
10218 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
9783 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
10219 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
Lines 10246-10251
Link Here
|
10246 |
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 |
10682 |
// http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6182950 |
10247 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=? |
10683 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=? |
10248 |
public void test187() { |
10684 |
public void test187() { |
|
|
10685 |
String expectedCompilerLog = (this.complianceLevel == ClassFileConstants.JDK1_6 )? |
10686 |
"----------\n" + |
10687 |
"1. WARNING in X.java (at line 6)\n" + |
10688 |
" double f(List<Integer> l) {return 0;}\n" + |
10689 |
" ^^^^^^^^^^^^^^^^^^\n" + |
10690 |
"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" + |
10691 |
"----------\n" + |
10692 |
"2. WARNING in X.java (at line 13)\n" + |
10693 |
" int f(List<String> l) {return 0;}\n" + |
10694 |
" ^^^^^^^^^^^^^^^^^\n" + |
10695 |
"Method f(List<String>) has the same erasure f(List<E>) as another method in type XX\n" + |
10696 |
"----------\n" + |
10697 |
"3. WARNING in X.java (at line 14)\n" + |
10698 |
" double f(List<Integer> l) {return 0;}\n" + |
10699 |
" ^^^^^^^^^^^^^^^^^^\n" + |
10700 |
"Method f(List<Integer>) has the same erasure f(List<E>) as another method in type XX\n" + |
10701 |
"----------\n": |
10702 |
"----------\n" + |
10703 |
"1. ERROR in X.java (at line 6)\n" + |
10704 |
" double f(List<Integer> l) {return 0;}\n" + |
10705 |
" ^^^^^^^^^^^^^^^^^^\n" + |
10706 |
"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" + |
10707 |
"----------\n" + |
10708 |
"2. ERROR in X.java (at line 13)\n" + |
10709 |
" int f(List<String> l) {return 0;}\n" + |
10710 |
" ^^^^^^^^^^^^^^^^^\n" + |
10711 |
"Method f(List<String>) has the same erasure f(List<E>) as another method in type XX\n" + |
10712 |
"----------\n" + |
10713 |
"3. ERROR in X.java (at line 14)\n" + |
10714 |
" double f(List<Integer> l) {return 0;}\n" + |
10715 |
" ^^^^^^^^^^^^^^^^^^\n" + |
10716 |
"Method f(List<Integer>) has the same erasure f(List<E>) as another method in type XX\n" + |
10717 |
"----------\n"; |
10249 |
this.runNegativeTest( |
10718 |
this.runNegativeTest( |
10250 |
new String[] { |
10719 |
new String[] { |
10251 |
"X.java", |
10720 |
"X.java", |
Lines 10265-10286
Link Here
|
10265 |
"double f(List<Integer> l) {return 0;}\n" +// name clash in 1.5 & 7 |
10734 |
"double f(List<Integer> l) {return 0;}\n" +// name clash in 1.5 & 7 |
10266 |
"}" |
10735 |
"}" |
10267 |
}, |
10736 |
}, |
10268 |
"----------\n" + |
10737 |
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 |
); |
10738 |
); |
10285 |
} |
10739 |
} |
10286 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=279836 |
10740 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=279836 |
Lines 10702-10707
Link Here
|
10702 |
} |
11156 |
} |
10703 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088 |
11157 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088 |
10704 |
public void test200() { |
11158 |
public void test200() { |
|
|
11159 |
Map options = getCompilerOptions(); |
11160 |
String compliance = (String) options.get(JavaCore.COMPILER_COMPLIANCE); |
11161 |
String errorMessage = compliance == JavaCore.VERSION_1_6 ? |
11162 |
"----------\n" + |
11163 |
"1. WARNING in X.java (at line 3)\n" + |
11164 |
" int foo(Collection bar) { return 0; }\n" + |
11165 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
11166 |
"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + |
11167 |
"----------\n" + |
11168 |
"2. WARNING in X.java (at line 3)\n" + |
11169 |
" int foo(Collection bar) { return 0; }\n" + |
11170 |
" ^^^^^^^^^^\n" + |
11171 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
11172 |
"----------\n" + |
11173 |
"3. WARNING in X.java (at line 4)\n" + |
11174 |
" double foo(Collection<String> bar) {return 0; }\n" + |
11175 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
11176 |
"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + |
11177 |
"----------\n" : |
11178 |
"----------\n" + |
11179 |
"1. ERROR in X.java (at line 3)\n" + |
11180 |
" int foo(Collection bar) { return 0; }\n" + |
11181 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
11182 |
"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + |
11183 |
"----------\n" + |
11184 |
"2. WARNING in X.java (at line 3)\n" + |
11185 |
" int foo(Collection bar) { return 0; }\n" + |
11186 |
" ^^^^^^^^^^\n" + |
11187 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
11188 |
"----------\n" + |
11189 |
"3. ERROR in X.java (at line 4)\n" + |
11190 |
" double foo(Collection<String> bar) {return 0; }\n" + |
11191 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
11192 |
"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + |
11193 |
"----------\n"; |
10705 |
this.runNegativeTest( |
11194 |
this.runNegativeTest( |
10706 |
new String[] { |
11195 |
new String[] { |
10707 |
"X.java", |
11196 |
"X.java", |
Lines 10711-10732
Link Here
|
10711 |
" double foo(Collection<String> bar) {return 0; }\n" + |
11200 |
" double foo(Collection<String> bar) {return 0; }\n" + |
10712 |
"}" |
11201 |
"}" |
10713 |
}, |
11202 |
}, |
10714 |
"----------\n" + |
11203 |
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 |
); |
11204 |
); |
10731 |
/* javac 7 |
11205 |
/* javac 7 |
10732 |
X.java:4: foo(Collection) is already defined in X |
11206 |
X.java:4: foo(Collection) is already defined in X |