Community
Participate
Working Groups
Consider the following scenario ... Package Pa has Class Ca and Interface Ia. The source for Ca looks like this ... package Pa; public class Ca implements Ia{ public interface Ia{} } In this case although Ca implements Pa.Ia, there is no way to programatically know that that's the implemented interface. Using IType.getSuperInterfaceNames() & IType.getSuperInterfaceTypeSignatures() does not qualify Ia as Pa.Ia. Trying to resolve the returned interface name (Ia) using IType.resolveType(..) only returns Ca.Ia. Thus there is no way for the client to correctly identify that Ca implements Pa.Ia unless it is actually typed that way in the source. So either we need to fix resolveType(..) or more appropriately provide API to return the fully qualified names of the implemented interface. The same needs to be done for extended classes.
This code doesn't compile. A class cannot implement an interface that is defined as an inner type of this class.
This code does compile because class Pa.Ca is implementing interface Pa.Ia and not Pa.Ca.Ia. (Note the 2nd line in the description - Package Pa has Class Ca and Interface Ia) This problem occurs when there is a top level interface that has the same name as an inner interface and the top level interface is the one that is implemented by the class declaring the inner interface.
I guess I should also Reopen the bug.
In this case, you should use IType#newSuperTypeHierarchy(...), and getSuperInterfaces(yourType) on the resulting ITypeHierarchy.
Using the IType.NewTypeHierarchy() followed by getSuper*(..) is very expensive especially when a single action causes this code to be called for multiple ITypes multiple times (in different parts of the code). Any other suggestions? (Reopening bug)
Suggest you follow indication of comment 4: use #newSuperTypeHierarchy. This is orders of magnitude faster than #newTypeHierarchy, since you do not need the subtype hierarchy. Also if you have several types to compute at once, you can construct a region, and have them all connected at once. Closing, pls reopen if you find a problem using our APIs.
should have closed as wontfix
wontfix
closing