View | Details | Raw Unified | Return to bug 334306 | Differences between
and this patch

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java (-1 / +1 lines)
Lines 235-241 Link Here
235
	//		class A implements I<Integer> { public void test(Integer i) {} }
235
	//		class A implements I<Integer> { public void test(Integer i) {} }
236
	//		class B extends A { public void test(Comparable i) {} }
236
	//		class B extends A { public void test(Comparable i) {} }
237
237
238
	if (currentMethod.declaringClass.isInterface() || inheritedMethod.isStatic()) return;
238
	if (inheritedMethod.isStatic()) return;
239
239
240
	if (!detectNameClash(currentMethod, inheritedMethod, false)) { // check up the hierarchy for skipped inherited methods
240
	if (!detectNameClash(currentMethod, inheritedMethod, false)) { // check up the hierarchy for skipped inherited methods
241
		TypeBinding[] currentParams = currentMethod.parameters;
241
		TypeBinding[] currentParams = currentMethod.parameters;
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (-22 / +39 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2010 IBM Corporation and others.
2
 * Copyright (c) 2000, 2011 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 3269-3274 Link Here
3269
}
3269
}
3270
3270
3271
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=268837
3271
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=268837
3272
// See that this test case exhibits the bug 345947
3272
public void test076() {
3273
public void test076() {
3273
	this.runNegativeTest(
3274
	this.runNegativeTest(
3274
		new String[] {
3275
		new String[] {
Lines 3320-3416 Link Here
3320
			"}"
3321
			"}"
3321
		},
3322
		},
3322
		"----------\n" + 
3323
		"----------\n" + 
3323
		"1. ERROR in X.java (at line 15)\n" + 
3324
		"1. ERROR in X.java (at line 8)\n" + 
3325
		"	<U> J<String> b();\n" + 
3326
		"	              ^^^\n" + 
3327
		"Name clash: The method b() of type J<E> has the same erasure as b() of type I<E> but does not override it\n" + 
3328
		"----------\n" + 
3329
		"2. ERROR in X.java (at line 15)\n" + 
3324
		"	J<Integer> b = ints.a();\n" + 
3330
		"	J<Integer> b = ints.a();\n" + 
3325
		"	               ^^^^^^^^\n" + 
3331
		"	               ^^^^^^^^\n" + 
3326
		"Type mismatch: cannot convert from J<String> to J<Integer>\n" + 
3332
		"Type mismatch: cannot convert from J<String> to J<Integer>\n" + 
3327
		"----------\n" + 
3333
		"----------\n" + 
3328
		"2. ERROR in X.java (at line 16)\n" + 
3334
		"3. ERROR in X.java (at line 16)\n" + 
3329
		"	J<Object> c = ints.a();\n" + 
3335
		"	J<Object> c = ints.a();\n" + 
3330
		"	              ^^^^^^^^\n" + 
3336
		"	              ^^^^^^^^\n" + 
3331
		"Type mismatch: cannot convert from J<String> to J<Object>\n" + 
3337
		"Type mismatch: cannot convert from J<String> to J<Object>\n" + 
3332
		"----------\n" + 
3338
		"----------\n" + 
3333
		"3. WARNING in X.java (at line 17)\n" + 
3339
		"4. WARNING in X.java (at line 17)\n" + 
3334
		"	J d = ints.a();\n" + 
3340
		"	J d = ints.a();\n" + 
3335
		"	^\n" + 
3341
		"	^\n" + 
3336
		"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3342
		"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3337
		"----------\n" + 
3343
		"----------\n" + 
3338
		"4. ERROR in X.java (at line 19)\n" + 
3344
		"5. ERROR in X.java (at line 19)\n" + 
3339
		"	I<Integer> f = ints.a();\n" + 
3345
		"	I<Integer> f = ints.a();\n" + 
3340
		"	               ^^^^^^^^\n" + 
3346
		"	               ^^^^^^^^\n" + 
3341
		"Type mismatch: cannot convert from J<String> to I<Integer>\n" + 
3347
		"Type mismatch: cannot convert from J<String> to I<Integer>\n" + 
3342
		"----------\n" + 
3348
		"----------\n" + 
3343
		"5. ERROR in X.java (at line 20)\n" + 
3349
		"6. ERROR in X.java (at line 20)\n" + 
3344
		"	I<Object> g = ints.a();\n" + 
3350
		"	I<Object> g = ints.a();\n" + 
3345
		"	              ^^^^^^^^\n" + 
3351
		"	              ^^^^^^^^\n" + 
3346
		"Type mismatch: cannot convert from J<String> to I<Object>\n" + 
3352
		"Type mismatch: cannot convert from J<String> to I<Object>\n" + 
3347
		"----------\n" + 
3353
		"----------\n" + 
3348
		"6. WARNING in X.java (at line 21)\n" + 
3354
		"7. WARNING in X.java (at line 21)\n" + 
3349
		"	I h = ints.a();\n" + 
3355
		"	I h = ints.a();\n" + 
3350
		"	^\n" + 
3356
		"	^\n" + 
3351
		"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3357
		"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3352
		"----------\n" + 
3358
		"----------\n" + 
3353
		"7. ERROR in X.java (at line 24)\n" + 
3359
		"8. ERROR in X.java (at line 24)\n" + 
3354
		"	ints.b();\n" + 
3360
		"	ints.b();\n" + 
3355
		"	     ^\n" + 
3361
		"	     ^\n" + 
3356
		"The method b() is ambiguous for the type J<Integer>\n" + 
3362
		"The method b() is ambiguous for the type J<Integer>\n" + 
3357
		"----------\n" + 
3363
		"----------\n" + 
3358
		"8. ERROR in X.java (at line 25)\n" + 
3364
		"9. ERROR in X.java (at line 25)\n" + 
3359
		"	J<String> a = ints.b();\n" + 
3365
		"	J<String> a = ints.b();\n" + 
3360
		"	                   ^\n" + 
3366
		"	                   ^\n" + 
3361
		"The method b() is ambiguous for the type J<Integer>\n" + 
3367
		"The method b() is ambiguous for the type J<Integer>\n" + 
3362
		"----------\n" + 
3368
		"----------\n" + 
3363
		"9. ERROR in X.java (at line 26)\n" + 
3369
		"10. ERROR in X.java (at line 26)\n" + 
3364
		"	J<Integer> b = ints.b();\n" + 
3370
		"	J<Integer> b = ints.b();\n" + 
3365
		"	                    ^\n" + 
3371
		"	                    ^\n" + 
3366
		"The method b() is ambiguous for the type J<Integer>\n" + 
3372
		"The method b() is ambiguous for the type J<Integer>\n" + 
3367
		"----------\n" + 
3373
		"----------\n" + 
3368
		"10. ERROR in X.java (at line 27)\n" + 
3374
		"11. ERROR in X.java (at line 27)\n" + 
3369
		"	J<Object> c = ints.b();\n" + 
3375
		"	J<Object> c = ints.b();\n" + 
3370
		"	                   ^\n" + 
3376
		"	                   ^\n" + 
3371
		"The method b() is ambiguous for the type J<Integer>\n" + 
3377
		"The method b() is ambiguous for the type J<Integer>\n" + 
3372
		"----------\n" + 
3378
		"----------\n" + 
3373
		"11. WARNING in X.java (at line 28)\n" + 
3379
		"12. WARNING in X.java (at line 28)\n" + 
3374
		"	J d = ints.b();\n" + 
3380
		"	J d = ints.b();\n" + 
3375
		"	^\n" + 
3381
		"	^\n" + 
3376
		"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3382
		"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3377
		"----------\n" + 
3383
		"----------\n" + 
3378
		"12. ERROR in X.java (at line 28)\n" + 
3384
		"13. ERROR in X.java (at line 28)\n" + 
3379
		"	J d = ints.b();\n" + 
3385
		"	J d = ints.b();\n" + 
3380
		"	           ^\n" + 
3386
		"	           ^\n" + 
3381
		"The method b() is ambiguous for the type J<Integer>\n" + 
3387
		"The method b() is ambiguous for the type J<Integer>\n" + 
3382
		"----------\n" + 
3388
		"----------\n" + 
3383
		"13. ERROR in X.java (at line 29)\n" + 
3389
		"14. ERROR in X.java (at line 29)\n" + 
3384
		"	I<String> e = ints.b();\n" + 
3390
		"	I<String> e = ints.b();\n" + 
3385
		"	                   ^\n" + 
3391
		"	                   ^\n" + 
3386
		"The method b() is ambiguous for the type J<Integer>\n" + 
3392
		"The method b() is ambiguous for the type J<Integer>\n" + 
3387
		"----------\n" + 
3393
		"----------\n" + 
3388
		"14. ERROR in X.java (at line 30)\n" + 
3394
		"15. ERROR in X.java (at line 30)\n" + 
3389
		"	I<Integer> f = ints.b();\n" + 
3395
		"	I<Integer> f = ints.b();\n" + 
3390
		"	                    ^\n" + 
3396
		"	                    ^\n" + 
3391
		"The method b() is ambiguous for the type J<Integer>\n" + 
3397
		"The method b() is ambiguous for the type J<Integer>\n" + 
3392
		"----------\n" + 
3398
		"----------\n" + 
3393
		"15. ERROR in X.java (at line 31)\n" + 
3399
		"16. ERROR in X.java (at line 31)\n" + 
3394
		"	I<Object> g = ints.b();\n" + 
3400
		"	I<Object> g = ints.b();\n" + 
3395
		"	                   ^\n" + 
3401
		"	                   ^\n" + 
3396
		"The method b() is ambiguous for the type J<Integer>\n" + 
3402
		"The method b() is ambiguous for the type J<Integer>\n" + 
3397
		"----------\n" + 
3403
		"----------\n" + 
3398
		"16. WARNING in X.java (at line 32)\n" + 
3404
		"17. WARNING in X.java (at line 32)\n" + 
3399
		"	I h = ints.b();\n" + 
3405
		"	I h = ints.b();\n" + 
3400
		"	^\n" + 
3406
		"	^\n" + 
3401
		"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3407
		"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3402
		"----------\n" + 
3408
		"----------\n" + 
3403
		"17. ERROR in X.java (at line 32)\n" + 
3409
		"18. ERROR in X.java (at line 32)\n" + 
3404
		"	I h = ints.b();\n" + 
3410
		"	I h = ints.b();\n" + 
3405
		"	           ^\n" + 
3411
		"	           ^\n" + 
3406
		"The method b() is ambiguous for the type J<Integer>\n" + 
3412
		"The method b() is ambiguous for the type J<Integer>\n" + 
3407
		"----------\n" + 
3413
		"----------\n" + 
3408
		"18. WARNING in X.java (at line 39)\n" + 
3414
		"19. WARNING in X.java (at line 39)\n" + 
3409
		"	J d = ints.c();\n" + 
3415
		"	J d = ints.c();\n" + 
3410
		"	^\n" + 
3416
		"	^\n" + 
3411
		"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3417
		"J is a raw type. References to generic type J<E> should be parameterized\n" + 
3412
		"----------\n" + 
3418
		"----------\n" + 
3413
		"19. WARNING in X.java (at line 43)\n" + 
3419
		"20. WARNING in X.java (at line 43)\n" + 
3414
		"	I h = ints.c();\n" + 
3420
		"	I h = ints.c();\n" + 
3415
		"	^\n" + 
3421
		"	^\n" + 
3416
		"I is a raw type. References to generic type I<E> should be parameterized\n" + 
3422
		"I is a raw type. References to generic type I<E> should be parameterized\n" + 
Lines 3479-3486 Link Here
3479
}
3485
}
3480
3486
3481
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=292350
3487
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=292350
3488
// See that this test case exhibits the bug 345947
3482
public void test079() {
3489
public void test079() {
3483
	this.runConformTest(
3490
	this.runNegativeTest(
3484
		new String[] {
3491
		new String[] {
3485
			"X.java",
3492
			"X.java",
3486
			"interface I<T> {}\n" +
3493
			"interface I<T> {}\n" +
Lines 3499-3505 Link Here
3499
			"    void y(Two t) { t.y(); }\n" +
3506
			"    void y(Two t) { t.y(); }\n" +
3500
			"}"
3507
			"}"
3501
		},
3508
		},
3502
		""
3509
		"----------\n" + 
3510
		"1. ERROR in X.java (at line 9)\n" + 
3511
		"	<T extends A> I<T> x() throws IllegalAccessError;\n" + 
3512
		"	                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n" + 
3513
		"Name clash: The method x() of type Two has the same erasure as x() of type One but does not override it\n" + 
3514
		"----------\n" + 
3515
		"2. WARNING in X.java (at line 10)\n" + 
3516
		"	I<B> y() throws IllegalAccessError;\n" + 
3517
		"	^\n" + 
3518
		"Type safety: The return type I<B> for y() from the type Two needs unchecked conversion to conform to I<A> from the type One\n" + 
3519
		"----------\n"
3503
	);
3520
	);
3504
}
3521
}
3505
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=293384
3522
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=293384
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-44 / +125 lines)
Lines 2412-2418 Link Here
2412
	}
2412
	}
