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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java (+24 lines)
Lines 3454-3459 Link Here
3454
		"");
3454
		"");
3455
}
3455
}
3456
3456
3457
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=190748
3458
public void test106() {
3459
	this.runConformTest(
3460
		new String[] {
3461
			"X.java",
3462
			"public class X {\n" + 
3463
			"    public static void main(String[] s) { ((IBase) new Impl()).get(); }\n" +
3464
			"}\n" + 
3465
			"class Impl extends AImpl implements IBase, IEnhanced {}\n" + 
3466
			"interface IBase {\n" + 
3467
			"	IBaseReturn get();\n" + 
3468
			"}\n" + 
3469
			"interface IEnhanced extends IBase {\n" + 
3470
			"	IEnhancedReturn get();\n" + 
3471
			"}\n" + 
3472
			"abstract class AImpl {\n" + 
3473
			"	public IEnhancedReturn get() { return null; }\n" + 
3474
			"}\n" + 
3475
			"interface IBaseReturn {}\n" + 
3476
			"interface IEnhancedReturn extends IBaseReturn {}"
3477
		},
3478
		"");
3479
}
3480
3457
public static Class testClass() {
3481
public static Class testClass() {
3458
	return Compliance_1_5.class;
3482
	return Compliance_1_5.class;
3459
}
3483
}
(-)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

Return to bug 190748