View | Details | Raw Unified | Return to bug 267088
Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (+17 lines)
Lines 9461-9464 Link Here
9461
		"----------\n"
9461
		"----------\n"
9462
	);
9462
	);
9463
}
9463
}
9464
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=267088
9465
public void test185() {
9466
	this.runNegativeTest(
9467
		new String[] {
9468
			"A.java",
9469
			"interface I { I hello(); }\n" +
9470
			"interface J { J hello(); }\n" +
9471
			"class A implements I, J {}"
9472
		},
9473
		"----------\n" + 
9474
		"1. ERROR in A.java (at line 3)\n" + 
9475
		"	class A implements I, J {}\n" + 
9476
		"	      ^\n" + 
9477
		"The type A must implement the inherited abstract method I.hello()\n" + 
9478
		"----------\n"
9479
	);
9480
}
9464
}
9481
}
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java (-3 / +6 lines)
Lines 326-334 Link Here
326
	MethodBinding concreteMethod = this.type.isInterface() || methods[0].isAbstract() ? null : methods[0];
326
	MethodBinding concreteMethod = this.type.isInterface() || methods[0].isAbstract() ? null : methods[0];
327
	if (concreteMethod == null) {
327
	if (concreteMethod == null) {
328
		MethodBinding bestAbstractMethod = length == 1 ? methods[0] : findBestInheritedAbstractMethod(methods, length);
328
		MethodBinding bestAbstractMethod = length == 1 ? methods[0] : findBestInheritedAbstractMethod(methods, length);
329
		if (bestAbstractMethod == null) {
329
		boolean noMatch = bestAbstractMethod == null;
330
			problemReporter().inheritedMethodsHaveIncompatibleReturnTypes(this.type, methods, length);
330
		if (noMatch)
331
		} else if (mustImplementAbstractMethod(bestAbstractMethod.declaringClass)) {
331
			bestAbstractMethod = methods[0];
332
		if (mustImplementAbstractMethod(bestAbstractMethod.declaringClass)) {
332
			TypeDeclaration typeDeclaration = this.type.scope.referenceContext;
333
			TypeDeclaration typeDeclaration = this.type.scope.referenceContext;
333
			MethodBinding superclassAbstractMethod = methods[0];
334
			MethodBinding superclassAbstractMethod = methods[0];
334
			if (superclassAbstractMethod == bestAbstractMethod || superclassAbstractMethod.declaringClass.isInterface()) {
335
			if (superclassAbstractMethod == bestAbstractMethod || superclassAbstractMethod.declaringClass.isInterface()) {
Lines 346-351 Link Here
346
					problemReporter().abstractMethodMustBeImplemented(this.type, bestAbstractMethod, superclassAbstractMethod);
347
					problemReporter().abstractMethodMustBeImplemented(this.type, bestAbstractMethod, superclassAbstractMethod);
347
				}
348
				}
348
			}
349
			}
350
		} else if (noMatch) {
351
			problemReporter().inheritedMethodsHaveIncompatibleReturnTypes(this.type, methods, length);
349
		}
352
		}
350
		return;
353
		return;
351
	}
354
	}

Return to bug 267088