Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 174598 Details for
Bug 319885
Spurious 'cycle detected'/'hierarchy inconsistent' errors if a type that WOULD be cyclic is static-imported
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Patch under consideration.
patch.txt (text/plain), 9.81 KB, created by
Srikanth Sankaran
on 2010-07-19 05:14:33 EDT
(
hide
)
Description:
Patch under consideration.
Filename:
MIME Type:
Creator:
Srikanth Sankaran
Created:
2010-07-19 05:14:33 EDT
Size:
9.81 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >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.178 >diff -u -r1.178 ClassScope.java >--- compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 7 Jul 2010 05:56:10 -0000 1.178 >+++ compiler/org/eclipse/jdt/internal/compiler/lookup/ClassScope.java 19 Jul 2010 09:13:05 -0000 >@@ -1168,6 +1168,15 @@ > org.eclipse.jdt.internal.compiler.ast.TypeReference ref = ((SourceTypeBinding) superType).scope.superTypeReference; > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=133071 > // https://bugs.eclipse.org/bugs/show_bug.cgi?id=121734 >+ if (ref != null && ref.resolvedType == null) { >+ // https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885, the edges we traversed may not >+ // really be closing into a cycle. Cannot compare bindings yet, so use names instead. >+ char [] referredName = ref.getLastToken(); >+ char [] sourceName = superType.sourceName(); >+ if (!CharOperation.equals(referredName, sourceName)) { >+ ref = null; // no cycle really. >+ } >+ } > if (ref != null && (ref.resolvedType == null || ((ReferenceBinding) ref.resolvedType).isHierarchyBeingActivelyConnected())) { > problemReporter().hierarchyCircularity(sourceType, superType, reference); > sourceType.tagBits |= TagBits.HierarchyHasProblems; >#P org.eclipse.jdt.core.tests.compiler >Index: src/org/eclipse/jdt/core/tests/compiler/regression/InnerClass15Test.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/InnerClass15Test.java,v >retrieving revision 1.1 >diff -u -r1.1 InnerClass15Test.java >--- src/org/eclipse/jdt/core/tests/compiler/regression/InnerClass15Test.java 21 Jun 2010 09:48:09 -0000 1.1 >+++ src/org/eclipse/jdt/core/tests/compiler/regression/InnerClass15Test.java 19 Jul 2010 09:13:12 -0000 >@@ -139,6 +139,226 @@ > "The type X is never used locally\n" + > "----------\n"); > } >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885 >+public void test005() { >+ this.runNegativeTest(new String[] { >+ "p1/GreenBox.java", >+ "package p1;\n" + >+ "import static p1.BrownBox.*;\n" + >+ "public interface GreenBox {\n" + >+ " public static class Cat extends Object {}\n" + >+ "}\n", >+ "p1/BrownBox.java", >+ "package p1;\n" + >+ "import static p1.GreenBox.*;\n" + >+ "public interface BrownBox {\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. WARNING in p1\\GreenBox.java (at line 2)\n" + >+ " import static p1.BrownBox.*;\n" + >+ " ^^^^^^^^^^^\n" + >+ "The import p1.BrownBox is never used\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885 >+public void test006() { >+ this.runNegativeTest(new String[] { >+ "p1/BrownBox.java", >+ "package p1;\n" + >+ "import static p1.GreenBox.*;\n" + >+ "public interface BrownBox {\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ "}\n", >+ "p1/GreenBox.java", >+ "package p1;\n" + >+ "import static p1.BrownBox.*;\n" + >+ "public interface GreenBox {\n" + >+ " public static class Cat extends Object {}\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. WARNING in p1\\GreenBox.java (at line 2)\n" + >+ " import static p1.BrownBox.*;\n" + >+ " ^^^^^^^^^^^\n" + >+ "The import p1.BrownBox is never used\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885 >+public void test007() { >+ this.runNegativeTest(new String[] { >+ "p1/BrownBox.java", >+ "package p1;\n" + >+ "import static p1.GreenBox.*;\n" + >+ "public interface BrownBox {\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ "}\n", >+ "p1/GreenBox.java", >+ "package p1;\n" + >+ "import static p1.BrownBox.*;\n" + >+ "public interface GreenBox {\n" + >+ " public static class Cat extends java.lang.Object {}\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. WARNING in p1\\GreenBox.java (at line 2)\n" + >+ " import static p1.BrownBox.*;\n" + >+ " ^^^^^^^^^^^\n" + >+ "The import p1.BrownBox is never used\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885 >+public void test008() { >+ this.runNegativeTest(new String[] { >+ "p1/BrownBox.java", >+ "package p1;\n" + >+ "import static p1.GreenBox.*;\n" + >+ "public interface BrownBox {\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ "}\n", >+ "p1/GreenBox.java", >+ "package p1;\n" + >+ "import static p1.BrownBox.*;\n" + >+ "public interface GreenBox {\n" + >+ " public static class Cat extends BlackCat {}\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in p1\\BrownBox.java (at line 4)\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ " ^^^^^^^^\n" + >+ "The hierarchy of the type BlackCat is inconsistent\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. ERROR in p1\\GreenBox.java (at line 4)\n" + >+ " public static class Cat extends BlackCat {}\n" + >+ " ^^^^^^^^\n" + >+ "Cycle detected: a cycle exists in the type hierarchy between GreenBox.Cat and BrownBox.BlackCat\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885 >+public void test009() { >+ this.runNegativeTest(new String[] { >+ "p1/GreenBox.java", >+ "package p1;\n" + >+ "import static p1.BrownBox.*;\n" + >+ "public interface GreenBox {\n" + >+ " public static class Cat extends BlackCat {}\n" + >+ "}\n", >+ "p1/BrownBox.java", >+ "package p1;\n" + >+ "import static p1.GreenBox.*;\n" + >+ "public interface BrownBox {\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in p1\\GreenBox.java (at line 4)\n" + >+ " public static class Cat extends BlackCat {}\n" + >+ " ^^^\n" + >+ "The hierarchy of the type Cat is inconsistent\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. ERROR in p1\\BrownBox.java (at line 4)\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ " ^^^\n" + >+ "Cycle detected: a cycle exists in the type hierarchy between BrownBox.BlackCat and GreenBox.Cat\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885 >+public void test0010() { >+ this.runNegativeTest(new String[] { >+ "p1/GreenBox.java", >+ "package p1;\n" + >+ "import static p1.BrownBox.*;\n" + >+ "interface SuperInterface {\n" + >+ " public static class Cat extends BlackCat {}\n" + >+ "}\n" + >+ "public interface GreenBox {\n" + >+ "}\n", >+ "p1/BrownBox.java", >+ "package p1;\n" + >+ "import static p1.GreenBox.*;\n" + >+ "public interface BrownBox {\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in p1\\GreenBox.java (at line 4)\n" + >+ " public static class Cat extends BlackCat {}\n" + >+ " ^^^\n" + >+ "The hierarchy of the type Cat is inconsistent\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. ERROR in p1\\BrownBox.java (at line 4)\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ " ^^^\n" + >+ "Cat cannot be resolved to a type\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885 >+public void test0011() { >+ this.runNegativeTest(new String[] { >+ "p1/GreenBox.java", >+ "package p1;\n" + >+ "import static p1.BrownBox.*;\n" + >+ "interface SuperInterface {\n" + >+ " public static class Cat extends BlackCat {}\n" + >+ "}\n" + >+ "public interface GreenBox extends SuperInterface {\n" + >+ "}\n", >+ "p1/BrownBox.java", >+ "package p1;\n" + >+ "import static p1.GreenBox.*;\n" + >+ "public interface BrownBox {\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in p1\\GreenBox.java (at line 4)\n" + >+ " public static class Cat extends BlackCat {}\n" + >+ " ^^^\n" + >+ "The hierarchy of the type Cat is inconsistent\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. ERROR in p1\\BrownBox.java (at line 4)\n" + >+ " public static class BlackCat extends Cat {}\n" + >+ " ^^^\n" + >+ "Cycle detected: a cycle exists in the type hierarchy between BrownBox.BlackCat and SuperInterface.Cat\n" + >+ "----------\n"); >+} >+// https://bugs.eclipse.org/bugs/show_bug.cgi?id=319885 >+public void test0012() { >+ this.runNegativeTest(new String[] { >+ "p1/GreenBox.java", >+ "package p1;\n" + >+ "import static p1.BrownBox.*;\n" + >+ "interface SuperInterface {\n" + >+ " public static class Cat extends BlackCat {}\n" + >+ "}\n" + >+ "public interface GreenBox extends SuperInterface {\n" + >+ "}\n", >+ "p1/BrownBox.java", >+ "package p1;\n" + >+ "import static p1.GreenBox.*;\n" + >+ "public interface BrownBox {\n" + >+ " public static class BlackCat extends GreenBox.Cat {}\n" + >+ "}\n", >+ }, >+ "----------\n" + >+ "1. ERROR in p1\\GreenBox.java (at line 4)\n" + >+ " public static class Cat extends BlackCat {}\n" + >+ " ^^^\n" + >+ "The hierarchy of the type Cat is inconsistent\n" + >+ "----------\n" + >+ "----------\n" + >+ "1. ERROR in p1\\BrownBox.java (at line 4)\n" + >+ " public static class BlackCat extends GreenBox.Cat {}\n" + >+ " ^^^^^^^^^^^^\n" + >+ "Cycle detected: a cycle exists in the type hierarchy between BrownBox.BlackCat and SuperInterface.Cat\n" + >+ "----------\n"); >+} > public static Class testClass() { > return InnerClass15Test.class; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 319885
:
174598
|
174702