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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java (-1 / +1 lines)
Lines 260-266 Link Here
260
				TypeReference[] refs = this.type.scope.referenceContext.superInterfaces;
260
				TypeReference[] refs = this.type.scope.referenceContext.superInterfaces;
261
				for (int r = 0, rl = refs.length; r < rl; r++) {
261
				for (int r = 0, rl = refs.length; r < rl; r++) {
262
					if (refs[r].resolvedType == toCheck) {
262
					if (refs[r].resolvedType == toCheck) {
263
						problemReporter().redundantSuperInterface(this.type, refs[r], toCheck, superInterfaces[j]);
263
						problemReporter().redundantSuperInterface(this.type, refs[j], superInterfaces[j], toCheck);
264
						continue next;
264
						continue next;
265
					}
265
					}
266
				}
266
				}
(-)src/org/eclipse/jdt/core/tests/compiler/regression/SuperTypeTest.java (-15 / +42 lines)
Lines 25-31 Link Here
25
	// All specified tests which does not belong to the class are skipped...
25
	// All specified tests which does not belong to the class are skipped...
26
	static {
26
	static {
27
//		TESTS_NAMES = new String[] { "test000" };
27
//		TESTS_NAMES = new String[] { "test000" };
28
//		TESTS_NUMBERS = new int[] { 42, 43, 44 };
28
//		TESTS_NUMBERS = new int[] { 14 };
29
//		TESTS_RANGE = new int[] { 11, -1 };
29
//		TESTS_RANGE = new int[] { 11, -1 };
30
	}
30
	}
31
31
Lines 411-448 Link Here
411
		"----------\n" + 
411
		"----------\n" + 
412
		"1. ERROR in X.java (at line 2)\n" + 
412
		"1. ERROR in X.java (at line 2)\n" + 
413
		"	interface X<E> extends List<E>, Collection<E>, Iterable<E> {}\n" + 
413
		"	interface X<E> extends List<E>, Collection<E>, Iterable<E> {}\n" + 
414
		"	                       ^^^^\n" + 
414
		"	                                ^^^^^^^^^^\n" + 
415
		"Redundant superinterface List<E> for the type X<E>, already defined by Collection<E>\n" + 
415
		"Redundant superinterface Collection<E> for the type X<E>, already defined by List<E>\n" + 
416
		"----------\n" + 
416
		"----------\n" + 
417
		"2. ERROR in X.java (at line 2)\n" + 
417
		"2. ERROR in X.java (at line 2)\n" + 
418
		"	interface X<E> extends List<E>, Collection<E>, Iterable<E> {}\n" + 
418
		"	interface X<E> extends List<E>, Collection<E>, Iterable<E> {}\n" + 
419
		"	                                ^^^^^^^^^^\n" + 
419
		"	                                               ^^^^^^^^\n" + 
420
		"Redundant superinterface Collection<E> for the type X<E>, already defined by Iterable<E>\n" + 
420
		"Redundant superinterface Iterable<E> for the type X<E>, already defined by Collection<E>\n" + 
421
		"----------\n" + 
421
		"----------\n" + 
422
		"3. ERROR in X.java (at line 3)\n" + 
422
		"3. ERROR in X.java (at line 3)\n" + 
423
		"	interface Y<E> extends Collection<E>, List<E> {}\n" + 
423
		"	interface Y<E> extends Collection<E>, List<E> {}\n" + 
424
		"	                                      ^^^^\n" + 
424
		"	                       ^^^^^^^^^^\n" + 
425
		"Redundant superinterface List<E> for the type Y<E>, already defined by Collection<E>\n" + 
425
		"Redundant superinterface Collection<E> for the type Y<E>, already defined by List<E>\n" + 
426
		"----------\n" + 
426
		"----------\n" + 
427
		"4. ERROR in X.java (at line 4)\n" + 
427
		"4. ERROR in X.java (at line 4)\n" + 
428
		"	interface XXX<E> extends Iterable<E>, List<E>, Collection<E> {}\n" + 
428
		"	interface XXX<E> extends Iterable<E>, List<E>, Collection<E> {}\n" + 
429
		"	                                      ^^^^\n" + 
429
		"	                         ^^^^^^^^\n" + 
430
		"Redundant superinterface List<E> for the type XXX<E>, already defined by Iterable<E>\n" + 
430
		"Redundant superinterface Iterable<E> for the type XXX<E>, already defined by List<E>\n" + 
431
		"----------\n" + 
431
		"----------\n" + 
432
		"5. ERROR in X.java (at line 4)\n" + 
432
		"5. ERROR in X.java (at line 4)\n" + 
433
		"	interface XXX<E> extends Iterable<E>, List<E>, Collection<E> {}\n" + 
433
		"	interface XXX<E> extends Iterable<E>, List<E>, Collection<E> {}\n" + 
434
		"	                                               ^^^^^^^^^^\n" + 
434
		"	                         ^^^^^^^^\n" + 
435
		"Redundant superinterface Collection<E> for the type XXX<E>, already defined by Iterable<E>\n" + 
435
		"Redundant superinterface Iterable<E> for the type XXX<E>, already defined by Collection<E>\n" + 
436
		"----------\n" + 
436
		"----------\n" + 
437
		"6. ERROR in X.java (at line 5)\n" + 
437
		"6. ERROR in X.java (at line 5)\n" + 
438
		"	abstract class Z implements List<Object>, Collection<Object> {}\n" + 
438
		"	abstract class Z implements List<Object>, Collection<Object> {}\n" + 
439
		"	                            ^^^^\n" + 
439
		"	                                          ^^^^^^^^^^\n" + 
440
		"Redundant superinterface List<Object> for the type Z, already defined by Collection<Object>\n" + 
440
		"Redundant superinterface Collection<Object> for the type Z, already defined by List<Object>\n" + 
441
		"----------\n" + 
441
		"----------\n" + 
442
		"7. ERROR in X.java (at line 6)\n" + 
442
		"7. ERROR in X.java (at line 6)\n" + 
443
		"	abstract class ZZ implements Collection<Object>, List<Object> {}\n" + 
443
		"	abstract class ZZ implements Collection<Object>, List<Object> {}\n" + 
444
		"	                                                 ^^^^\n" + 
444
		"	                             ^^^^^^^^^^\n" + 
445
		"Redundant superinterface List<Object> for the type ZZ, already defined by Collection<Object>\n" + 
445
		"Redundant superinterface Collection<Object> for the type ZZ, already defined by List<Object>\n" + 
446
		"----------\n",
447
		JavacTestOptions.SKIP);
448
}
449
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=288749
450
public void test014() {
451
	Map customOptions = getCompilerOptions();
452
	customOptions.put(CompilerOptions.OPTION_ReportRedundantSuperinterface,  CompilerOptions.ERROR);
453
	runNegativeTest(
454
		// test directory preparation
455
		true /* flush output directory */,
456
		new String[] { /* test files */
457
			"X.java",
458
			"public class X implements I, J {}",
459
			"I.java",
460
			"public interface I {}",
461
			"J.java",
462
			"public interface J extends I {}"
463
		},
464
		// compiler options
465
		null /* no class libraries */,
466
		customOptions /* custom options */,
467
		// compiler results
468
		"----------\n" + 
469
		"1. ERROR in X.java (at line 1)\n" + 
470
		"	public class X implements I, J {}\n" + 
471
		"	                          ^\n" + 
472
		"Redundant superinterface I for the type X, already defined by J\n" + 
446
		"----------\n",
473
		"----------\n",
447
		JavacTestOptions.SKIP);
474
		JavacTestOptions.SKIP);
448
}
475
}

Return to bug 288749