2413
2413
2414
	public void test037() { // test inheritance scenarios
2414
	public void test037() { // test inheritance scenarios
2415
		this.runConformTest(
2415
		this.runNegativeTest(
2416
			new String[] {
2416
			new String[] {
2417
				"X.java",
2417
				"X.java",
2418
				"public abstract class X implements I, J { }\n" +
2418
				"public abstract class X implements I, J { }\n" +
Lines 2428-2435 Link Here
2428
				"interface K extends I { void foo(A<String> a); }\n" +
2428
				"interface K extends I { void foo(A<String> a); }\n" +
2429
				"class A<T> {}"
2429
				"class A<T> {}"
2430
			},
2430
			},
2431
			""
2431
			"----------\n" + 
2432
		);
2432
			"1. WARNING in X.java (at line 4)\n" + 
2433
			"	class YYY implements J, I { public void foo(A a) {} }\n" + 
2434
			"	                                            ^\n" + 
2435
			"A is a raw type. References to generic type A<T> should be parameterized\n" + 
2436
			"----------\n" + 
2437
			"2. WARNING in X.java (at line 5)\n" + 
2438
			"	class XXX implements I, J { public void foo(A a) {} }\n" + 
2439
			"	                                            ^\n" + 
2440
			"A is a raw type. References to generic type A<T> should be parameterized\n" + 
2441
			"----------\n" + 
2442
			"3. WARNING in X.java (at line 6)\n" + 
2443
			"	class ZZZ implements K { public void foo(A a) {} }\n" + 
2444
			"	                                         ^\n" + 
2445
			"A is a raw type. References to generic type A<T> should be parameterized\n" + 
2446
			"----------\n" + 
2447
			"4. WARNING in X.java (at line 7)\n" + 
2448
			"	interface I { void foo(A a); }\n" + 
2449
			"	                       ^\n" + 
2450
			"A is a raw type. References to generic type A<T> should be parameterized\n" + 
2451
			"----------\n" + 
2452
			"5. ERROR in X.java (at line 9)\n" + 
2453
			"	interface K extends I { void foo(A<String> a); }\n" + 
2454
			"	                             ^^^^^^^^^^^^^^^^\n" + 
2455
			"Name clash: The method foo(A<String>) of type K has the same erasure as foo(A) of type I but does not override it\n" + 
2456
			"----------\n");
2433
	}
2457
	}
