Community
Participate
Working Groups
Created attachment 79578 [details] Tarred & gzipped version of a project that exhibits the behavior Build ID: I20070621-1340 Steps To Reproduce: 1. Open attached project (note that there are no compiler errors) 2. Look at the syntax highlighting for class "C". Notice that it is flagged as a hierarchy error even though it is perfectly legal. More information: Under some circumstances, the Eclipse syntax highlighting flags perfectly legal class hierarchies with the "inconsistent class hierarchy", even though the compiler thinks that they're fine. Check out the attached project to see the problem. Even though the project contains no compile errors, if you open interface "C", Eclipse has highlighted the interface name with an "inconsistent hierarchy" error. I suspect that this is happening because the syntax highlighter is falsely detecting a cycle in the *hierarchy* (which really is illegal) because of a cycle in the *generics references* (which is perfectly legal, as far as I know). The bug seems to be specific to a very particular structure of interfaces. For example, look at the InnerExample class. It contains a collection of static inner interfaces whose relationships are perfectly analogous to those specified in the public classes A,B,C, and D. Yet the syntax highlighter doesn't have a problem with these. Another interesting wrinkle - If you change class B to this: public interface B extends A<C> {} the problem disappears. This is odd, because if the problem is circular class references, this version is to be just as circular as the original version.
Created attachment 80075 [details] Proposed patch We have a order dependent problem with source types as seen in this example: A.java interface A<T extends C> {} interface B extends A<D> {} interface D extends C {} C.java interface C extends B {} We should not report a cycle in this example and with this patch we no longer do. We pass all tests with this patch. Philippe - can you think of any case where we would need to ensure the hierarchy of D is resolved when we resolve the reference 'A<D>' ?
Given all bound checks. supertype collision checks are being deferred already, I don't see a problem for type compatibility rules per se.
Released into HEAD for 3.4M3 Added Java50Tests testHierarchyCycle()
Verified for 3.4M3 using I20071029-0010 build.
*** Bug 214237 has been marked as a duplicate of this bug. ***
*** Bug 214191 has been marked as a duplicate of this bug. ***
*** Bug 222933 has been marked as a duplicate of this bug. ***