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

Collapse All | Expand All

(-)compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier15.java (-2 / +3 lines)
Lines 552-565 Link Here
552
	// one has type variables and substituteTwo did not pass bounds check in computeSubstituteMethod()
552
	// one has type variables and substituteTwo did not pass bounds check in computeSubstituteMethod()
553
	return one.typeVariables != Binding.NO_TYPE_VARIABLES && !(substituteTwo instanceof ParameterizedGenericMethodBinding);
553
	return one.typeVariables != Binding.NO_TYPE_VARIABLES && !(substituteTwo instanceof ParameterizedGenericMethodBinding);
554
}
554
}
555
// caveat: returns false if a method is implemented but needs that a bridge 
556
//         method be generated
555
boolean isInterfaceMethodImplemented(MethodBinding inheritedMethod, MethodBinding existingMethod, ReferenceBinding superType) {
557
boolean isInterfaceMethodImplemented(MethodBinding inheritedMethod, MethodBinding existingMethod, ReferenceBinding superType) {
556
	if (inheritedMethod.original() != inheritedMethod && existingMethod.declaringClass.isInterface())
558
	if (inheritedMethod.original() != inheritedMethod && existingMethod.declaringClass.isInterface())
557
		return false; // must hold onto ParameterizedMethod to see if a bridge method is necessary
559
		return false; // must hold onto ParameterizedMethod to see if a bridge method is necessary
558
560
559
	inheritedMethod = computeSubstituteMethod(inheritedMethod, existingMethod);
561
	inheritedMethod = computeSubstituteMethod(inheritedMethod, existingMethod);
560
	return inheritedMethod != null
562
	return inheritedMethod != null
561
		&& (inheritedMethod.returnType == existingMethod.returnType ||
563
		&& inheritedMethod.returnType == existingMethod.returnType
562
				inheritedMethod.returnType.isCompatibleWith(inheritedMethod.returnType))
563
		&& super.isInterfaceMethodImplemented(inheritedMethod, existingMethod, superType);
564
		&& super.isInterfaceMethodImplemented(inheritedMethod, existingMethod, superType);
564
}
565
}
565
SimpleSet findSuperinterfaceCollisions(ReferenceBinding superclass, ReferenceBinding[] superInterfaces) {
566
SimpleSet findSuperinterfaceCollisions(ReferenceBinding superclass, ReferenceBinding[] superInterfaces) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/InnerEmulationTest.java (-2 / +2 lines)
Lines 5347-5353 Link Here
5347
		"----------\n");
5347
		"----------\n");
