Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Clement2013-05-16 07:57:10 +0000
committerJayaprakash Arthanareeswaran2013-05-16 10:59:15 +0000
commitd504f3ee4554d924263bccdb7da657985d25b9cf (patch)
tree2df0967d04648bd4b1ccb37c9123feef7e1eae7c
parent5307df6ab365bbef43ce64f312671ce658989b80 (diff)
downloadeclipse.jdt.core-d504f3ee4554d924263bccdb7da657985d25b9cf.tar.gz
eclipse.jdt.core-d504f3ee4554d924263bccdb7da657985d25b9cf.tar.xz
eclipse.jdt.core-d504f3ee4554d924263bccdb7da657985d25b9cf.zip
Bug 406928 - computation of inherited methods seems damaged (affecting
@Overrides)
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java25
-rw-r--r--org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java31
-rw-r--r--org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java11
3 files changed, 60 insertions, 7 deletions
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
index f83ec1fab9..85d773c4c8 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java
@@ -17,6 +17,8 @@
* bug 388800 - [1.8] adjust tests to 1.8 JRE
* bug 388795 - [compiler] detection of name clash depends on order of super interfaces
* bug 388739 - [1.8][compiler] consider default methods when detecting whether a class needs to be declared abstract
+ * bug 395681 - [compiler] Improve simulation of javac6 behavior from bug 317719 after fixing bug 388795
+ * bug 406928 - computation of inherited methods seems damaged (affecting @Overrides)
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
@@ -32480,18 +32482,28 @@ public void test0986() {
public void test0987() {
String expectedOutput = new CompilerOptions(getCompilerOptions()).sourceLevel < ClassFileConstants.JDK1_6
? "----------\n" +
- "1. ERROR in X.java (at line 11)\n" +
+ "1. ERROR in X.java (at line 7)\n" +
+ " abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "The return types are incompatible for the inherited methods EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 11)\n" +
" public ISheetViewer getViewer() { return null; } \n" +
" ^^^^^^^^^^^^\n" +
"The return type is incompatible with EditPart.getViewer()\n" +
"----------\n" +
- "2. ERROR in X.java (at line 11)\n" +
+ "3. ERROR in X.java (at line 11)\n" +
" public ISheetViewer getViewer() { return null; } \n" +
" ^^^^^^^^^^^\n" +
"The method getViewer() of type AbstractLinkView<M> must override a superclass method\n" +
"----------\n"
: "----------\n" +
- "1. ERROR in X.java (at line 11)\n" +
+ "1. ERROR in X.java (at line 7)\n" +
+ " abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "The return types are incompatible for the inherited methods EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 11)\n" +
" public ISheetViewer getViewer() { return null; } \n" +
" ^^^^^^^^^^^^\n" +
"The return type is incompatible with EditPart.getViewer()\n" +
@@ -32580,7 +32592,12 @@ public void test0988() {
"}", // =================
},
"----------\n" +
- "1. ERROR in X.java (at line 11)\n" +
+ "1. ERROR in X.java (at line 7)\n" +
+ " abstract class GLinkElementView<M,CM> extends AbstractLinkView<M> {}\n" +
+ " ^^^^^^^^^^^^^^^^\n" +
+ "The return types are incompatible for the inherited methods ILinkViewElement.getViewer(), EditPart.getViewer(), AbstractLinkView<M>.getViewer()\n" +
+ "----------\n" +
+ "2. ERROR in X.java (at line 11)\n" +
" public SheetViewer getViewer() { return null; } \n" +
" ^^^^^^^^^^^\n" +
"The return type is incompatible with AbstractEditPart.getViewer()\n" +
diff --git a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java
index 653d2b9e5c..b116ab15ac 100644
--- a/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java
+++ b/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/MethodVerifyTest.java
@@ -11,11 +11,21 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+<<<<<<< BETA_JAVA8
* Stephan Herrmann - Contribution for
* bug 388800 - [1.8] adjust tests to 1.8 JRE
+=======
+ * Stephan Herrmann - Contributions for
+>>>>>>> 97c9363 Bug 406928 - computation of inherited methods seems damaged (affecting @Overrides)
* bug 388795 - [compiler] detection of name clash depends on order of super interfaces
+<<<<<<< BETA_JAVA8
* bug 388739 - [1.8][compiler] consider default methods when detecting whether a class needs to be declared abstract
* bug 402237 - [1.8][compiler] investigate differences between compilers re MethodVerifyTest
+=======
+ * bug 395681 - [compiler] Improve simulation of javac6 behavior from bug 317719 after fixing bug 388795
+ * Andy Clement - Contribution for
+ * bug 406928 - computation of inherited methods seems damaged (affecting @Overrides)
+>>>>>>> 97c9363 Bug 406928 - computation of inherited methods seems damaged (affecting @Overrides)
*******************************************************************************/
package org.eclipse.jdt.core.tests.compiler.regression;
@@ -37,7 +47,7 @@ import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
public class MethodVerifyTest extends AbstractComparableTest {
static {
-// TESTS_NAMES = new String[] { "testBug317719" };
+// TESTS_NAMES = new String[] { "testBug406928" };
// TESTS_NUMBERS = new int[] { 213 };
// TESTS_RANGE = new int[] { 190, -1};
}
@@ -13911,4 +13921,23 @@ public void testBug384580() {
"Name clash: The method m() of type Foo has the same erasure as m() of type Y but does not override it\n" +
"----------\n");
}
+// https://bugs.eclipse.org/406928 - computation of inherited methods seems damaged (affecting @Overrides)
+public void testBug406928() {
+ if (this.complianceLevel < ClassFileConstants.JDK1_6) return;
+ this.runConformTest(
+ new String[] {
+ "TestPointcut.java",
+ "interface MethodMatcher {\n"+
+ " boolean matches();\n"+
+ "}\n"+
+ "abstract class StaticMethodMatcher implements MethodMatcher { }\n"+
+ "abstract class StaticMethodMatcherPointcut extends StaticMethodMatcher { }\n"+
+ "\n"+
+ "class TestPointcut extends StaticMethodMatcherPointcut {\n"+
+ " @Override\n"+
+ " public boolean matches() { return false; } \n"+
+ "}\n"
+ },
+ "");
+}
}
diff --git a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java
index 7ea05174ec..212fcaaf9a 100644
--- a/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java
+++ b/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/MethodVerifier.java
@@ -19,6 +19,9 @@
* bug 388739 - [1.8][compiler] consider default methods when detecting whether a class needs to be declared abstract
* bug 390883 - [1.8][compiler] Unable to override default method
* bug 401796 - [1.8][compiler] don't treat default methods as overriding an independent inherited abstract method
+ * bug 388281 - [compiler][null] inheritance of null annotations as an option
+ * bug 395681 - [compiler] Improve simulation of javac6 behavior from bug 317719 after fixing bug 388795
+ * bug 406928 - computation of inherited methods seems damaged (affecting @Overrides)
*******************************************************************************/
package org.eclipse.jdt.internal.compiler.lookup;
@@ -578,8 +581,12 @@ void computeInheritedMethods(ReferenceBinding superclass, ReferenceBinding[] sup
List superIfcList = new ArrayList();
HashSet seenTypes = new HashSet();
collectAllDistinctSuperInterfaces(superInterfaces, seenTypes, superIfcList);
- if (superclass != null)
- collectAllDistinctSuperInterfaces(superclass.superInterfaces(), seenTypes, superIfcList);
+ ReferenceBinding currentSuper = superclass;
+ while (currentSuper != null && currentSuper.id != TypeIds.T_JavaLangObject) {
+ collectAllDistinctSuperInterfaces(currentSuper.superInterfaces(), seenTypes, superIfcList);
+ currentSuper = currentSuper.superclass();
+ }
+
if (superIfcList.size() == 0) return;
if (superIfcList.size() == 1) {

Back to the top