2434
	public void test037a() { // test inheritance scenarios
2458
	public void test037a() { // test inheritance scenarios
2435
		this.runNegativeTest(
2459
		this.runNegativeTest(
Lines 2467-2509 Link Here
2467
				"interface K extends I { void foo(A<String> a); }\n" +
2491
				"interface K extends I { void foo(A<String> a); }\n" +
2468
				"class A<T> {}"
2492
				"class A<T> {}"
2469
			},
2493
			},
2470
			"----------\n" +
2494
			"----------\n" + 
2471
			"1. ERROR in XX.java (at line 1)\n" +
2495
			"1. ERROR in XX.java (at line 1)\n" + 
2472
			"	public class XX implements I, J { public void foo(A<String> a) {} }\n" +
2496
			"	public class XX implements I, J { public void foo(A<String> a) {} }\n" + 
2473
			"	             ^^\n" +
2497
			"	             ^^\n" + 
2474
			"The type XX must implement the inherited abstract method I.foo(A)\n" +
2498
			"The type XX must implement the inherited abstract method I.foo(A)\n" + 
2475
			"----------\n" +
2499
			"----------\n" + 
2476
			"2. ERROR in XX.java (at line 1)\n" +
2500
			"2. ERROR in XX.java (at line 1)\n" + 
2477
			"	public class XX implements I, J { public void foo(A<String> a) {} }\n" +
2501
			"	public class XX implements I, J { public void foo(A<String> a) {} }\n" + 
2478
			"	                                              ^^^^^^^^^^^^^^^^\n" +
2502
			"	                                              ^^^^^^^^^^^^^^^^\n" + 
2479
			"Name clash: The method foo(A<String>) of type XX has the same erasure as foo(A) of type I but does not override it\n" +
2503
			"Name clash: The method foo(A<String>) of type XX has the same erasure as foo(A) of type I but does not override it\n" + 
2480
			"----------\n" +
2504
			"----------\n" + 
2481
			"3. ERROR in XX.java (at line 2)\n" +
2505
			"3. ERROR in XX.java (at line 2)\n" + 
2482
			"	class YY implements J, I { public void foo(A<String> a) {} }\n" +
2506
			"	class YY implements J, I { public void foo(A<String> a) {} }\n" + 
2483
			"	      ^^\n" +
2507
			"	      ^^\n" + 
2484
			"The type YY must implement the inherited abstract method I.foo(A)\n" +
2508
			"The type YY must implement the inherited abstract method I.foo(A)\n" + 
2485
			"----------\n" +
2509
			"----------\n" + 
2486
			"4. ERROR in XX.java (at line 2)\n" +
2510
			"4. ERROR in XX.java (at line 2)\n" + 
2487
			"	class YY implements J, I { public void foo(A<String> a) {} }\n" +
2511
			"	class YY implements J, I { public void foo(A<String> a) {} }\n" + 
2488
			"	                                       ^^^^^^^^^^^^^^^^\n" +
2512
			"	                                       ^^^^^^^^^^^^^^^^\n" + 
2489
			"Name clash: The method foo(A<String>) of type YY has the same erasure as foo(A) of type I but does not override it\n" +
2513
			"Name clash: The method foo(A<String>) of type YY has the same erasure as foo(A) of type I but does not override it\n" + 
2490
			"----------\n" +
2514
			"----------\n" + 
2491
			"5. ERROR in XX.java (at line 3)\n" +
2515
			"5. ERROR in XX.java (at line 3)\n" + 
2492
			"	class ZZ implements K { public void foo(A<String> a) {} }\n" +
2516
			"	class ZZ implements K { public void foo(A<String> a) {} }\n" + 
2493
			"	      ^^\n" +
2517
			"	      ^^\n" + 
2494
			"The type ZZ must implement the inherited abstract method I.foo(A)\n" +
2518
			"The type ZZ must implement the inherited abstract method I.foo(A)\n" + 
2495
			"----------\n" +
2519
			"----------\n" + 
2496
			"6. ERROR in XX.java (at line 3)\n" +
2520
			"6. ERROR in XX.java (at line 3)\n" + 
2497
			"	class ZZ implements K { public void foo(A<String> a) {} }\n" +
2521
			"	class ZZ implements K { public void foo(A<String> a) {} }\n" + 
2498
			"	                                    ^^^^^^^^^^^^^^^^\n" +
2522
			"	                                    ^^^^^^^^^^^^^^^^\n" + 
2499
			"Name clash: The method foo(A<String>) of type ZZ has the same erasure as foo(A) of type I but does not override it\n" +
2523
			"Name clash: The method foo(A<String>) of type ZZ has the same erasure as foo(A) of type I but does not override it\n" + 
2500
			"----------\n" +
2524
			"----------\n" + 
2501
			"7. WARNING in XX.java (at line 4)\n" +
2525
			"7. WARNING in XX.java (at line 4)\n" + 
2502
			"	interface I { void foo(A a); }\n" +
2526
			"	interface I { void foo(A a); }\n" + 
2503
			"	                       ^\n" +
2527
			"	                       ^\n" + 
2504
			"A is a raw type. References to generic type A<T> should be parameterized\n" +
2528
			"A is a raw type. References to generic type A<T> should be parameterized\n" + 
2529
			"----------\n" + 
2530
			"8. ERROR in XX.java (at line 6)\n" + 
2531
			"	interface K extends I { void foo(A<String> a); }\n" + 
2532
			"	                             ^^^^^^^^^^^^^^^^\n" + 
2533
			"Name clash: The method foo(A<String>) of type K has the same erasure as foo(A) of type I but does not override it\n" + 
2505
			"----------\n"
2534
			"----------\n"
2506
			// XX/YY/ZZ is not abstract and does not override abstract method foo(A) in I
2507
		);
2535
		);
