Index: src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java,v retrieving revision 1.629 diff -u -r1.629 GenericTypeTest.java --- src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 14 May 2007 16:39:50 -0000 1.629 +++ src/org/eclipse/jdt/core/tests/compiler/regression/GenericTypeTest.java 14 May 2007 20:36:30 -0000 @@ -32767,7 +32767,7 @@ ); } public void test1021b() { // should this case be allowed? - this.runConformTest( + this.runNegativeTest( new String[] { "p/SomeClass2.java", "package p;\n" + @@ -32780,7 +32780,12 @@ " }\n" + "}\n", }, - "" + "----------\n" + + "1. ERROR in p\\SomeClass2.java (at line 3)\n" + + " public abstract class SomeClass2 extends M {\n" + + " ^\n" + + "Cycle detected: the type SomeClass2 cannot extend/implement itself or one of its own member types\n" + + "----------\n" ); } // https://bugs.eclipse.org/bugs/show_bug.cgi?id=151410 (duplicate of 149376) @@ -37936,7 +37941,7 @@ } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=186833 public void test1139() { - this.runConformTest( + this.runNegativeTest( new String[] { "p/X.java", "package p;\n" + @@ -37952,7 +37957,13 @@ " }\n" + "}", // ================= }, - ""); + "----------\n" + + "1. ERROR in p\\X.java (at line 9)\r\n" + + " public class X extends Super> {\r\n" + + " ^^^^^\n" + + "Cycle detected: the type X cannot extend/implement itself or one of its own member types\n" + + "----------\n" + ); } //https://bugs.eclipse.org/bugs/show_bug.cgi?id=186788 public void test1140() { Index: compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java,v retrieving revision 1.148 diff -u -r1.148 ClassScope.java --- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 9 May 2007 17:18:18 -0000 1.148 +++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 14 May 2007 20:36:34 -0000 @@ -1029,18 +1029,17 @@ return true; } -// No longer believe this code is necessary, since we changed supertype lookup to use TypeReference resolution -// if (superType.isMemberType()) { -// ReferenceBinding current = superType.enclosingType(); -// do { -// if (current.isHierarchyBeingConnected()) { -// problemReporter().hierarchyCircularity(sourceType, current, reference); -// sourceType.tagBits |= TagBits.HierarchyHasProblems; -// current.tagBits |= TagBits.HierarchyHasProblems; -// return true; -// } -// } while ((current = current.enclosingType()) != null); -// } + if (superType.isMemberType()) { + ReferenceBinding current = superType.enclosingType(); + do { + if (current.isHierarchyBeingConnected() && current == sourceType) { + problemReporter().hierarchyCircularity(sourceType, current, reference); + sourceType.tagBits |= TagBits.HierarchyHasProblems; + current.tagBits |= TagBits.HierarchyHasProblems; + return true; + } + } while ((current = current.enclosingType()) != null); + } if (superType.isBinaryBinding()) { // force its superclass & superinterfaces to be found... 2 possibilities exist - the source type is included in the hierarchy of: