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

Collapse All | Expand All

(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-6 / +1 lines)
Lines 708-719 Link Here
708
				"abstract class X2 extends A implements J {}\n"
708
				"abstract class X2 extends A implements J {}\n"
709
			},
709
			},
710
			"----------\n" + 
710
			"----------\n" + 
711
			"1. ERROR in A.java (at line 1)\r\n" + 
711
			"1. ERROR in A.java (at line 2)\r\n" + 
712
			"	abstract class A implements I {}\r\n" + 
713
			"	               ^\n" + 
714
			"The return type is incompatible with J.foo(), I.foo()\n" + 
715
			"----------\n" + 
716
			"2. ERROR in A.java (at line 2)\r\n" + 
717
			"	interface I extends J { Object foo(); }\r\n" + 
712
			"	interface I extends J { Object foo(); }\r\n" + 
718
			"	                               ^^^^^\n" + 
713
			"	                               ^^^^^\n" + 
719
			"The return type is incompatible with J.foo()\n" + 
714
			"The return type is incompatible with J.foo()\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-14 / +4 lines)
Lines 31231-31258 Link Here
31231
public void test0987() {
31231
public void test0987() {
31232
	String expectedOutput = new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6
31232
	String expectedOutput = new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6
31233
	?	"----------\n" + 
31233
	?	"----------\n" + 
31234
		"1. ERROR in X.java (at line 7)\n" + 
31234
		"1. ERROR in X.java (at line 11)\n" + 
31235
		"	abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31236
		"	               ^^^^^^^^^^^^^^^^\n" + 
31237
		"The return type is incompatible with EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + 
31238
		"----------\n" + 
31239
		"2. ERROR in X.java (at line 11)\n" + 
31240
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31235
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31241
		"	                    ^^^^^^^^^^^\n" + 
31236
		"	                    ^^^^^^^^^^^\n" + 
31242
		"The return type is incompatible with EditPart.getViewer()\n" + 
31237
		"The return type is incompatible with EditPart.getViewer()\n" + 
31243
		"----------\n" + 
31238
		"----------\n" + 
31244
		"3. ERROR in X.java (at line 11)\n" + 
31239
		"2. ERROR in X.java (at line 11)\n" + 
31245
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31240
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31246
		"	                    ^^^^^^^^^^^\n" + 
31241
		"	                    ^^^^^^^^^^^\n" + 
31247
		"The method getViewer() of type AbstractLinkView<M> must override a superclass method\n" + 
31242
		"The method getViewer() of type AbstractLinkView<M> must override a superclass method\n" + 
31248
		"----------\n"
31243
		"----------\n"
31249
	:	"----------\n" + 
31244
	:	"----------\n" + 
31250
		"1. ERROR in X.java (at line 7)\n" + 
31245
		"1. ERROR in X.java (at line 11)\n" + 
31251
		"	abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31252
		"	               ^^^^^^^^^^^^^^^^\n" + 
31253
		"The return type is incompatible with EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + 
31254
		"----------\n" + 
31255
		"2. ERROR in X.java (at line 11)\n" + 
31256
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31246
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31257
		"	                    ^^^^^^^^^^^\n" + 
31247
		"	                    ^^^^^^^^^^^\n" + 
31258
		"The return type is incompatible with EditPart.getViewer()\n" + 
31248
		"The return type is incompatible with EditPart.getViewer()\n" + 
Lines 31344-31350 Link Here
31344
			"1. ERROR in X.java (at line 7)\n" + 
31334
			"1. ERROR in X.java (at line 7)\n" + 
31345
			"	abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31335
			"	abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31346
			"	               ^^^^^^^^^^^^^^^^\n" + 
31336
			"	               ^^^^^^^^^^^^^^^^\n" + 
31347
			"The return type is incompatible with ILinkViewElement.getViewer(), AbstractEditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + 
31337
			"The return type is incompatible with AbstractEditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + 
31348
			"----------\n" + 
31338
			"----------\n" + 
31349
			"2. ERROR in X.java (at line 11)\n" + 
31339
			"2. ERROR in X.java (at line 11)\n" + 
31350
			"	public SheetViewer getViewer() { return null; }	\n" + 
31340
			"	public SheetViewer getViewer() { return null; }	\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (-4 / +4 lines)
Lines 1076-1082 Link Here
1076
	"2");
1076
	"2");
