Bug 119472 - IType needs to provide a getFullyQualifiedSuperInterfaces(..) API
Summary: IType needs to provide a getFullyQualifiedSuperInterfaces(..) API
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-12-06 14:33 EST by Vikas Trivedi CLA
Modified: 2006-10-13 10:59 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Vikas Trivedi CLA 2005-12-06 14:33:57 EST
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.
Comment 1 Jerome Lanneluc CLA 2005-12-07 07:14:40 EST
This code doesn't compile. A class cannot implement an interface that is defined as an inner type of this class.
Comment 2 Vikas Trivedi CLA 2005-12-07 10:01:12 EST
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.
Comment 3 Vikas Trivedi CLA 2005-12-07 10:01:58 EST
I guess I should also Reopen the bug.
Comment 4 Jerome Lanneluc CLA 2005-12-08 07:09:24 EST
In this case, you should use IType#newSuperTypeHierarchy(...), and getSuperInterfaces(yourType) on the resulting ITypeHierarchy.
Comment 5 Vikas Trivedi CLA 2006-02-07 13:26:30 EST
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) 
Comment 6 Philipe Mulet CLA 2006-09-08 03:52:23 EDT
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.
Comment 7 Philipe Mulet CLA 2006-09-08 03:53:19 EDT
should have closed as wontfix
Comment 8 Philipe Mulet CLA 2006-09-08 03:53:31 EDT
wontfix
Comment 9 Philipe Mulet CLA 2006-10-13 10:59:47 EDT
closing