2508
	}
2536
	}
2509
	public void test037c() { // test inheritance scenarios
2537
	public void test037c() { // test inheritance scenarios
Lines 8619-8624 Link Here
8619
		"");
8647
		"");
8620
}
8648
}
8621
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=194034
8649
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=194034
8650
// See that this test case exhibits the bug 345947
8622
public void test144() {
8651
public void test144() {
8623
	this.runNegativeTest(
8652
	this.runNegativeTest(
8624
		new String[] {
8653
		new String[] {
Lines 8636-8646 Link Here
8636
			"}\n" +
8665
			"}\n" +
8637
			"class PurebredCatShopImpl extends CatShopImpl implements PurebredCatShop {}"
8666
			"class PurebredCatShopImpl extends CatShopImpl implements PurebredCatShop {}"
8638
		},
8667
		},
8639
		"----------\n" +
8668
		"----------\n" + 
8640
		"1. WARNING in PurebredCatShopImpl.java (at line 10)\n" +
8669
		"1. ERROR in PurebredCatShopImpl.java (at line 6)\n" + 
8641
		"	public List<Pet> getPets() { return null; }\n" +
8670
		"	<V extends Pet> List<? extends Cat> getPets();\n" + 
8642
		"	       ^^^^\n" +
8671
		"	                                    ^^^^^^^^^\n" + 
8643
		"Type safety: The return type List<Pet> for getPets() from the type CatShopImpl needs unchecked conversion to conform to List<? extends Cat> from the type CatShop\n" +
8672
		"Name clash: The method getPets() of type CatShop has the same erasure as getPets() of type PetShop but does not override it\n" + 
8673
		"----------\n" + 
8674
		"2. WARNING in PurebredCatShopImpl.java (at line 10)\n" + 
8675
		"	public List<Pet> getPets() { return null; }\n" + 
8676
		"	       ^^^^\n" + 
8677
		"Type safety: The return type List<Pet> for getPets() from the type CatShopImpl needs unchecked conversion to conform to List<? extends Cat> from the type CatShop\n" + 
8644
		"----------\n"
8678
		"----------\n"
8645
	);
8679
	);
8646
}
8680
}
Lines 12063-12066 Link Here
12063
		assertEquals("Wrong contents", expectedOutput, result);