1077
}	
1077
}	
1078
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162026
1078
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162026
1079
public void _test025() {
1079
public void test025() {
1080
	this.runConformTest(
1080
	this.runConformTest(
1081
		new String[] {
1081
		new String[] {
1082
			"X.java",
1082
			"X.java",
Lines 1242-1248 Link Here
1242
		"ERROR");
1242
		"ERROR");
1243
}
1243
}
1244
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162073
1244
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162073
1245
public void _test032() {
1245
public void test032() {
1246
	this.runConformTest(
1246
	this.runConformTest(
1247
		new String[] {
1247
		new String[] {
1248
			"X.java",
1248
			"X.java",
Lines 1309-1315 Link Here
1309
		"2. ERROR in X.java (at line 10)\n" + 
1309
		"2. ERROR in X.java (at line 10)\n" + 
1310
		"	public abstract class X implements J, K {\n" + 
1310
		"	public abstract class X implements J, K {\n" + 
1311
		"	                      ^\n" + 
1311
		"	                      ^\n" + 
1312
		"The return type is incompatible with I.foo(Number), K.foo(Number), J.foo(Number)\n" + 
1312
		"The return type is incompatible with K.foo(Number), J.foo(Number)\n" + 
1313
		"----------\n");
1313
		"----------\n");
1314
}
1314
}
1315
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162065
1315
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162065
Lines 1369-1375 Link Here
1369
			"}\n" + 
1369
			"}\n" + 
1370
			"public abstract class X extends J implements I {\n" + 
1370
			"public abstract class X extends J implements I {\n" + 
1371
			"  void bar() {\n" + 
1371
			"  void bar() {\n" + 
1372
			"    foo(0.0f);\n" + // ambiguous
1372
			"    String s = foo(0.0f);\n" + // ambiguous
1373
			"  }\n" + 
1373
			"  }\n" + 
1374
			"}"
1374
			"}"
1375
		},
1375
		},
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java (-1 / +2 lines)
Lines 528-534 Link Here
528
528
529
	inheritedMethod = computeSubstituteMethod(inheritedMethod, existingMethod);
529
	inheritedMethod = computeSubstituteMethod(inheritedMethod, existingMethod);
530
	return inheritedMethod != null
530
	return inheritedMethod != null
531
		&& inheritedMethod.returnType == existingMethod.returnType
531
		&& (inheritedMethod.returnType == existingMethod.returnType ||
532
				inheritedMethod.returnType.isCompatibleWith(inheritedMethod.returnType))
532
		&& super.isInterfaceMethodImplemented(inheritedMethod, existingMethod, superType);
533
		&& super.isInterfaceMethodImplemented(inheritedMethod, existingMethod, superType);
533
}
534
}
534
SimpleSet findSuperinterfaceCollisions(ReferenceBinding superclass, ReferenceBinding[] superInterfaces) {
535
SimpleSet findSuperinterfaceCollisions(ReferenceBinding superclass, ReferenceBinding[] superInterfaces) {
(-)compiler/org/eclipse/jdt/internal/compiler/lookup/Scope.java (-2 / +6 lines)
Lines 3324-3331 Link Here
3324
							original2 = original.computeSubstitutedMethod(original2, environment());
3324
							original2 = original.computeSubstitutedMethod(original2, environment());
3325
						if (original2 == null || !original.areParameterErasuresEqual(original2))
3325
						if (original2 == null || !original.areParameterErasuresEqual(original2))
3326
							continue nextSpecific; // current does not override next
3326
							continue nextSpecific; // current does not override next
3327
						if (!original.returnType.isCompatibleWith(original2.returnType)) // 15.12.2
3327
						// so we override - making an attempt, considering that real return type incompatibilities have been caught by the verifier
3328
							continue nextSpecific; // choose original2 instead
3328
						// tests pass but I (maxime) suspect that this could trigger other bugs if more binary types were involved; augment test coverage
3329
//						if (!original.returnType.isCompatibleWith(original2.returnType)) // 15.12.2
3330
//						{
3331
//							continue nextSpecific; // choose original2 instead
3332
//						}
3329
						if (original.thrownExceptions != original2.thrownExceptions) {
3333
						if (original.thrownExceptions != original2.thrownExceptions) {
3330
							if (mostSpecificExceptions == null)
3334
							if (mostSpecificExceptions == null)
3331
								mostSpecificExceptions = original.thrownExceptions;
3335
								mostSpecificExceptions = original.thrownExceptions;

Return to bug 162026