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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java (-5 / +5 lines)
Lines 239-255 Link Here
239
	int[] overriddenInheritedMethods = length > 1 ? findOverriddenInheritedMethods(methods, length) : null;
239
	int[] overriddenInheritedMethods = length > 1 ? findOverriddenInheritedMethods(methods, length) : null;
240
	if (overriddenInheritedMethods != null) {
240
	if (overriddenInheritedMethods != null) {
241
		// detected some overridden methods that can be ignored when checking return types
241
		// detected some overridden methods that can be ignored when checking return types
242
		// but cannot ignore an overridden inherited method completely when it comes to checking for bridge methods
242
		int index = 0;
243
		int index = 0;
243
		MethodBinding[] closestMethods = new MethodBinding[length];
244
		MethodBinding[] closestMethods = new MethodBinding[length];
244
		for (int i = 0; i < length; i++)
245
		for (int i = 0; i < length; i++)
245
			if (overriddenInheritedMethods[i] == 0)
246
			if (overriddenInheritedMethods[i] == 0)
246
				closestMethods[index++] = methods[i];
247
				closestMethods[index++] = methods[i];
247
		methods = closestMethods;
248
		if (!checkInheritedReturnTypes(closestMethods, index))
248
		length = index;
249
			return;
249
	}
250
	} else if (!checkInheritedReturnTypes(methods, length)) {
250
251
	if (!checkInheritedReturnTypes(methods, length))
252
		return;
251
		return;
252
	}
253
253
254
	MethodBinding concreteMethod = null;
254
	MethodBinding concreteMethod = null;
255
	if (!type.isInterface()) {  // ignore concrete methods for interfaces
255
	if (!type.isInterface()) {  // ignore concrete methods for interfaces
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (+23 lines)
Lines 7808-7811 Link Here
7808
		""
7808
		""
7809
	);
7809
	);
7810
}
7810
}
7811
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=190748
7812
public void test143() {
7813
	this.runConformTest(
7814
		new String[] {
7815
			"X.java",
7816
			"public class X {\n" + 
7817
			"    public static void main(String[] s) { ((IBase) new Impl()).get(); }\n" +
7818
			"}\n" + 
7819
			"class Impl extends AImpl implements IBase, IEnhanced {}\n" + 
7820
			"interface IBase {\n" + 
7821
			"	IBaseReturn get();\n" + 
7822
			"}\n" + 
7823
			"interface IEnhanced extends IBase {\n" + 
7824
			"	IEnhancedReturn get();\n" + 
7825
			"}\n" + 
7826
			"abstract class AImpl {\n" + 
7827
			"	public IEnhancedReturn get() { return null; }\n" + 
7828
			"}\n" + 
7829
			"interface IBaseReturn {}\n" + 
7830
			"interface IEnhancedReturn extends IBaseReturn {}"
7831
		},
7832
		"");
7833
}
7811
}
7834
}

Return to bug 190748