Community
Participate
Working Groups
Build Identifier: M20090211-1700 While resolving an (explicit) 'extends' or 'implements' clause (e.g. extends Object), Eclipse scans all the type names (e.g. BlackCat) made available via static import. If it finds a name that WOULD create a cycle, then it will sometimes report 'cycle detected' even though there isn't one. Whether these spurious errors appear seems to depend on compilation order. At least, that's my conclusion from the 'steps to reproduce'. What's actually going on may be more complicated, or different entirely. Reproducible: Sometimes Steps to Reproduce: 1. Create a project with the following two files. It should compile. 2. Uncomment the static import. The errors should appear. - If you don't see the errors, try 'Project -> Clean'. 3. Remove the words "extends Object". The errors disappear. eclipsecyclebug/BrownBox.java: package eclipsecyclebug; import static eclipsecyclebug.GreenBox.*; public interface BrownBox { public static class BlackCat extends Cat {} } eclipsecyclebug/GreenBox.java: package eclipsecyclebug; //import static eclipsecyclebug.BrownBox.*; public interface GreenBox { public static class Cat extends Object {} } The errors: BrownBox.java: "Cycle detected: a cycle exists in the type hierarchy between BrownBox.BlackCat and GreenBox.Cat" GreenBox.java: "The hierarchy of type Cat is inconsistent"
A thought: Eclipse seems to compile in reverse alphabetical order for me. It's probably trying to resolve GreenBox.Cat first. In order to resolve the 'extends' clause, it has to resolve the static imports. While doing that, it finds BrownBox.BlackCat, and sees that it extends GreenBox.Cat - a type it is already trying to resolve. Hence it generates a 'cycle' error. Hope that helps!
Reproduced with 3.6. I'll investigate.
Created attachment 174598 [details] Patch under consideration. I discussed this with Ayush and we agreed that I'll fix this and he will review the patch.
Comment on attachment 174598 [details] Patch under consideration. This patch is the result of muddled thinking. Will need rework.
Created attachment 174702 [details] Patch under test
All tests pass, Ayush, please review, TIA.
(In reply to comment #6) > All tests pass, Ayush, please review, TIA. Looks good.
Released in HEAD for 3.7 M1
Verified for 3.7M1.