Lines 3223-3230
Link Here
|
3223 |
|
3223 |
|
3224 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3224 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3225 |
public void test048() { |
3225 |
public void test048() { |
3226 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
3226 |
this.runNegativeTest( |
3227 |
this.runConformTest( |
|
|
3228 |
new String[] { |
3227 |
new String[] { |
3229 |
"X1.java", |
3228 |
"X1.java", |
3230 |
"import java.util.*;\n" + |
3229 |
"import java.util.*;\n" + |
Lines 3232-3244
Link Here
|
3232 |
" public Object putAll(Map<String,String> a) { return null; }\n" + |
3231 |
" public Object putAll(Map<String,String> a) { return null; }\n" + |
3233 |
"}\n" |
3232 |
"}\n" |
3234 |
}, |
3233 |
}, |
3235 |
"" |
3234 |
"----------\n" + |
|
|
3235 |
"1. WARNING in X1.java (at line 2)\n" + |
3236 |
" public class X1 extends LinkedHashMap<String, String> {\n" + |
3237 |
" ^^\n" + |
3238 |
"The serializable class X1 does not declare a static final serialVersionUID field of type long\n" + |
3239 |
"----------\n" + |
3240 |
"2. ERROR in X1.java (at line 3)\n" + |
3241 |
" public Object putAll(Map<String,String> a) { return null; }\n" + |
3242 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
3243 |
"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" + |
3244 |
"----------\n" |
3236 |
); |
3245 |
); |
|
|
3246 |
/* javac 7 |
3247 |
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 |
3248 |
public Object putAll(Map<String,String> a) { return null; } |
3249 |
^ |
3250 |
where K,V are type-variables: |
3251 |
K extends Object declared in class HashMap |
3252 |
V extends Object declared in class HashMap |
3253 |
1 error |
3254 |
*/ |
3237 |
} |
3255 |
} |
3238 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3256 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3239 |
public void test048a() { |
3257 |
public void test048a() { |
3240 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
3258 |
this.runNegativeTest( |
3241 |
this.runConformTest( |
|
|
3242 |
new String[] { |
3259 |
new String[] { |
3243 |
"X2.java", |
3260 |
"X2.java", |
3244 |
"public class X2 extends Y<String> {\n" + |
3261 |
"public class X2 extends Y<String> {\n" + |
Lines 3251-3258
Link Here
|
3251 |
" public void foo(I<? extends T> a);\n" + |
3268 |
" public void foo(I<? extends T> a);\n" + |
3252 |
"}\n" |
3269 |
"}\n" |
3253 |
}, |
3270 |
}, |
3254 |
"" |
3271 |
"----------\n" + |
|
|
3272 |
"1. ERROR in X2.java (at line 2)\n" + |
3273 |
" public Object foo(I<String> z) { return null; }\n" + |
3274 |
" ^^^^^^^^^^^^^^^^\n" + |
3275 |
"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" + |
3276 |
"----------\n" |
3255 |
); |
3277 |
); |
|
|
3278 |
/* javac 7 |
3279 |
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 |
3280 |
public Object foo(I<String> z) { return null; } |
3281 |
^ |
3282 |
where T is a type-variable: |
3283 |
T extends Object declared in class Y |
3284 |
1 error |
3285 |
*/ |
3256 |
} |
3286 |
} |
3257 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3287 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3258 |
public void test048b() { |
3288 |
public void test048b() { |
Lines 3275-3287
Link Here
|
3275 |
" ^^^^^^^^^^^^^^^^\n" + |
3305 |
" ^^^^^^^^^^^^^^^^\n" + |
3276 |
"Name clash: The method foo(I<String>) of type X3 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
3306 |
"Name clash: The method foo(I<String>) of type X3 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
3277 |
"----------\n" |
3307 |
"----------\n" |
3278 |
// name clash: foo(I<java.lang.String>) in X and foo(I<? extends T>) in Y<java.lang.String> have the same erasure, yet neither overrides the other |
|
|
3279 |
); |
3308 |
); |
|
|
3309 |
/* javac 7 |
3310 |
X.java:2: name clash: foo(I<String>) in X3 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other |
3311 |
public void foo(I<String> z) {} |
3312 |
^ |
3313 |
where T is a type-variable: |
3314 |
T extends Object declared in class Y |
3315 |
1 error |
3316 |
*/ |
3280 |
} |
3317 |
} |
3281 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3318 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3282 |
public void test048c() { |
3319 |
public void test048c() { |
3283 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
3320 |
this.runNegativeTest( |
3284 |
this.runConformTest( |
|
|
3285 |
new String[] { |
3321 |
new String[] { |
3286 |
"X4.java", |
3322 |
"X4.java", |
3287 |
"public class X4 extends Y<String> {\n" + |
3323 |
"public class X4 extends Y<String> {\n" + |
Lines 3294-3306
Link Here
|
3294 |
" public Object foo(I<? extends T> a);\n" + |
3330 |
" public Object foo(I<? extends T> a);\n" + |
3295 |
"}\n" |
3331 |
"}\n" |
3296 |
}, |
3332 |
}, |
3297 |
"" |
3333 |
"----------\n" + |
|
|
3334 |
"1. ERROR in X4.java (at line 2)\n" + |
3335 |
" public String foo(I<String> z) { return null; }\n" + |
3336 |
" ^^^^^^^^^^^^^^^^\n" + |
3337 |
"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" + |
3338 |
"----------\n" |
3298 |
); |
3339 |
); |
|
|
3340 |
/* javac 7 |
3341 |
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 |
3342 |
public String foo(I<String> z) { return null; } |
3343 |
^ |
3344 |
where T is a type-variable: |
3345 |
T extends Object declared in class Y |
3346 |
1 error |
3347 |
*/ |
3299 |
} |
3348 |
} |
3300 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3349 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3301 |
public void test048d() { |
3350 |
public void test048d() { |
3302 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
3351 |
this.runNegativeTest( |
3303 |
this.runConformTest( |
|
|
3304 |
new String[] { |
3352 |
new String[] { |
3305 |
"X5.java", |
3353 |
"X5.java", |
3306 |
"public class X5 extends Y<String> {\n" + |
3354 |
"public class X5 extends Y<String> {\n" + |
Lines 3313-3325
Link Here
|
3313 |
" public String foo(I<? extends T> a);\n" + |
3361 |
" public String foo(I<? extends T> a);\n" + |
3314 |
"}\n" |
3362 |
"}\n" |
3315 |
}, |
3363 |
}, |
3316 |
"" |
3364 |
"----------\n" + |
|
|
3365 |
"1. ERROR in X5.java (at line 2)\n" + |
3366 |
" public Object foo(I<String> z) { return null; }\n" + |
3367 |
" ^^^^^^^^^^^^^^^^\n" + |
3368 |
"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" + |
3369 |
"----------\n" |
3317 |
); |
3370 |
); |
|
|
3371 |
/* javac 7 |
3372 |
X.java:2: name clash: foo(I<String>) in X5 and foo(I<? extends T>) in Y have the |
3373 |
same erasure, yet neither overrides the other |
3374 |
public Object foo(I<String> z) { return null; } |
3375 |
^ |
3376 |
where T is a type-variable: |
3377 |
T extends Object declared in class Y |
3378 |
1 error |
3379 |
*/ |
3318 |
} |
3380 |
} |
3319 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3381 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3320 |
public void test048e() { |
3382 |
public void test048e() { |
3321 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
3383 |
this.runNegativeTest( |
3322 |
this.runConformTest( |
|
|
3323 |
new String[] { |
3384 |
new String[] { |
3324 |
"X6.java", |
3385 |
"X6.java", |
3325 |
"public class X6 extends Y<String> {\n" + |
3386 |
"public class X6 extends Y<String> {\n" + |
Lines 3332-3344
Link Here
|
3332 |
" public Object foo(I<? extends T> a);\n" + |
3393 |
" public Object foo(I<? extends T> a);\n" + |
3333 |
"}\n" |
3394 |
"}\n" |
3334 |
}, |
3395 |
}, |
3335 |
"" |
3396 |
"----------\n" + |
|
|
3397 |
"1. ERROR in X6.java (at line 2)\n" + |
3398 |
" public void foo(I<String> z) {}\n" + |
3399 |
" ^^^^^^^^^^^^^^^^\n" + |
3400 |
"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" + |
3401 |
"----------\n" |
3336 |
); |
3402 |
); |
|
|
3403 |
/* javac 7 |
3404 |
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 |
3405 |
public void foo(I<String> z) {} |
3406 |
^ |
3407 |
where T is a type-variable: |
3408 |
T extends Object declared in class Y |
3409 |
1 error |
3410 |
*/ |
3337 |
} |
3411 |
} |
3338 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3412 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3339 |
public void test048f() { |
3413 |
public void test048f() { |
3340 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
3414 |
this.runNegativeTest( |
3341 |
this.runConformTest( |
|
|
3342 |
new String[] { |
3415 |
new String[] { |
3343 |
"X7.java", |
3416 |
"X7.java", |
3344 |
"public class X7 extends Y<String> {\n" + |
3417 |
"public class X7 extends Y<String> {\n" + |
Lines 3351-3358
Link Here
|
3351 |
" public T foo(I<? extends T> a);\n" + |
3424 |
" public T foo(I<? extends T> a);\n" + |
3352 |
"}\n" |
3425 |
"}\n" |
3353 |
}, |
3426 |
}, |
3354 |
"" |
3427 |
"----------\n" + |
|
|
3428 |
"1. ERROR in X7.java (at line 2)\n" + |
3429 |
" public String foo(I<String> z) { return null; }\n" + |
3430 |
" ^^^^^^^^^^^^^^^^\n" + |
3431 |
"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" + |
3432 |
"----------\n" |
3355 |
); |
3433 |
); |
|
|
3434 |
/* javac 7 |
3435 |
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 |
3436 |
public String foo(I<String> z) { return null; } |
3437 |
^ |
3438 |
where T is a type-variable: |
3439 |
T extends Object declared in class Y |
3440 |
1 error |
3441 |
*/ |
3356 |
} |
3442 |
} |
3357 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3443 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=85900 |
3358 |
public void test048g() { |
3444 |
public void test048g() { |
Lines 3375-3382
Link Here
|
3375 |
" ^^^^^^^^^^^^^^^^\n" + |
3461 |
" ^^^^^^^^^^^^^^^^\n" + |
3376 |
"Name clash: The method foo(I<String>) of type X8 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
3462 |
"Name clash: The method foo(I<String>) of type X8 has the same erasure as foo(I<? extends T>) of type Y<T> but does not override it\n" + |
3377 |
"----------\n" |
3463 |
"----------\n" |
3378 |
// name clash: foo(I<java.lang.String>) in X7 and foo(I<? extends T>) in Y<java.lang.String> have the same erasure, yet neither overrides the other |
|
|
3379 |
); |
3464 |
); |
|
|
3465 |
/* javac 7 |
3466 |
X.java:2: name clash: foo(I<String>) in X8 and foo(I<? extends T>) in Y have the same erasure, yet neither overrides the other |
3467 |
public Object foo(I<String> z) { return null; } |
3468 |
^ |
3469 |
where T is a type-variable: |
3470 |
T extends Object declared in class Y |
3471 |
1 error |
3472 |
*/ |
3380 |
} |
3473 |
} |
3381 |
|
3474 |
|
3382 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88094 |
3475 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=88094 |
Lines 3439-3498
Link Here
|
3439 |
|
3532 |
|
3440 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754 |
3533 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754 |
3441 |
public void test050() { |
3534 |
public void test050() { |
3442 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
3535 |
this.runNegativeTest( |
3443 |
this.runConformTest( |
|
|
3444 |
new String[] { |
3536 |
new String[] { |
3445 |
"X.java", |
3537 |
"X.java", |
3446 |
"public class X {\n" + |
3538 |
"public class X {\n" + |
3447 |
" public static <S extends A> S foo() { System.out.print(\"A\"); return null; }\n" + |
3539 |
" public static <S extends A> S foo() { System.out.print(\"A\"); return null; }\n" + |
3448 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
3540 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
3449 |
" public static void main(String[] args) {\n" + |
3541 |
" public static void main(String[] args) {\n" + |
3450 |
" X.<A>foo();\n" + |
3542 |
" X.<A>foo();\n" + |
3451 |
" X.<B>foo();\n" + |
3543 |
" X.<B>foo();\n" + |
3452 |
" new X().<B>foo();\n" + |
3544 |
" new X().<B>foo();\n" + |
3453 |
" }\n" + |
3545 |
" }\n" + |
3454 |
"}\n" + |
3546 |
"}\n" + |
3455 |
"class A {}\n" + |
3547 |
"class A {}\n" + |
3456 |
"class B {}\n" |
3548 |
"class B {}" |
3457 |
}, |
3549 |
}, |
3458 |
"ABB" |
3550 |
"----------\n" + |
3459 |
); |
3551 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
3552 |
" public static <S extends A> S foo() { System.out.print(\"A\"); return null; }\n" + |
3553 |
" ^^^^^\n" + |
3554 |
"Duplicate method foo() in type X\n" + |
3555 |
"----------\n" + |
3556 |
"2. ERROR in X.java (at line 3)\n" + |
3557 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
3558 |
" ^^^^^\n" + |
3559 |
"Duplicate method foo() in type X\n" + |
3560 |
"----------\n" + |
3561 |
"3. ERROR in X.java (at line 6)\n" + |
3562 |
" X.<B>foo();\n" + |
3563 |
" ^^^\n" + |
3564 |
"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" + |
3565 |
"----------\n" + |
3566 |
"4. ERROR in X.java (at line 7)\n" + |
3567 |
" new X().<B>foo();\n" + |
3568 |
" ^^^\n" + |
3569 |
"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" + |
3570 |
"----------\n" |
3571 |
); |
3572 |
/* javac 7 |
3573 |
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure |
3574 |
public static <N extends B> N foo() { System.out.print("B"); return null; } |
3575 |
^ |
3576 |
where N,S are type-variables: |
3577 |
N extends B declared in method <N>foo() |
3578 |
S extends A declared in method <S>foo() |
3579 |
X.java:6: method foo in class X cannot be applied to given types |
3580 |
X.<B>foo(); |
3581 |
^ |
3582 |
required: no arguments |
3583 |
found: no arguments |
3584 |
X.java:7: method foo in class X cannot be applied to given types |
3585 |
new X().<B>foo(); |
3586 |
^ |
3587 |
required: no arguments |
3588 |
found: no arguments |
3589 |
3 errors |
3590 |
*/ |
3460 |
} |
3591 |
} |
3461 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754 |
3592 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94754 |
3462 |
public void test050a() { |
3593 |
public void test050a() { |
3463 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
|
|
3464 |
this.runNegativeTest( |
3594 |
this.runNegativeTest( |
3465 |
new String[] { |
3595 |
new String[] { |
3466 |
"X.java", |
3596 |
"X.java", |
3467 |
"public class X {\n" + |
3597 |
"public class X {\n" + |
3468 |
" public static <S extends A> void foo() { System.out.print(\"A\"); }\n" + |
3598 |
" public static <S extends A> void foo() { System.out.print(\"A\"); }\n" + |
3469 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
3599 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
3470 |
" static void test () {\n" + |
3600 |
" static void test () {\n" + |
3471 |
" X.foo();\n" + |
3601 |
" X.foo();\n" + |
3472 |
" foo();\n" + |
3602 |
" foo();\n" + |
3473 |
" }\n" + |
3603 |
" }\n" + |
3474 |
"}\n" + |
3604 |
"}\n" + |
3475 |
"class A {}\n" + |
3605 |
"class A {}\n" + |
3476 |
"class B {}\n" |
3606 |
"class B {}" |
3477 |
}, |
3607 |
}, |
3478 |
"----------\n" + |
3608 |
"----------\n" + |
3479 |
"1. ERROR in X.java (at line 5)\r\n" + |
3609 |
"1. ERROR in X.java (at line 2)\n" + |
3480 |
" X.foo();\r\n" + |
3610 |
" public static <S extends A> void foo() { System.out.print(\"A\"); }\n" + |
3481 |
" ^^^\n" + |
3611 |
" ^^^^^\n" + |
3482 |
"The method foo() is ambiguous for the type X\n" + |
3612 |
"Duplicate method foo() in type X\n" + |
3483 |
"----------\n" + |
3613 |
"----------\n" + |
3484 |
"2. ERROR in X.java (at line 6)\r\n" + |
3614 |
"2. ERROR in X.java (at line 3)\n" + |
3485 |
" foo();\r\n" + |
3615 |
" public static <N extends B> N foo() { System.out.print(\"B\"); return null; }\n" + |
3486 |
" ^^^\n" + |
3616 |
" ^^^^^\n" + |
3487 |
"The method foo() is ambiguous for the type X\n" + |
3617 |
"Duplicate method foo() in type X\n" + |
3488 |
"----------\n" |
3618 |
"----------\n" |
3489 |
// both references are ambiguous |
|
|
3490 |
); |
3619 |
); |
|
|
3620 |
/* javac 7 |
3621 |
X.java:3: name clash: <N>foo() and <S>foo() have the same erasure |
3622 |
public static <N extends B> N foo() { System.out.print("B"); return null; } |
3623 |
^ |
3624 |
where N,S are type-variables: |
3625 |
N extends B declared in method <N>foo() |
3626 |
S extends A declared in method <S>foo() |
3627 |
1 error |
3628 |
*/ |
3491 |
} |
3629 |
} |
3492 |
|
3630 |
|
3493 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
3631 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
3494 |
public void test050b() { |
3632 |
public void test050b() { |
3495 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
|
|
3496 |
this.runNegativeTest( |
3633 |
this.runNegativeTest( |
3497 |
new String[] { |
3634 |
new String[] { |
3498 |
"X.java", |
3635 |
"X.java", |
Lines 3502-3509
Link Here
|
3502 |
" Z foo(Object o) { return null; } // duplicate\n" + |
3639 |
" Z foo(Object o) { return null; } // duplicate\n" + |
3503 |
" }\n" + |
3640 |
" }\n" + |
3504 |
" class C2 {\n" + |
3641 |
" class C2 {\n" + |
3505 |
" <T extends Y> T foo(Object o) { return null; } // ok\n" + |
3642 |
" <T extends Y> T foo(Object o) { return null; } // duplicate\n" + |
3506 |
" <T extends Z> T foo(Object o) { return null; } // ok\n" + |
3643 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
3507 |
" }\n" + |
3644 |
" }\n" + |
3508 |
" class C3 {\n" + |
3645 |
" class C3 {\n" + |
3509 |
" A<Y> foo(Object o) { return null; } // duplicate\n" + |
3646 |
" A<Y> foo(Object o) { return null; } // duplicate\n" + |
Lines 3514-3562
Link Here
|
3514 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
3651 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
3515 |
" }\n" + |
3652 |
" }\n" + |
3516 |
"}\n" + |
3653 |
"}\n" + |
3517 |
"class A<T> {}" + |
3654 |
"class A<T> {}\n" + |
3518 |
"class Y {}" + |
3655 |
"class Y {}\n" + |
3519 |
"class Z {}" |
3656 |
"class Z {}" |
3520 |
}, |
3657 |
}, |
3521 |
"----------\n" + |
3658 |
"----------\n" + |
3522 |
"1. ERROR in X.java (at line 3)\n" + |
3659 |
"1. ERROR in X.java (at line 3)\n" + |
3523 |
" Y foo(Object o) { return null; } // duplicate\n" + |
3660 |
" Y foo(Object o) { return null; } // duplicate\n" + |
3524 |
" ^^^^^^^^^^^^^\n" + |
3661 |
" ^^^^^^^^^^^^^\n" + |
3525 |
"Duplicate method foo(Object) in type X.C1\n" + |
3662 |
"Duplicate method foo(Object) in type X.C1\n" + |
3526 |
"----------\n" + |
3663 |
"----------\n" + |
3527 |
"2. ERROR in X.java (at line 4)\n" + |
3664 |
"2. ERROR in X.java (at line 4)\n" + |
3528 |
" Z foo(Object o) { return null; } // duplicate\n" + |
3665 |
" Z foo(Object o) { return null; } // duplicate\n" + |
3529 |
" ^^^^^^^^^^^^^\n" + |
3666 |
" ^^^^^^^^^^^^^\n" + |
3530 |
"Duplicate method foo(Object) in type X.C1\n" + |
3667 |
"Duplicate method foo(Object) in type X.C1\n" + |
3531 |
"----------\n" + |
3668 |
"----------\n" + |
3532 |
"3. ERROR in X.java (at line 11)\n" + |
3669 |
"3. ERROR in X.java (at line 7)\n" + |
3533 |
" A<Y> foo(Object o) { return null; } // duplicate\n" + |
3670 |
" <T extends Y> T foo(Object o) { return null; } // duplicate\n" + |
3534 |
" ^^^^^^^^^^^^^\n" + |
3671 |
" ^^^^^^^^^^^^^\n" + |
3535 |
"Duplicate method foo(Object) in type X.C3\n" + |
3672 |
"Duplicate method foo(Object) in type X.C2\n" + |
3536 |
"----------\n" + |
3673 |
"----------\n" + |
3537 |
"4. ERROR in X.java (at line 12)\n" + |
3674 |
"4. ERROR in X.java (at line 8)\n" + |
3538 |
" A<Z> foo(Object o) { return null; } // duplicate\n" + |
3675 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
3539 |
" ^^^^^^^^^^^^^\n" + |
3676 |
" ^^^^^^^^^^^^^\n" + |
3540 |
"Duplicate method foo(Object) in type X.C3\n" + |
3677 |
"Duplicate method foo(Object) in type X.C2\n" + |
3541 |
"----------\n" + |
3678 |
"----------\n" + |
3542 |
"5. ERROR in X.java (at line 15)\n" + |
3679 |
"5. ERROR in X.java (at line 11)\n" + |
3543 |
" Y foo(Object o) { return null; } // duplicate\n" + |
3680 |
" A<Y> foo(Object o) { return null; } // duplicate\n" + |
3544 |
" ^^^^^^^^^^^^^\n" + |
3681 |
" ^^^^^^^^^^^^^\n" + |
3545 |
"Duplicate method foo(Object) in type X.C4\n" + |
3682 |
"Duplicate method foo(Object) in type X.C3\n" + |
3546 |
"----------\n" + |
3683 |
"----------\n" + |
3547 |
"6. ERROR in X.java (at line 16)\n" + |
3684 |
"6. ERROR in X.java (at line 12)\n" + |
3548 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
3685 |
" A<Z> foo(Object o) { return null; } // duplicate\n" + |
3549 |
" ^^^^^^^^^^^^^\n" + |
3686 |
" ^^^^^^^^^^^^^\n" + |
3550 |
"Duplicate method foo(Object) in type X.C4\n" + |
3687 |
"Duplicate method foo(Object) in type X.C3\n" + |
3551 |
"----------\n" |
3688 |
"----------\n" + |
3552 |
// foo(java.lang.Object) is already defined in X.C1 |
3689 |
"7. ERROR in X.java (at line 15)\n" + |
3553 |
// foo(java.lang.Object) is already defined in X.C3 |
3690 |
" Y foo(Object o) { return null; } // duplicate\n" + |
3554 |
// foo(java.lang.Object) is already defined in X.C4 |
3691 |
" ^^^^^^^^^^^^^\n" + |
|
|
3692 |
"Duplicate method foo(Object) in type X.C4\n" + |
3693 |
"----------\n" + |
3694 |
"8. ERROR in X.java (at line 16)\n" + |
3695 |
" <T extends Z> T foo(Object o) { return null; } // duplicate\n" + |
3696 |
" ^^^^^^^^^^^^^\n" + |
3697 |
"Duplicate method foo(Object) in type X.C4\n" + |
3698 |
"----------\n" |
3555 |
); |
3699 |
); |
|
|
3700 |
/* javac 7 |
3701 |
X.java:4: foo(Object) is already defined in X.C1 |
3702 |
Z foo(Object o) { return null; } // duplicate |
3703 |
^ |
3704 |
X.java:8: name clash: <T#1>foo(Object) and <T#2>foo(Object) have the same erasure |
3705 |
<T extends Z> T foo(Object o) { return null; } // duplicate |
3706 |
^ |
3707 |
where T#1,T#2 are type-variables: |
3708 |
T#1 extends Z declared in method <T#1>foo(Object) |
3709 |
T#2 extends Y declared in method <T#2>foo(Object) |
3710 |
X.java:12: foo(Object) is already defined in X.C3 |
3711 |
A<Z> foo(Object o) { return null; } // duplicate |
3712 |
^ |
3713 |
X.java:16: foo(Object) is already defined in X.C4 |
3714 |
<T extends Z> T foo(Object o) { return null; } // duplicate |
3715 |
^ |
3716 |
4 errors |
3717 |
*/ |
3556 |
} |
3718 |
} |
3557 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
3719 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
3558 |
public void test050c() { |
3720 |
public void test050c() { |
3559 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
|
|
3560 |
this.runNegativeTest( |
3721 |
this.runNegativeTest( |
3561 |
new String[] { |
3722 |
new String[] { |
3562 |
"X.java", |
3723 |
"X.java", |
Lines 3570-3597
Link Here
|
3570 |
" <T extends Z> T foo(A<Z> o) { return null; } // ok\n" + |
3731 |
" <T extends Z> T foo(A<Z> o) { return null; } // ok\n" + |
3571 |
" }\n" + |
3732 |
" }\n" + |
3572 |
"}\n" + |
3733 |
"}\n" + |
3573 |
"class A<T> {}" + |
3734 |
"class A<T> {}\n" + |
3574 |
"class Y {}" + |
3735 |
"class Y {}\n" + |
3575 |
"class Z {}" |
3736 |
"class Z {}" |
3576 |
}, |
3737 |
}, |
3577 |
"----------\n" + |
3738 |
"----------\n" + |
3578 |
"1. ERROR in X.java (at line 3)\n" + |
3739 |
"1. ERROR in X.java (at line 3)\n" + |
3579 |
" A<Y> foo(A<Y> o) { return null; } // duplicate\n" + |
3740 |
" A<Y> foo(A<Y> o) { return null; } // duplicate\n" + |
3580 |
" ^^^^^^^^^^^\n" + |
3741 |
" ^^^^^^^^^^^\n" + |
3581 |
"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + |
3742 |
"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C5\n" + |
3582 |
"----------\n" + |
3743 |
"----------\n" + |
3583 |
"2. ERROR in X.java (at line 4)\n" + |
3744 |
"2. ERROR in X.java (at line 4)\n" + |
3584 |
" A<Z> foo(A<Z> o) { return null; } // duplicate\n" + |
3745 |
" A<Z> foo(A<Z> o) { return null; } // duplicate\n" + |
3585 |
" ^^^^^^^^^^^\n" + |
3746 |
" ^^^^^^^^^^^\n" + |
3586 |
"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + |
3747 |
"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C5\n" + |
3587 |
"----------\n" |
3748 |
"----------\n" + |
3588 |
// name clash: foo(A<Y>) and foo(A<Z>) have the same erasure |
3749 |
"3. ERROR in X.java (at line 7)\n" + |
3589 |
); |
3750 |
" <T extends Y> T foo(A<Y> o) { return null; } // ok\n" + |
|
|
3751 |
" ^^^^^^^^^^^\n" + |
3752 |
"Method foo(A<Y>) has the same erasure foo(A<T>) as another method in type X.C6\n" + |
3753 |
"----------\n" + |
3754 |
"4. ERROR in X.java (at line 8)\n" + |
3755 |
" <T extends Z> T foo(A<Z> o) { return null; } // ok\n" + |
3756 |
" ^^^^^^^^^^^\n" + |
3757 |
"Method foo(A<Z>) has the same erasure foo(A<T>) as another method in type X.C6\n" + |
3758 |
"----------\n" |
3759 |
); |
3760 |
/* javac 7 |
3761 |
X.java:4: name clash: foo(A<Z>) and foo(A<Y>) have the same erasure |
3762 |
A<Z> foo(A<Z> o) { return null; } // duplicate |
3763 |
^ |
3764 |
X.java:8: name clash: <T#1>foo(A<Z>) and <T#2>foo(A<Y>) have the same erasure |
3765 |
<T extends Z> T foo(A<Z> o) { return null; } // ok |
3766 |
^ |
3767 |
where T#1,T#2 are type-variables: |
3768 |
T#1 extends Z declared in method <T#1>foo(A<Z>) |
3769 |
T#2 extends Y declared in method <T#2>foo(A<Y>) |
3770 |
2 errors |
3771 |
*/ |
3590 |
} |
3772 |
} |
3591 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
3773 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 - variation |
3592 |
public void test050d() { |
3774 |
public void test050d() { |
3593 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
3775 |
this.runNegativeTest( |
3594 |
this.runConformTest( |
|
|
3595 |
new String[] { |
3776 |
new String[] { |
3596 |
"X.java", |
3777 |
"X.java", |
3597 |
"public class X {\n" + |
3778 |
"public class X {\n" + |
Lines 3600-3617
Link Here
|
3600 |
" <T extends Z> T foo(Object o) { return null; } // ok\n" + |
3781 |
" <T extends Z> T foo(Object o) { return null; } // ok\n" + |
3601 |
" }\n" + |
3782 |
" }\n" + |
3602 |
"}\n" + |
3783 |
"}\n" + |
3603 |
"class A<T> {}" + |
3784 |
"class A<T> {}\n" + |
3604 |
"class Y {}" + |
3785 |
"class Y {}\n" + |
3605 |
"class Z {}" |
3786 |
"class Z {}" |
3606 |
}, |
3787 |
}, |
3607 |
"" |
3788 |
"----------\n" + |
|
|
3789 |
"1. ERROR in X.java (at line 3)\n" + |
3790 |
" <T extends Y, U> T foo(Object o) { return null; } // ok\n" + |
3791 |
" ^^^^^^^^^^^^^\n" + |
3792 |
"Duplicate method foo(Object) in type X.C7\n" + |
3793 |
"----------\n" + |
3794 |
"2. ERROR in X.java (at line 4)\n" + |
3795 |
" <T extends Z> T foo(Object o) { return null; } // ok\n" + |
3796 |
" ^^^^^^^^^^^^^\n" + |
3797 |
"Duplicate method foo(Object) in type X.C7\n" + |
3798 |
"----------\n" |
3608 |
); |
3799 |
); |
|
|
3800 |
/* javac 7 |
3801 |
X.java:4: name clash: <T#1>foo(Object) and <T#2,U>foo(Object) have the same erasure |
3802 |
<T extends Z> T foo(Object o) { return null; } // ok |
3803 |
^ |
3804 |
where T#1,T#2,U are type-variables: |
3805 |
T#1 extends Z declared in method <T#1>foo(Object) |
3806 |
T#2 extends Y declared in method <T#2,U>foo(Object) |
3807 |
U extends Object declared in method <T#2,U>foo(Object) |
3808 |
1 error |
3809 |
*/ |
3609 |
} |
3810 |
} |
3610 |
|
3811 |
|
3611 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3812 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3612 |
public void test050e() { |
3813 |
public void test050e() { |
3613 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
3814 |
this.runNegativeTest( |
3614 |
this.runConformTest( |
|
|
3615 |
new String[] { |
3815 |
new String[] { |
3616 |
"X.java", |
3816 |
"X.java", |
3617 |
"public class X {\n" + |
3817 |
"public class X {\n" + |
Lines 3625-3632
Link Here
|
3625 |
"class A<T> {}\n" + |
3825 |
"class A<T> {}\n" + |
3626 |
"class B {}\n" |
3826 |
"class B {}\n" |
3627 |
}, |
3827 |
}, |
3628 |
"" |
3828 |
"----------\n" + |
3629 |
); |
3829 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
3830 |
" <N extends B> N a(A<String> s) { return null; }\n" + |
3831 |
" ^^^^^^^^^^^^^^\n" + |
3832 |
"Method a(A<String>) has the same erasure a(A<T>) as another method in type X\n" + |
3833 |
"----------\n" + |
3834 |
"2. ERROR in X.java (at line 3)\n" + |
3835 |
" <N> Object a(A<Number> n) { return null; }\n" + |
3836 |
" ^^^^^^^^^^^^^^\n" + |
3837 |
"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + |
3838 |
"----------\n" + |
3839 |
"3. ERROR in X.java (at line 4)\n" + |
3840 |
" <N extends B> void b(A<String> s) {}\n" + |
3841 |
" ^^^^^^^^^^^^^^\n" + |
3842 |
"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + |
3843 |
"----------\n" + |
3844 |
"4. ERROR in X.java (at line 5)\n" + |
3845 |
" <N extends B> B b(A<Number> n) { return null; }\n" + |
3846 |
" ^^^^^^^^^^^^^^\n" + |
3847 |
"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + |
3848 |
"----------\n" + |
3849 |
"5. ERROR in X.java (at line 6)\n" + |
3850 |
" void c(A<String> s) {}\n" + |
3851 |
" ^^^^^^^^^^^^^^\n" + |
3852 |
"Method c(A<String>) has the same erasure c(A<T>) as another method in type X\n" + |
3853 |
"----------\n" + |
3854 |
"6. ERROR in X.java (at line 7)\n" + |
3855 |
" B c(A<Number> n) { return null; }\n" + |
3856 |
" ^^^^^^^^^^^^^^\n" + |
3857 |
"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + |
3858 |
"----------\n" |
3859 |
); |
3860 |
/* javac 7 |
3861 |
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<String>) have the same erasure |
3862 |
<N> Object a(A<Number> n) { return null; } |
3863 |
^ |
3864 |
where N#1,N#2 are type-variables: |
3865 |
N#1 extends Object declared in method <N#1>a(A<Number>) |
3866 |
N#2 extends B declared in method <N#2>a(A<String>) |
3867 |
X.java:5: name clash: <N#1>b(A<Number>) and <N#2>b(A<String>) have the same erasure |
3868 |
<N extends B> B b(A<Number> n) { return null; } |
3869 |
^ |
3870 |
where N#1,N#2 are type-variables: |
3871 |
N#1 extends B declared in method <N#1>b(A<Number>) |
3872 |
N#2 extends B declared in method <N#2>b(A<String>) |
3873 |
X.java:7: name clash: c(A<Number>) and c(A<String>) have the same erasure |
3874 |
B c(A<Number> n) { return null; } |
3875 |
^ |
3876 |
3 errors |
3877 |
*/ |
3630 |
} |
3878 |
} |
3631 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3879 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3632 |
public void test050f() { |
3880 |
public void test050f() { |
Lines 3651-3658
Link Here
|
3651 |
" ^^^^^^^^^^^^^^\n" + |
3899 |
" ^^^^^^^^^^^^^^\n" + |
3652 |
"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + |
3900 |
"Method a(A<Number>) has the same erasure a(A<T>) as another method in type X\n" + |
3653 |
"----------\n" |
3901 |
"----------\n" |
3654 |
// name clash: <N>a(A<java.lang.String>) and <N>a(A<java.lang.Number>) have the same erasure |
|
|
3655 |
); |
3902 |
); |
|
|
3903 |
/* javac 7 |
3904 |
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<String>) have the same erasure |
3905 |
<N> B a(A<Number> n) { return null; } |
3906 |
^ |
3907 |
where N#1,N#2 are type-variables: |
3908 |
N#1 extends Object declared in method <N#1>a(A<Number>) |
3909 |
N#2 extends B declared in method <N#2>a(A<String>) |
3910 |
1 error |
3911 |
*/ |
3656 |
} |
3912 |
} |
3657 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3913 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3658 |
public void test050g() { |
3914 |
public void test050g() { |
Lines 3677-3684
Link Here
|
3677 |
" ^^^^^^^^^^^^^^\n" + |
3933 |
" ^^^^^^^^^^^^^^\n" + |
3678 |
"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + |
3934 |
"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + |
3679 |
"----------\n" |
3935 |
"----------\n" |
3680 |
// name clash: <N>b(A<java.lang.String>) and <N>b(A<java.lang.Number>) have the same erasure |
|
|
3681 |
); |
3936 |
); |
|
|
3937 |
/* javac 7 |
3938 |
X.java:3: name clash: <N#1>b(A<Number>) and <N#2>b(A<String>) have the same erasure |
3939 |
<N extends B> B b(A<Number> n) { return null; } |
3940 |
^ |
3941 |
where N#1,N#2 are type-variables: |
3942 |
N#1 extends B declared in method <N#1>b(A<Number>) |
3943 |
N#2 extends B declared in method <N#2>b(A<String>) |
3944 |
1 error |
3945 |
*/ |
3682 |
} |
3946 |
} |
3683 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3947 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3684 |
public void test050h() { |
3948 |
public void test050h() { |
Lines 3703-3716
Link Here
|
3703 |
" ^^^^^^^^^^^^^^\n" + |
3967 |
" ^^^^^^^^^^^^^^\n" + |
3704 |
"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + |
3968 |
"Method c(A<Number>) has the same erasure c(A<T>) as another method in type X\n" + |
3705 |
"----------\n" |
3969 |
"----------\n" |
3706 |
// name clash: c(A<java.lang.String>) and c(A<java.lang.Number>) have the same erasure |
|
|
3707 |
); |
3970 |
); |
|
|
3971 |
/* javac 7 |
3972 |
X.java:3: name clash: c(A<Number>) and c(A<String>) have the same erasure |
3973 |
B c(A<Number> n) { return null; } |
3974 |
^ |
3975 |
1 error |
3976 |
*/ |
3708 |
} |
3977 |
} |
3709 |
|
3978 |
|
3710 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3979 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3711 |
public void test050i() { |
3980 |
public void test050i() { |
3712 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
3981 |
this.runNegativeTest( |
3713 |
this.runConformTest( |
|
|
3714 |
new String[] { |
3982 |
new String[] { |
3715 |
"X.java", |
3983 |
"X.java", |
3716 |
"public class X {\n" + |
3984 |
"public class X {\n" + |
Lines 3722-3729
Link Here
|
3722 |
"class A<T> {}\n" + |
3990 |
"class A<T> {}\n" + |
3723 |
"class B {}\n" |
3991 |
"class B {}\n" |
3724 |
}, |
3992 |
}, |
3725 |
"" |
3993 |
"----------\n" + |
3726 |
); |
3994 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
3995 |
" <N extends B> N a(A<Number> s) { return null; }\n" + |
3996 |
" ^^^^^^^^^^^^^^\n" + |
3997 |
"Duplicate method a(A<Number>) in type X\n" + |
3998 |
"----------\n" + |
3999 |
"2. ERROR in X.java (at line 3)\n" + |
4000 |
" <N> Object a(A<Number> n) { return null; }\n" + |
4001 |
" ^^^^^^^^^^^^^^\n" + |
4002 |
"Duplicate method a(A<Number>) in type X\n" + |
4003 |
"----------\n" + |
4004 |
"3. ERROR in X.java (at line 4)\n" + |
4005 |
" <N extends B> N b(A<Number> s) { return null; }\n" + |
4006 |
" ^^^^^^^^^^^^^^\n" + |
4007 |
"Method b(A<Number>) has the same erasure b(A<T>) as another method in type X\n" + |
4008 |
"----------\n" + |
4009 |
"4. ERROR in X.java (at line 5)\n" + |
4010 |
" <N> Object b(A<String> n) { return null; }\n" + |
4011 |
" ^^^^^^^^^^^^^^\n" + |
4012 |
"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + |
4013 |
"----------\n" |
4014 |
); |
4015 |
/* javac 7 |
4016 |
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<Number>) have the same erasure |
4017 |
<N> Object a(A<Number> n) { return null; } |
4018 |
^ |
4019 |
where N#1,N#2 are type-variables: |
4020 |
N#1 extends Object declared in method <N#1>a(A<Number>) |
4021 |
N#2 extends B declared in method <N#2>a(A<Number>) |
4022 |
X.java:5: name clash: <N#1>b(A<String>) and <N#2>b(A<Number>) have the same erasure |
4023 |
<N> Object b(A<String> n) { return null; } |
4024 |
^ |
4025 |
where N#1,N#2 are type-variables: |
4026 |
N#1 extends Object declared in method <N#1>b(A<String>) |
4027 |
N#2 extends B declared in method <N#2>b(A<Number>) |
4028 |
2 errors |
4029 |
*/ |
3727 |
} |
4030 |
} |
3728 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
4031 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3729 |
public void test050j() { |
4032 |
public void test050j() { |
Lines 3760-3768
Link Here
|
3760 |
" ^^^^^^^^^^^^^^\n" + |
4063 |
" ^^^^^^^^^^^^^^\n" + |
3761 |
"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + |
4064 |
"Method b(A<String>) has the same erasure b(A<T>) as another method in type X\n" + |
3762 |
"----------\n" |
4065 |
"----------\n" |
3763 |
// name clash: <N>a(A<java.lang.Number>) and <N>a(A<java.lang.Number>) have the same erasure |
|
|
3764 |
// name clash: <N>b(A<java.lang.Number>) and <N>b(A<java.lang.String>) have the same erasure |
3765 |
); |
4066 |
); |
|
|
4067 |
/* javac 7 |
4068 |
X.java:3: name clash: <N#1>a(A<Number>) and <N#2>a(A<Number>) have the same erasure |
4069 |
<N> B a(A<Number> n) { return null; } |
4070 |
^ |
4071 |
where N#1,N#2 are type-variables: |
4072 |
N#1 extends Object declared in method <N#1>a(A<Number>) |
4073 |
N#2 extends B declared in method <N#2>a(A<Number>) |
4074 |
X.java:5: name clash: <N#1>b(A<String>) and <N#2>b(A<Number>) have the same erasure |
4075 |
<N> B b(A<String> n) { return null; } |
4076 |
^ |
4077 |
where N#1,N#2 are type-variables: |
4078 |
N#1 extends Object declared in method <N#1>b(A<String>) |
4079 |
N#2 extends B declared in method <N#2>b(A<Number>) |
4080 |
2 errors |
4081 |
*/ |
3766 |
} |
4082 |
} |
3767 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
4083 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3768 |
public void test050k() { |
4084 |
public void test050k() { |
Lines 3799-3807
Link Here
|
3799 |
" ^^^^^^^^^^^^^^\n" + |
4115 |
" ^^^^^^^^^^^^^^\n" + |
3800 |
"Duplicate method b(A<Number>) in type X\n" + |
4116 |
"Duplicate method b(A<Number>) in type X\n" + |
3801 |
"----------\n" |
4117 |
"----------\n" |
3802 |
// <N>a(A<java.lang.Number>) is already defined in X |
|
|
3803 |
// <N>b(A<java.lang.Number>) is already defined in X |
3804 |
); |
4118 |
); |
|
|
4119 |
/* javac 7 |
4120 |
X.java:3: <N>a(A<Number>) is already defined in X |
4121 |
<N extends B> B a(A<Number> n) { return null; } |
4122 |
^ |
4123 |
where N is a type-variable: |
4124 |
N extends B declared in method <N>a(A<Number>) |
4125 |
X.java:5: <N>b(A<Number>) is already defined in X |
4126 |
<N extends B> B b(A<Number> n) { return null; } |
4127 |
^ |
4128 |
where N is a type-variable: |
4129 |
N extends B declared in method <N>b(A<Number>) |
4130 |
2 errors |
4131 |
*/ |
3805 |
} |
4132 |
} |
3806 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
4133 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=90423 |
3807 |
public void test050l() { |
4134 |
public void test050l() { |
Lines 3838-3846
Link Here
|
3838 |
" ^^^^^^^^^^^^^^\n" + |
4165 |
" ^^^^^^^^^^^^^^\n" + |
3839 |
"Duplicate method b(A<Number>) in type X\n" + |
4166 |
"Duplicate method b(A<Number>) in type X\n" + |
3840 |
"----------\n" |
4167 |
"----------\n" |
3841 |
// a(A<java.lang.Number>) is already defined in X |
|
|
3842 |
// b(A<java.lang.Number>) is already defined in X |
3843 |
); |
4168 |
); |
|
|
4169 |
/* javac 7 |
4170 |
X.java:3: a(A<Number>) is already defined in X |
4171 |
B a(A<Number> n) { return null; } |
4172 |
^ |
4173 |
X.java:5: b(A<Number>) is already defined in X |
4174 |
B b(A<Number> n) { return null; } |
4175 |
^ |
4176 |
2 errors |
4177 |
*/ |
3844 |
} |
4178 |
} |
3845 |
|
4179 |
|
3846 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 |
4180 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 |
Lines 3861-3868
Link Here
|
3861 |
" ^\n" + |
4195 |
" ^\n" + |
3862 |
"The type X must implement the inherited abstract method I.foo(T)\n" + |
4196 |
"The type X must implement the inherited abstract method I.foo(T)\n" + |
3863 |
"----------\n" |
4197 |
"----------\n" |
3864 |
// X is not abstract and does not override abstract method <T>foo(T) in I |
|
|
3865 |
); |
4198 |
); |
|
|
4199 |
/* javac 7 |
4200 |
X.java:1: X is not abstract and does not override abstract method <T>foo(T) in I |
4201 |
class X implements I { |
4202 |
^ |
4203 |
where T is a type-variable: |
4204 |
T extends Object declared in method <T>foo(T) |
4205 |
1 error |
4206 |
*/ |
3866 |
} |
4207 |
} |
3867 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 |
4208 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 |
3868 |
public void test051a() { |
4209 |
public void test051a() { |
Lines 3886-3898
Link Here
|
3886 |
" ^^^^^^^^^^^^^^^^^\n" + |
4227 |
" ^^^^^^^^^^^^^^^^^\n" + |
3887 |
"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + |
4228 |
"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + |
3888 |
"----------\n" |
4229 |
"----------\n" |
3889 |
// name clash: foo(A<java.lang.String>) and foo(A<java.lang.Integer>) have the same erasure |
|
|
3890 |
); |
4230 |
); |
|
|
4231 |
/* javac 7 |
4232 |
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure |
4233 |
void foo(A<Integer> a) {} |
4234 |
^ |
4235 |
1 error |
4236 |
*/ |
3891 |
} |
4237 |
} |
3892 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 |
4238 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=89470 |
3893 |
public void test051b() { |
4239 |
public void test051b() { |
3894 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
4240 |
this.runNegativeTest( |
3895 |
this.runConformTest( |
|
|
3896 |
new String[] { |
4241 |
new String[] { |
3897 |
"X.java", |
4242 |
"X.java", |
3898 |
"public class X {\n" + |
4243 |
"public class X {\n" + |
Lines 3901-3908
Link Here
|
3901 |
"}\n" + |
4246 |
"}\n" + |
3902 |
"class A<T> {}\n", |
4247 |
"class A<T> {}\n", |
3903 |
}, |
4248 |
}, |
3904 |
"" |
4249 |
"----------\n" + |
|
|
4250 |
"1. ERROR in X.java (at line 2)\n" + |
4251 |
" void foo(A<String> a) {}\n" + |
4252 |
" ^^^^^^^^^^^^^^^^\n" + |
4253 |
"Method foo(A<String>) has the same erasure foo(A<T>) as another method in type X\n" + |
4254 |
"----------\n" + |
4255 |
"2. ERROR in X.java (at line 3)\n" + |
4256 |
" Object foo(A<Integer> a) { return null; }\n" + |
4257 |
" ^^^^^^^^^^^^^^^^^\n" + |
4258 |
"Method foo(A<Integer>) has the same erasure foo(A<T>) as another method in type X\n" + |
4259 |
"----------\n" |
3905 |
); |
4260 |
); |
|
|
4261 |
/* javac 7 |
4262 |
X.java:3: name clash: foo(A<Integer>) and foo(A<String>) have the same erasure |
4263 |
Object foo(A<Integer> a) { return null; } |
4264 |
^ |
4265 |
1 error |
4266 |
*/ |
3906 |
} |
4267 |
} |
3907 |
|
4268 |
|
3908 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=91728 |
4269 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=91728 |
Lines 4037-4048
Link Here
|
4037 |
" ^^^^^^\n" + |
4398 |
" ^^^^^^\n" + |
4038 |
"Method a(T) has the same erasure a(Object) as another method in type X\n" + |
4399 |
"Method a(T) has the same erasure a(Object) as another method in type X\n" + |
4039 |
"----------\n" |
4400 |
"----------\n" |
4040 |
// a(X) is already defined in X |
|
|
4041 |
); |
4401 |
); |
|
|
4402 |
/* javac 7 |
4403 |
X.java:3: a(Object) is already defined in X |
4404 |
<T> T a(T x) { return null; } |
4405 |
^ |
4406 |
1 error |
4407 |
*/ |
4042 |
} |
4408 |
} |
4043 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4409 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4044 |
public void test054a() { |
4410 |
public void test054a() { |
4045 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
|
|
4046 |
this.runNegativeTest( |
4411 |
this.runNegativeTest( |
4047 |
new String[] { |
4412 |
new String[] { |
4048 |
"X.java", |
4413 |
"X.java", |
Lines 4053-4081
Link Here
|
4053 |
" <T extends X> T aa(T x) { return null; }\n" + |
4418 |
" <T extends X> T aa(T x) { return null; }\n" + |
4054 |
" String a(X x) { return null; }\n" + // dup |
4419 |
" String a(X x) { return null; }\n" + // dup |
4055 |
" <T extends X> T a(T x) { return null; }\n" + |
4420 |
" <T extends X> T a(T x) { return null; }\n" + |
4056 |
|
|
|
4057 |
" <T> String z(X x) { return null; }\n" + |
4421 |
" <T> String z(X x) { return null; }\n" + |
4058 |
" <T, S> Object z(X x) { return null; }\n" + |
4422 |
" <T, S> Object z(X x) { return null; }\n" + |
4059 |
"}\n" |
4423 |
"}\n" |
4060 |
}, |
4424 |
}, |
4061 |
"----------\n" + |
4425 |
"----------\n" + |
4062 |
"1. ERROR in X.java (at line 6)\n" + |
4426 |
"1. ERROR in X.java (at line 2)\n" + |
4063 |
" String a(X x) { return null; }\n" + |
4427 |
" <T1, T2> String aaa(X x) { return null; }\n" + |
4064 |
" ^^^^^^\n" + |
4428 |
" ^^^^^^^^\n" + |
4065 |
"Method a(X) has the same erasure a(X) as another method in type X\n" + |
4429 |
"Method aaa(X) has the same erasure aaa(X) as another method in type X\n" + |
4066 |
"----------\n" + |
4430 |
"----------\n" + |
4067 |
"2. ERROR in X.java (at line 7)\n" + |
4431 |
"2. ERROR in X.java (at line 3)\n" + |
4068 |
" <T extends X> T a(T x) { return null; }\n" + |
4432 |
" <T extends X> T aaa(T x) { return null; }\n" + |
4069 |
" ^^^^^^\n" + |
4433 |
" ^^^^^^^^\n" + |
4070 |
"Method a(T) has the same erasure a(X) as another method in type X\n" + |
4434 |
"Method aaa(T) has the same erasure aaa(X) as another method in type X\n" + |
4071 |
"----------\n" |
4435 |
"----------\n" + |
4072 |
// a(X) is already defined in X |
4436 |
"3. ERROR in X.java (at line 4)\n" + |
4073 |
); |
4437 |
" <T> String aa(X x) { return null; }\n" + |
|
|
4438 |
" ^^^^^^^\n" + |
4439 |
"Method aa(X) has the same erasure aa(X) as another method in type X\n" + |
4440 |
"----------\n" + |
4441 |
"4. ERROR in X.java (at line 5)\n" + |
4442 |
" <T extends X> T aa(T x) { return null; }\n" + |
4443 |
" ^^^^^^^\n" + |
4444 |
"Method aa(T) has the same erasure aa(X) as another method in type X\n" + |
4445 |
"----------\n" + |
4446 |
"5. ERROR in X.java (at line 6)\n" + |
4447 |
" String a(X x) { return null; }\n" + |
4448 |
" ^^^^^^\n" + |
4449 |
"Method a(X) has the same erasure a(X) as another method in type X\n" + |
4450 |
"----------\n" + |
4451 |
"6. ERROR in X.java (at line 7)\n" + |
4452 |
" <T extends X> T a(T x) { return null; }\n" + |
4453 |
" ^^^^^^\n" + |
4454 |
"Method a(T) has the same erasure a(X) as another method in type X\n" + |
4455 |
"----------\n" + |
4456 |
"7. ERROR in X.java (at line 8)\n" + |
4457 |
" <T> String z(X x) { return null; }\n" + |
4458 |
" ^^^^^^\n" + |
4459 |
"Duplicate method z(X) in type X\n" + |
4460 |
"----------\n" + |
4461 |
"8. ERROR in X.java (at line 9)\n" + |
4462 |
" <T, S> Object z(X x) { return null; }\n" + |
4463 |
" ^^^^^^\n" + |
4464 |
"Duplicate method z(X) in type X\n" + |
4465 |
"----------\n" |
4466 |
); |
4467 |
/* javac 7 |
4468 |
X.java:3: name clash: <T>aaa(T) and <T1,T2>aaa(X) have the same erasure |
4469 |
<T extends X> T aaa(T x) { return null; } |
4470 |
^ |
4471 |
where T,T1,T2 are type-variables: |
4472 |
T extends X declared in method <T>aaa(T) |
4473 |
T1 extends Object declared in method <T1,T2>aaa(X) |
4474 |
T2 extends Object declared in method <T1,T2>aaa(X) |
4475 |
X.java:5: name clash: <T#1>aa(T#1) and <T#2>aa(X) have the same erasure |
4476 |
<T extends X> T aa(T x) { return null; } |
4477 |
^ |
4478 |
where T#1,T#2 are type-variables: |
4479 |
T#1 extends X declared in method <T#1>aa(T#1) |
4480 |
T#2 extends Object declared in method <T#2>aa(X) |
4481 |
X.java:7: a(X) is already defined in X |
4482 |
<T extends X> T a(T x) { return null; } |
4483 |
^ |
4484 |
X.java:9: name clash: <T#1,S>z(X) and <T#3>z(X) have the same erasure |
4485 |
<T, S> Object z(X x) { return null; } |
4486 |
^ |
4487 |
where T#1,S,T#3 are type-variables: |
4488 |
T#1 extends Object declared in method <T#1,S>z(X) |
4489 |
S extends Object declared in method <T#1,S>z(X) |
4490 |
T#3 extends Object declared in method <T#3>z(X) |
4491 |
4 errors |
4492 |
*/ |
4074 |
} |
4493 |
} |
4075 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4494 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4076 |
public void test054b() { |
4495 |
public void test054b() { |
4077 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
4496 |
this.runNegativeTest( |
4078 |
this.runConformTest( |
|
|
4079 |
new String[] { |
4497 |
new String[] { |
4080 |
"X.java", |
4498 |
"X.java", |
4081 |
"public class X<T> {\n" + |
4499 |
"public class X<T> {\n" + |
Lines 4083-4090
Link Here
|
4083 |
" <S> String foo(X<T> s) { return null; }\n" + |
4501 |
" <S> String foo(X<T> s) { return null; }\n" + |
4084 |
"}\n" |
4502 |
"}\n" |
4085 |
}, |
4503 |
}, |
4086 |
"" |
4504 |
"----------\n" + |
|
|
4505 |
"1. ERROR in X.java (at line 2)\n" + |
4506 |
" Object foo(X<T> t) { return null; }\n" + |
4507 |
" ^^^^^^^^^^^\n" + |
4508 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
4509 |
"----------\n" + |
4510 |
"2. ERROR in X.java (at line 3)\n" + |
4511 |
" <S> String foo(X<T> s) { return null; }\n" + |
4512 |
" ^^^^^^^^^^^\n" + |
4513 |
"Duplicate method foo(X<T>) in type X<T>\n" + |
4514 |
"----------\n" |
4087 |
); |
4515 |
); |
|
|
4516 |
/* javac 7 |
4517 |
X.java:3: name clash: <S>foo(X<T>) and foo(X<T>) have the same erasure |
4518 |
<S> String foo(X<T> s) { return null; } |
4519 |
^ |
4520 |
where S,T are type-variables: |
4521 |
S extends Object declared in method <S>foo(X<T>) |
4522 |
T extends Object declared in class X |
4523 |
1 error |
4524 |
*/ |
4088 |
} |
4525 |
} |
4089 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4526 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4090 |
public void test054c() { |
4527 |
public void test054c() { |
Lines 4107-4119
Link Here
|
4107 |
" ^^^^^^\n" + |
4544 |
" ^^^^^^\n" + |
4108 |
"Duplicate method dupT() in type X<T>\n" + |
4545 |
"Duplicate method dupT() in type X<T>\n" + |
4109 |
"----------\n" |
4546 |
"----------\n" |
4110 |
// <T1>dupT() is already defined in X |
|
|
4111 |
); |
4547 |
); |
|
|
4548 |
/* javac 7 |
4549 |
X.java:3: <T1>dupT() is already defined in X |
4550 |
<T2 extends X<T2>> Object dupT() {return null;} |
4551 |
^ |
4552 |
where T1 is a type-variable: |
4553 |
T1 extends X<T1> declared in method <T1>dupT() |
4554 |
1 error |
4555 |
*/ |
4112 |
} |
4556 |
} |
4113 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4557 |
// more duplicate tests, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=94897 |
4114 |
public void test054d() { |
4558 |
public void test054d() { |
4115 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
4559 |
this.runNegativeTest( |
4116 |
this.runConformTest( |
|
|
4117 |
new String[] { |
4560 |
new String[] { |
4118 |
"X.java", |
4561 |
"X.java", |
4119 |
"public class X {\n" + |
4562 |
"public class X {\n" + |
Lines 4124-4131
Link Here
|
4124 |
"}\n" + |
4567 |
"}\n" + |
4125 |
"class A<T> {}\n", |
4568 |
"class A<T> {}\n", |
4126 |
}, |
4569 |
}, |
4127 |
"" |
4570 |
"----------\n" + |
4128 |
); |
4571 |
"1. ERROR in X.java (at line 2)\n" + |
|
|
4572 |
" <T> T a(A<T> t) {return null;}\n" + |
4573 |
" ^^^^^^^^^\n" + |
4574 |
"Method a(A<T>) has the same erasure a(A<T>) as another method in type X\n" + |
4575 |
"----------\n" + |
4576 |
"2. ERROR in X.java (at line 3)\n" + |
4577 |
" <T> String a(A<Object> o) {return null;}\n" + |
4578 |
" ^^^^^^^^^^^^^^\n" + |
4579 |
"Method a(A<Object>) has the same erasure a(A<T>) as another method in type X\n" + |
4580 |
"----------\n" + |
4581 |
"3. ERROR in X.java (at line 4)\n" + |
4582 |
" <T> T aa(A<T> t) {return null;}\n" + |
4583 |
" ^^^^^^^^^^\n" + |
4584 |
"Method aa(A<T>) has the same erasure aa(A<T>) as another method in type X\n" + |
4585 |
"----------\n" + |
4586 |
"4. ERROR in X.java (at line 5)\n" + |
4587 |
" String aa(A<Object> o) {return null;}\n" + |
4588 |
" ^^^^^^^^^^^^^^^\n" + |
4589 |
"Method aa(A<Object>) has the same erasure aa(A<T>) as another method in type X\n" + |
4590 |
"----------\n" |
4591 |
); |
4592 |
/* javac 7 |
4593 |
X.java:3: name clash: <T#1>a(A<Object>) and <T#2>a(A<T#2>) have the same erasure |
4594 |
|
4595 |
<T> String a(A<Object> o) {return null;} |
4596 |
^ |
4597 |
where T#1,T#2 are type-variables: |
4598 |
T#1 extends Object declared in method <T#1>a(A<Object>) |
4599 |
T#2 extends Object declared in method <T#2>a(A<T#2>) |
4600 |
X.java:5: name clash: aa(A<Object>) and <T>aa(A<T>) have the same erasure |
4601 |
String aa(A<Object> o) {return null;} |
4602 |
^ |
4603 |
where T is a type-variable: |
4604 |
T extends Object declared in method <T>aa(A<T>) |
4605 |
2 errors |
4606 |
*/ |
4129 |
} |
4607 |
} |
4130 |
|
4608 |
|
4131 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95933 |
4609 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=95933 |
Lines 4233-4278
Link Here
|
4233 |
} |
4711 |
} |
4234 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
4712 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
4235 |
public void test058a() { |
4713 |
public void test058a() { |
4236 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
|
|
4237 |
this.runNegativeTest( |
4714 |
this.runNegativeTest( |
4238 |
new String[] { |
4715 |
new String[] { |
4239 |
"X.java", |
4716 |
"X.java", |
4240 |
"public class X<A> {\n" + |
4717 |
"public class X<A> {\n" + |
4241 |
" void test() {\n" + |
4718 |
" void test() {\n" + |
4242 |
" new X<Object>().foo(\"X\");\n" + |
4719 |
" new X<Object>().foo(\"X\");\n" + |
4243 |
" new X<Object>().foo2(\"X\");\n" + |
4720 |
" new X<Object>().foo2(\"X\");\n" + |
4244 |
" }\n" + |
4721 |
" }\n" + |
4245 |
" <T> T foo(T t) {return null;}\n" + |
4722 |
" <T> T foo(T t) {return null;}\n" + |
4246 |
" void foo(A a) {}\n" + |
4723 |
" void foo(A a) {}\n" + |
4247 |
" <T> T foo2(T t) {return null;}\n" + |
4724 |
" <T> T foo2(T t) {return null;}\n" + |
4248 |
" <T> void foo2(A a) {}\n" + |
4725 |
" <T> void foo2(A a) {}\n" + |
4249 |
"}\n" |
4726 |
"}\n" |
4250 |
}, |
4727 |
}, |
4251 |
"----------\n" + |
4728 |
"----------\n" + |
4252 |
"1. ERROR in X.java (at line 3)\r\n" + |
4729 |
"1. ERROR in X.java (at line 6)\n" + |
4253 |
" new X<Object>().foo(\"X\");\r\n" + |
4730 |
" <T> T foo(T t) {return null;}\n" + |
4254 |
" ^^^\n" + |
4731 |
" ^^^^^^^^\n" + |
4255 |
"The method foo(String) is ambiguous for the type X<Object>\n" + |
4732 |
"Method foo(T) has the same erasure foo(Object) as another method in type X<A>\n" + |
4256 |
"----------\n" + |
4733 |
"----------\n" + |
4257 |
"2. ERROR in X.java (at line 4)\r\n" + |
4734 |
"2. ERROR in X.java (at line 7)\n" + |
4258 |
" new X<Object>().foo2(\"X\");\r\n" + |
4735 |
" void foo(A a) {}\n" + |
4259 |
" ^^^^\n" + |
4736 |
" ^^^^^^^^\n" + |
4260 |
"The method foo2(String) is ambiguous for the type X<Object>\n" + |
4737 |
"Method foo(A) has the same erasure foo(Object) as another method in type X<A>\n" + |
4261 |
"----------\n" |
4738 |
"----------\n" + |
4262 |
// both references are ambiguous |
4739 |
"3. ERROR in X.java (at line 8)\n" + |
4263 |
); |
4740 |
" <T> T foo2(T t) {return null;}\n" + |
|
|
4741 |
" ^^^^^^^^^\n" + |
4742 |
"Method foo2(T) has the same erasure foo2(Object) as another method in type X<A>\n" + |
4743 |
"----------\n" + |
4744 |
"4. ERROR in X.java (at line 9)\n" + |
4745 |
" <T> void foo2(A a) {}\n" + |
4746 |
" ^^^^^^^^^\n" + |
4747 |
"Method foo2(A) has the same erasure foo2(Object) as another method in type X<A>\n" + |
4748 |
"----------\n" |
4749 |
); |
4750 |
/* javac 7 |
4751 |
X.java:7: name clash: foo(A) and <T>foo(T) have the same erasure |
4752 |
void foo(A a) {} |
4753 |
^ |
4754 |
where A,T are type-variables: |
4755 |
A extends Object declared in class X |
4756 |
T extends Object declared in method <T>foo(T) |
4757 |
X.java:9: name clash: <T#1>foo2(A) and <T#3>foo2(T#3) have the same erasure |
4758 |
<T> void foo2(A a) {} |
4759 |
^ |
4760 |
where T#1,A,T#3 are type-variables: |
4761 |
T#1 extends Object declared in method <T#1>foo2(A) |
4762 |
A extends Object declared in class X |
4763 |
T#3 extends Object declared in method <T#3>foo2(T#3) |
4764 |
2 errors |
4765 |
*/ |
4264 |
} |
4766 |
} |
4265 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
4767 |
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=94898 |
4266 |
public void test058b() { |
4768 |
public void test058b() { |
4267 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
|
|
4268 |
this.runNegativeTest( |
4769 |
this.runNegativeTest( |
4269 |
new String[] { |
4770 |
new String[] { |
4270 |
"X.java", |
4771 |
"X.java", |
4271 |
"public class X<A> extends Y<A> {\n" + |
4772 |
"public class X<A> extends Y<A> {\n" + |
4272 |
" void test() {\n" + |
4773 |
" void test() {\n" + |
4273 |
" new X<Object>().foo(\"X\");\n" + |
4774 |
" new X<Object>().foo(\"X\");\n" + |
4274 |
" new X<Object>().foo2(\"X\");\n" + |
4775 |
" new X<Object>().foo2(\"X\");\n" + |
4275 |
" }\n" + |
4776 |
" }\n" + |
4276 |
" <T> T foo(T t) {return null;}\n" + |
4777 |
" <T> T foo(T t) {return null;}\n" + |
4277 |
" <T> T foo2(T t) {return null;}\n" + |
4778 |
" <T> T foo2(T t) {return null;}\n" + |
4278 |
"}\n" + |
4779 |
"}\n" + |
Lines 4282-4299
Link Here
|
4282 |
"}" |
4783 |
"}" |
4283 |
}, |
4784 |
}, |
4284 |
"----------\n" + |
4785 |
"----------\n" + |
4285 |
"1. ERROR in X.java (at line 3)\r\n" + |
4786 |
"1. ERROR in X.java (at line 3)\n" + |
4286 |
" new X<Object>().foo(\"X\");\r\n" + |
4787 |
" new X<Object>().foo(\"X\");\n" + |
4287 |
" ^^^\n" + |
4788 |
" ^^^\n" + |
4288 |
"The method foo(String) is ambiguous for the type X<Object>\n" + |
4789 |
"The method foo(String) is ambiguous for the type X<Object>\n" + |
4289 |
"----------\n" + |
4790 |
"----------\n" + |
4290 |
"2. ERROR in X.java (at line 4)\r\n" + |
4791 |
"2. ERROR in X.java (at line 4)\n" + |
4291 |
" new X<Object>().foo2(\"X\");\r\n" + |
4792 |
" new X<Object>().foo2(\"X\");\n" + |
4292 |
" ^^^^\n" + |
4793 |
" ^^^^\n" + |
4293 |
"The method foo2(String) is ambiguous for the type X<Object>\n" + |
4794 |
"The method foo2(String) is ambiguous for the type X<Object>\n" + |
4294 |
"----------\n" |
4795 |
"----------\n" + |
4295 |
// both references are ambiguous |
4796 |
"3. ERROR in X.java (at line 6)\n" + |
4296 |
); |
4797 |
" <T> T foo(T t) {return null;}\n" + |
|
|
4798 |
" ^^^^^^^^\n" + |
4799 |
"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" + |
4800 |
"----------\n" + |
4801 |
"4. ERROR in X.java (at line 7)\n" + |
4802 |
" <T> T foo2(T t) {return null;}\n" + |
4803 |
" ^^^^^^^^^\n" + |
4804 |
"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" + |
4805 |
"----------\n" |
4806 |
); |
4807 |
/* javac 7 |
4808 |
X.java:3: reference to foo is ambiguous, both method foo(A) in Y and method <T>foo(T) in X match |
4809 |
new X<Object>().foo("X"); |
4810 |
^ |
4811 |
where A,T are type-variables: |
4812 |
A extends Object declared in class Y |
4813 |
T extends Object declared in method <T>foo(T) |
4814 |
X.java:4: reference to foo2 is ambiguous, both method <T#1>foo2(A) in Y and method <T#3>foo2(T#3) in X match |
4815 |
new X<Object>().foo2("X"); |
4816 |
^ |
4817 |
where T#1,A,T#3 are type-variables: |
4818 |
T#1 extends Object declared in method <T#1>foo2(A) |
4819 |
A extends Object declared in class Y |
4820 |
T#3 extends Object declared in method <T#3>foo2(T#3) |
4821 |
X.java:6: name clash: <T>foo(T) in X and foo(A) in Y have the same erasure, yet neither overrides the other |
4822 |
<T> T foo(T t) {return null;} |
4823 |
^ |
4824 |
where T,A are type-variables: |
4825 |
T extends Object declared in method <T>foo(T) |
4826 |
A extends Object declared in class Y |
4827 |
X.java:7: name clash: <T#1>foo2(T#1) in X and <T#2>foo2(A) in Y have the same erasure, yet neither overrides the other |
4828 |
<T> T foo2(T t) {return null;} |
4829 |
^ |
4830 |
where T#1,T#2,A are type-variables: |
4831 |
T#1 extends Object declared in method <T#1>foo2(T#1) |
4832 |
T#2 extends Object declared in method <T#2>foo2(A) |
4833 |
A extends Object declared in class Y |
4834 |
4 errors |
4835 |
*/ |
4297 |
} |
4836 |
} |
4298 |
|
4837 |
|
4299 |
public void test059() { |
4838 |
public void test059() { |
Lines 6228-6234
Link Here
|
6228 |
|
6767 |
|
6229 |
// name conflict |
6768 |
// name conflict |
6230 |
public void test101() { |
6769 |
public void test101() { |
6231 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
|
|
6232 |
this.runNegativeTest( |
6770 |
this.runNegativeTest( |
6233 |
new String[] { |
6771 |
new String[] { |
6234 |
"X.java", |
6772 |
"X.java", |
Lines 6250-6265
Link Here
|
6250 |
" }\n" + |
6788 |
" }\n" + |
6251 |
"}" |
6789 |
"}" |
6252 |
}, |
6790 |
}, |
6253 |
"----------\n" + |
6791 |
"----------\n" + |
6254 |
"1. ERROR in X.java (at line 11)\n" + |
6792 |
"1. ERROR in X.java (at line 3)\n" + |
6255 |
" Integer getX(List<Integer> l) {\n" + |
6793 |
" Integer getX(List<Integer> l) {\n" + |
6256 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
6794 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
6257 |
"Duplicate method getX(List<Integer>) in type Y\n" + |
6795 |
"Method getX(List<Integer>) has the same erasure getX(List<E>) as another method in type X\n" + |
6258 |
"----------\n" + |
6796 |
"----------\n" + |
6259 |
"2. ERROR in X.java (at line 14)\n" + |
6797 |
"2. ERROR in X.java (at line 6)\n" + |
6260 |
" String getX(List<Integer> l) {\n" + |
6798 |
" String getX(List<String> l) {\n" + |
6261 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
6799 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
6262 |
"Duplicate method getX(List<Integer>) in type Y\n" + |
6800 |
"Method getX(List<String>) has the same erasure getX(List<E>) as another method in type X\n" + |
|
|
6801 |
"----------\n" + |
6802 |
"3. ERROR in X.java (at line 11)\n" + |
6803 |
" Integer getX(List<Integer> l) {\n" + |
6804 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
6805 |
"Duplicate method getX(List<Integer>) in type Y\n" + |
6806 |
"----------\n" + |
6807 |
"4. ERROR in X.java (at line 14)\n" + |
6808 |
" String getX(List<Integer> l) {\n" + |
6809 |
" ^^^^^^^^^^^^^^^^^^^^^\n" + |
6810 |
"Duplicate method getX(List<Integer>) in type Y\n" + |
6263 |
"----------\n" |
6811 |
"----------\n" |
6264 |
); |
6812 |
); |
6265 |
} |
6813 |
} |
Lines 7313-7320
Link Here
|
7313 |
} |
7861 |
} |
7314 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830 |
7862 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=202830 |
7315 |
public void test120a() { |
7863 |
public void test120a() { |
7316 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) return; // see test187() |
7864 |
this.runNegativeTest( |
7317 |
this.runConformTest( |
|
|
7318 |
new String[] { |
7865 |
new String[] { |
7319 |
"Bar.java", |
7866 |
"Bar.java", |
7320 |
"class Foo<V, E> {\n" + |
7867 |
"class Foo<V, E> {\n" + |
Lines 7323-7329
Link Here
|
7323 |
"}\n" + |
7870 |
"}\n" + |
7324 |
"public class Bar<V,E> extends Foo<V,E> {}" |
7871 |
"public class Bar<V,E> extends Foo<V,E> {}" |
7325 |
}, |
7872 |
}, |
7326 |
"" |
7873 |
"----------\n" + |
|
|
7874 |
"1. ERROR in Bar.java (at line 2)\n" + |
7875 |
" int getThing(V v) { return 1; }\n" + |
7876 |
" ^^^^^^^^^^^^^\n" + |
7877 |
"Method getThing(V) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
7878 |
"----------\n" + |
7879 |
"2. ERROR in Bar.java (at line 3)\n" + |
7880 |
" boolean getThing(E e) { return true; }\n" + |
7881 |
" ^^^^^^^^^^^^^\n" + |
7882 |
"Method getThing(E) has the same erasure getThing(Object) as another method in type Foo<V,E>\n" + |
7883 |
"----------\n" |
7327 |
); |
7884 |
); |
7328 |
} |
7885 |
} |
7329 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=173477 |
7886 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=173477 |
Lines 9013-9019
Link Here
|
9013 |
|
9570 |
|
9014 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=251091 |
9571 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=251091 |
9015 |
public void test177() { |
9572 |
public void test177() { |
9016 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_7) { // see test187() |
9573 |
if (new CompilerOptions(getCompilerOptions()).complianceLevel >= ClassFileConstants.JDK1_6) { // see test187() |
9017 |
this.runNegativeTest( |
9574 |
this.runNegativeTest( |
9018 |
new String[] { |
9575 |
new String[] { |
9019 |
"X.java", |
9576 |
"X.java", |
Lines 9058-9078
Link Here
|
9058 |
"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" + |
9615 |
"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" + |
9059 |
"----------\n" |
9616 |
"----------\n" |
9060 |
); |
9617 |
); |
9061 |
} else if (new CompilerOptions(getCompilerOptions()).sourceLevel == ClassFileConstants.JDK1_6) { |
|
|
9062 |
this.runConformTest( |
9063 |
new String[] { |
9064 |
"X.java", |
9065 |
"import java.util.*;\n" + |
9066 |
"interface I { I foo(Collection<?> c); }\n" + |
9067 |
"class A extends LinkedHashMap {\n" + |
9068 |
" public A foo(Collection c) { return this; }\n" + |
9069 |
"}\n" + |
9070 |
"class X extends A implements I {\n" + |
9071 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
9072 |
"}" |
9073 |
}, |
9074 |
"" |
9075 |
); |
9076 |
} else { |
9618 |
} else { |
9077 |
this.runNegativeTest( |
9619 |
this.runNegativeTest( |
9078 |
new String[] { |
9620 |
new String[] { |
Lines 9086-9116
Link Here
|
9086 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
9628 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
9087 |
"}" |
9629 |
"}" |
9088 |
}, |
9630 |
}, |
9089 |
"----------\n" + |
9631 |
"----------\n" + |
9090 |
"1. WARNING in X.java (at line 3)\n" + |
9632 |
"1. WARNING in X.java (at line 3)\n" + |
9091 |
" class A extends LinkedHashMap {\n" + |
9633 |
" class A extends LinkedHashMap {\n" + |
9092 |
" ^\n" + |
9634 |
" ^\n" + |
9093 |
"The serializable class A does not declare a static final serialVersionUID field of type long\n" + |
9635 |
"The serializable class A does not declare a static final serialVersionUID field of type long\n" + |
9094 |
"----------\n" + |
9636 |
"----------\n" + |
9095 |
"2. WARNING in X.java (at line 3)\n" + |
9637 |
"2. WARNING in X.java (at line 3)\n" + |
9096 |
" class A extends LinkedHashMap {\n" + |
9638 |
" class A extends LinkedHashMap {\n" + |
9097 |
" ^^^^^^^^^^^^^\n" + |
9639 |
" ^^^^^^^^^^^^^\n" + |
9098 |
"LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized\n" + |
9640 |
"LinkedHashMap is a raw type. References to generic type LinkedHashMap<K,V> should be parameterized\n" + |
9099 |
"----------\n" + |
9641 |
"----------\n" + |
9100 |
"3. WARNING in X.java (at line 4)\n" + |
9642 |
"3. WARNING in X.java (at line 4)\n" + |
9101 |
" public A foo(Collection c) { return this; }\n" + |
9643 |
" public A foo(Collection c) { return this; }\n" + |
9102 |
" ^^^^^^^^^^\n" + |
9644 |
" ^^^^^^^^^^\n" + |
9103 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
9645 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
9104 |
"----------\n" + |
9646 |
"----------\n" + |
9105 |
"4. WARNING in X.java (at line 6)\n" + |
9647 |
"4. ERROR in X.java (at line 6)\n" + |
9106 |
" class X extends A implements I {\n" + |
9648 |
" class X extends A implements I {\n" + |
9107 |
" ^\n" + |
9649 |
" ^\n" + |
9108 |
"The serializable class X does not declare a static final serialVersionUID field of type long\n" + |
9650 |
"Name clash: The method foo(Collection<?>) of type I has the same erasure as foo(Collection) of type A but does not override it\n" + |
9109 |
"----------\n" + |
9651 |
"----------\n" + |
9110 |
"5. ERROR in X.java (at line 7)\n" + |
9652 |
"5. WARNING in X.java (at line 6)\n" + |
9111 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
9653 |
" class X extends A implements I {\n" + |
9112 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
9654 |
" ^\n" + |
9113 |
"The method foo(Collection<?>) of type X must override a superclass method\n" + |
9655 |
"The serializable class X does not declare a static final serialVersionUID field of type long\n" + |
|
|
9656 |
"----------\n" + |
9657 |
"6. ERROR in X.java (at line 7)\n" + |
9658 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
9659 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
9660 |
"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" + |
9661 |
"----------\n" + |
9662 |
"7. ERROR in X.java (at line 7)\n" + |
9663 |
" @Override public X foo(Collection<?> c) { return this; }\n" + |
9664 |
" ^^^^^^^^^^^^^^^^^^^^\n" + |
9665 |
"The method foo(Collection<?>) of type X must override a superclass method\n" + |
9114 |
"----------\n" |
9666 |
"----------\n" |
9115 |
); |
9667 |
); |
9116 |
} |
9668 |
} |
Lines 9583-9589
Link Here
|
9583 |
" int f(List<String> l) {return 0;}\n" + |
10135 |
" int f(List<String> l) {return 0;}\n" + |
9584 |
"}\n" + |
10136 |
"}\n" + |
9585 |
"class Y extends X {\n" + |
10137 |
"class Y extends X {\n" + |
9586 |
" double f(List<Integer> l) {return 0;}\n" + |
10138 |
" double f(List<Integer> l) {return 0;}\n" +// name clash in 7 |
9587 |
"}\n" + |
10139 |
"}\n" + |
9588 |
"interface I {\n" + |
10140 |
"interface I {\n" + |
9589 |
" double f(List<Integer> l);\n" + |
10141 |
" double f(List<Integer> l);\n" + |
Lines 9591-9622
Link Here
|
9591 |
"abstract class Z extends X implements I {}\n" + |
10143 |
"abstract class Z extends X implements I {}\n" + |
9592 |
"class XX {\n" + |
10144 |
"class XX {\n" + |
9593 |
" int f(List<String> l) {return 0;}\n" + |
10145 |
" int f(List<String> l) {return 0;}\n" + |
9594 |
"double f(List<Integer> l) {return 0;}\n" + |
10146 |
"double f(List<Integer> l) {return 0;}\n" +// name clash in 1.5 & 7 |
9595 |
"}" |
10147 |
"}" |
9596 |
}, |
10148 |
}, |
9597 |
new CompilerOptions(getCompilerOptions()).complianceLevel < ClassFileConstants.JDK1_7 |
10149 |
"----------\n" + |
9598 |
? "" |
10150 |
"1. ERROR in X.java (at line 6)\n" + |
9599 |
: "----------\n" + |
10151 |
" double f(List<Integer> l) {return 0;}\n" + |
9600 |
"1. ERROR in X.java (at line 6)\n" + |
10152 |
" ^^^^^^^^^^^^^^^^^^\n" + |
9601 |
" double f(List<Integer> l) {return 0;}\n" + |
10153 |
"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" + |
9602 |
" ^^^^^^^^^^^^^^^^^^\n" + |
10154 |
"----------\n" + |
9603 |
"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" + |
10155 |
"2. ERROR in X.java (at line 11)\n" + |
9604 |
"----------\n" + |
10156 |
" abstract class Z extends X implements I {}\n" + |
9605 |
"2. ERROR in X.java (at line 11)\n" + |
10157 |
" ^\n" + |
9606 |
" abstract class Z extends X implements I {}\n" + |
10158 |
"Name clash: The method f(List<String>) of type X has the same erasure as f(List<Integer>) of type I but does not override it\n" + |
9607 |
" ^\n" + |
10159 |
"----------\n" + |
9608 |
"Name clash: The method f(List<String>) of type X has the same erasure as f(List<Integer>) of type I but does not override it\n" + |
10160 |
"3. ERROR in X.java (at line 13)\n" + |
9609 |
"----------\n" + |
10161 |
" int f(List<String> l) {return 0;}\n" + |
9610 |
"3. ERROR in X.java (at line 13)\n" + |
10162 |
" ^^^^^^^^^^^^^^^^^\n" + |
9611 |
" int f(List<String> l) {return 0;}\n" + |
10163 |
"Method f(List<String>) has the same erasure f(List<E>) as another method in type XX\n" + |
9612 |
" ^^^^^^^^^^^^^^^^^\n" + |
10164 |
"----------\n" + |
9613 |
"Method f(List<String>) has the same erasure f(List<E>) as another method in type XX\n" + |
10165 |
"4. ERROR in X.java (at line 14)\n" + |
9614 |
"----------\n" + |
10166 |
" double f(List<Integer> l) {return 0;}\n" + |
9615 |
"4. ERROR in X.java (at line 14)\n" + |
10167 |
" ^^^^^^^^^^^^^^^^^^\n" + |
9616 |
" double f(List<Integer> l) {return 0;}\n" + |
10168 |
"Method f(List<Integer>) has the same erasure f(List<E>) as another method in type XX\n" + |
9617 |
" ^^^^^^^^^^^^^^^^^^\n" + |
10169 |
"----------\n" |
9618 |
"Method f(List<Integer>) has the same erasure f(List<E>) as another method in type XX\n" + |
|
|
9619 |
"----------\n" |
9620 |
); |
10170 |
); |
9621 |
} |
10171 |
} |
9622 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=279836 |
10172 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=279836 |
Lines 10036-10039
Link Here
|
10036 |
JavacTestOptions.SKIP |
10586 |
JavacTestOptions.SKIP |
10037 |
); |
10587 |
); |
10038 |
} |
10588 |
} |
|
|
10589 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=285088 |
10590 |
public void test200() { |
10591 |
this.runNegativeTest( |
10592 |
new String[] { |
10593 |
"X.java", |
10594 |
"import java.util.Collection;\n" + |
10595 |
"class X {\n" + |
10596 |
" int foo(Collection bar) { return 0; }\n" + |
10597 |
" double foo(Collection<String> bar) {return 0; }\n" + |
10598 |
"}" |
10599 |
}, |
10600 |
"----------\n" + |
10601 |
"1. ERROR in X.java (at line 3)\n" + |
10602 |
" int foo(Collection bar) { return 0; }\n" + |
10603 |
" ^^^^^^^^^^^^^^^^^^^\n" + |
10604 |
"Method foo(Collection) has the same erasure foo(Collection<E>) as another method in type X\n" + |
10605 |
"----------\n" + |
10606 |
"2. WARNING in X.java (at line 3)\n" + |
10607 |
" int foo(Collection bar) { return 0; }\n" + |
10608 |
" ^^^^^^^^^^\n" + |
10609 |
"Collection is a raw type. References to generic type Collection<E> should be parameterized\n" + |
10610 |
"----------\n" + |
10611 |
"3. ERROR in X.java (at line 4)\n" + |
10612 |
" double foo(Collection<String> bar) {return 0; }\n" + |
10613 |
" ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + |
10614 |
"Method foo(Collection<String>) has the same erasure foo(Collection<E>) as another method in type X\n" + |
10615 |
"----------\n" |
10616 |
); |
10617 |
/* javac 7 |
10618 |
X.java:4: foo(Collection) is already defined in X |
10619 |
double foo(Collection<String> bar) {return 0; } |
10620 |
^ |
10621 |
1 error |
10622 |
*/ |
10623 |
} |
10039 |
} |
10624 |
} |