12097
		assertEquals("Wrong contents", expectedOutput, result);
12064
	}
12098
	}
12065
}
12099
}
12100
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=322740
12101
public void test322740() throws Exception {
12102
	this.runNegativeTest(
12103
		new String[] {
12104
			"X.java",
12105
			"class Base  {\n" +
12106
			"    boolean equalTo(Object other) {return false;}\n" +
12107
			"}\n" +
12108
			"interface EqualityComparable<T> {\n" +
12109
			"    boolean equalTo(T other);\n" +
12110
			"}\n" +
12111
			"public class X extends Base implements EqualityComparable<String> {\n" +
12112
			"    public boolean equalTo(String other) {\n" +
12113
			"        return true;\n" +
12114
			"    }\n" +
12115
			"    public static void main(String args[]) {\n" +
12116
			"        new X().equalTo(args);\n" +
12117
			"    }\n" +
12118
			"}\n"
12119
		},
12120
		"----------\n" + 
12121
		"1. ERROR in X.java (at line 7)\n" + 
12122
		"	public class X extends Base implements EqualityComparable<String> {\n" + 
12123
		"	             ^\n" + 
12124
		"Name clash: The method equalTo(T) of type EqualityComparable<T> has the same erasure as equalTo(Object) of type Base but does not override it\n" + 
12125
		"----------\n");
12126
}
12127
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=334306
12128
public void test334306() throws Exception {
12129
	this.runNegativeTest(
12130
		new String[] {
12131
			"X.java",
12132
			"class X<T> {}\n" +
12133
			"interface I {\n" +
12134
			"    void foo(X<Number> p);\n" +
12135
			"}\n" +
12136
			"interface J extends I {\n" +
12137
			"    void foo(X<Integer> p);\n" +
12138
			"}\n"
12139
		},
12140
		"----------\n" + 
12141
		"1. ERROR in X.java (at line 6)\n" + 
12142
		"	void foo(X<Integer> p);\n" + 
12143
		"	     ^^^^^^^^^^^^^^^^^\n" + 
12144
		"Name clash: The method foo(X<Integer>) of type J has the same erasure as foo(X<Number>) of type I but does not override it\n" + 
12145
		"----------\n");
12146
}
12066
}
12147
}

Return to bug 334306