5348
}
5348
}
5349
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=168331
5349
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=168331
5350
public void _test133() {
5350
public void test133() {
5351
	if (this.complianceLevel.compareTo(COMPLIANCE_1_5) >= 0) {
5351
	if (this.complianceLevel.compareTo(COMPLIANCE_1_5) >= 0) {
5352
		this.runConformTest(
5352
		this.runConformTest(
5353
			new String[] {
5353
			new String[] {
Lines 5382-5388 Link Here
5382
	}
5382
	}
5383
}
5383
}
5384
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=168331
5384
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=168331
5385
public void _test134() {
5385
public void test134() {
5386
	if (this.complianceLevel.compareTo(COMPLIANCE_1_5) >= 0) {
5386
	if (this.complianceLevel.compareTo(COMPLIANCE_1_5) >= 0) {
5387
		this.runConformTest(
5387
		this.runConformTest(
5388
			new String[] {
5388
			new String[] {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java (-4 / +9 lines)
Lines 708-721 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 2)\r\n" + 
711
			"1. ERROR in A.java (at line 1)\n" + 
712
			"	interface I extends J { Object foo(); }\r\n" + 
712
			"	abstract class A implements I {}\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)\n" + 
717
			"	interface I extends J { Object foo(); }\n" + 
713
			"	                        ^^^^^^\n" + 
718
			"	                        ^^^^^^\n" + 
714
			"The return type is incompatible with J.foo()\n" + 
719
			"The return type is incompatible with J.foo()\n" + 
715
			"----------\n" + 
720
			"----------\n" + 
716
			"----------\n" + 
721
			"----------\n" + 
717
			"1. ERROR in X.java (at line 1)\r\n" + 
722
			"1. ERROR in X.java (at line 1)\n" + 
718
			"	abstract class X2 extends A implements J {}\r\n" + 
723
			"	abstract class X2 extends A implements J {}\n" + 
719
			"	               ^^\n" + 
724
			"	               ^^\n" + 
720
			"The return type is incompatible with I.foo(), J.foo()\n" + 
725
			"The return type is incompatible with I.foo(), J.foo()\n" + 
721
			"----------\n"
726
			"----------\n"
(-)src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java (-6 / +16 lines)
Lines 31465-31486 Link Here
31465
			},
31465
			},
31466
			"S100MyClass = [Terry]MyClass = [Corbet]SUCCESS");
31466
			"S100MyClass = [Terry]MyClass = [Corbet]SUCCESS");
31467
}
31467
}
31468
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140643
31468
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=140643
31469
public void test0987() {
31469
public void test0987() {
31470
	String expectedOutput = new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6
31470
	String expectedOutput = new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6
31471
	?	"----------\n" + 
31471
	?	"----------\n" + 
31472
		"1. ERROR in X.java (at line 11)\n" + 
31472
		"1. ERROR in X.java (at line 7)\n" + 
31473
		"	abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31474
		"	               ^^^^^^^^^^^^^^^^\n" + 
31475
		"The return type is incompatible with EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + 
31476
		"----------\n" + 
31477
		"2. ERROR in X.java (at line 11)\n" + 
31473
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31478
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31474
		"	       ^^^^^^^^^^^^\n" + 
31479
		"	       ^^^^^^^^^^^^\n" + 
31475
		"The return type is incompatible with EditPart.getViewer()\n" + 
31480
		"The return type is incompatible with EditPart.getViewer()\n" + 
31476
		"----------\n" + 
31481
		"----------\n" + 
31477
		"2. ERROR in X.java (at line 11)\n" + 
31482
		"3. ERROR in X.java (at line 11)\n" + 
31478
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31483
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31479
		"	                    ^^^^^^^^^^^\n" + 
31484
		"	                    ^^^^^^^^^^^\n" + 
31480
		"The method getViewer() of type AbstractLinkView<M> must override a superclass method\n" + 
31485
		"The method getViewer() of type AbstractLinkView<M> must override a superclass method\n" + 
31481
		"----------\n"
31486
		"----------\n"
31482
	:	"----------\n" + 
31487
	:	"----------\n" + 
31483
		"1. ERROR in X.java (at line 11)\n" + 
31488
		"1. ERROR in X.java (at line 7)\n" + 
31489
		"	abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31490
		"	               ^^^^^^^^^^^^^^^^\n" + 
31491
		"The return type is incompatible with EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + 
31492
		"----------\n" + 
31493
		"2. ERROR in X.java (at line 11)\n" + 
31484
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31494
		"	public ISheetViewer getViewer() { return null; }	\n" + 
31485
		"	       ^^^^^^^^^^^^\n" + 
31495
		"	       ^^^^^^^^^^^^\n" + 
31486
		"The return type is incompatible with EditPart.getViewer()\n" + 
31496
		"The return type is incompatible with EditPart.getViewer()\n" + 
Lines 31521-31527 Link Here
31521
			},
31531
			},
31522
			expectedOutput);
31532
			expectedOutput);
31523
}
31533
}
31524
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=140643 - variation
31534
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=140643 - variation
31525
public void test0988() {
31535
public void test0988() {
31526
	this.runNegativeTest(
31536
	this.runNegativeTest(
31527
			new String[] {
31537
			new String[] {
Lines 31572-31578 Link Here
31572
			"1. ERROR in X.java (at line 7)\n" + 
31582
			"1. ERROR in X.java (at line 7)\n" + 
31573
			"	abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31583
			"	abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" + 
31574
			"	               ^^^^^^^^^^^^^^^^\n" + 
31584
			"	               ^^^^^^^^^^^^^^^^\n" + 
31575
			"The return type is incompatible with AbstractEditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + 
31585
			"The return type is incompatible with ILinkViewElement.getViewer(), AbstractEditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" + 
31576
			"----------\n" + 
31586
			"----------\n" + 
31577
			"2. ERROR in X.java (at line 11)\n" + 
31587
			"2. ERROR in X.java (at line 11)\n" + 
31578
			"	public SheetViewer getViewer() { return null; }	\n" + 
31588
			"	public SheetViewer getViewer() { return null; }	\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AmbiguousMethodTest.java (-2 / +23 lines)
Lines 1474-1480 Link Here
1474
		"");
1474
		"");
1475
}
1475
}
1476
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162073
1476
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162073
1477
// variant that passes
1477
// variant that shows that the use of a substitution is needed during the bounds
1478
// check
1479
public void _test032a() {
1480
	this.runConformTest(
1481
		new String[] {
1482
			"X.java",
1483
			"class Z { }\n" +
1484
			"class Y <U> extends Z { }" +
1485
			"interface I {\n" + 
1486
			"  <T extends Y<T> & Cloneable> T foo(Number n);\n" + 
1487
			"}\n" + 
1488
			"interface J extends I {\n" + 
1489
			"  XX foo(Number n);\n" + 
1490
			"}\n" + 
1491
			"public abstract class X implements J {\n" + 
1492
			"}\n" + 
1493
			"abstract class XX extends Y<XX> implements Cloneable {}"
1494
		},
1495
		"");
1496
}
1497
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162073
1498
// variant
1478
public void test033() {
1499
public void test033() {
1479
	this.runConformTest(
1500
	this.runConformTest(
1480
		new String[] {
1501
		new String[] {
Lines 1524-1530 Link Here
1524
		"2. ERROR in X.java (at line 10)\n" + 
1545
		"2. ERROR in X.java (at line 10)\n" + 
1525
		"	public abstract class X implements J, K {\n" + 
1546
		"	public abstract class X implements J, K {\n" + 
1526
		"	                      ^\n" + 
1547
		"	                      ^\n" + 
1527
		"The return type is incompatible with K.foo(Number), J.foo(Number)\n" + 
1548
		"The return type is incompatible with I.foo(Number), K.foo(Number), J.foo(Number)\n" + 
1528
		"----------\n");
1549
		"----------\n");
1529
}
1550
}
1530
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162065
1551
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=162065

Return to bug 168331