Bug 24205 - TypeHierarchy omits subtypes
Summary: TypeHierarchy omits subtypes
Status: RESOLVED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.1 M2   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-28 03:14 EDT by Genady Beryozkin CLA
Modified: 2002-10-04 14:55 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 Genady Beryozkin CLA 2002-09-28 03:14:01 EDT
I have the following projects structure:

project test5 - uses JDK1.4.0, defines interface MyRemote:
public interface MyRemote extends Remote {
	final static int K = 132321;
	public int xxx() throws RemoteException;
	public int yyy() throws RemoteException;
}

project test7 - uses project test5 and defines class Test1 which implements
interface MyRemote.

When my RMI builder is run, I do the following:

        String remote = "java.rmi.Remote";
        IType type = project.findType(remote);
        ITypeHierarchy hierarchy = type.newTypeHierarchy(project, monitor);
        // project here == "test7"

Later in the code I do

        String remote = "java.rmi.Remote";
        IType type = prj.findType(remote);
        IType[] allSubtypes = hierarchy.getAllSubtypes(type);

now "allSubTypes" does not include the class "Test".

It seems to be a bug. I'm quite sure it worked before 2.0.1

Genady
Comment 1 Genady Beryozkin CLA 2002-09-28 04:55:20 EDT
I want to upload my workspace but I cannot, because problems with bugzilla
Comment 2 Jerome Lanneluc CLA 2002-09-30 06:37:06 EDT
Genady, what is the project of the class "Test" (or did you mean "Test1"?)
If the class "Test" doesn't belong to project "test7", then this is expected as 
you create the hierarchy on the project "test7".
Otherwise if your workspace is not too big, could you please send it to me by 
email?
Comment 3 Jerome Lanneluc CLA 2002-10-04 04:40:48 EDT
I cannot reproduce the problem. Here is what I did:
1. I put a breakpoint in RMIBuildAction at line 94.
2. I started your runtime-workspace under debug.
3. In the runtime-workspace, I selected 'test7' and chose RMI->Run Compiler Now
4. It hit the breakpoint
The list of allSubtypes contained the class Test1.
Comment 4 Jerome Lanneluc CLA 2002-10-04 05:17:07 EDT
Actually I was able to reproduce. I had mistakely fixed your projects' 
classpath so that they all use the same JDK version.

This is the problem: 'test7' uses JDK1.3.1 in its classpath, 'test5' uses 
JDK1.4.0 . project.findType(remote) finds java.rmi.Remote in JDK1.3.1, but 
MyRemote (which is in 'test5') is a subclass of java.rmi.Remote in JDK1.4.0 .
So Test1 which is a subclass of MyRemote cannot be included in the hierarchy of 
java.rmi.Remote in JDK1.3.1 .

Closing as invalid.
Comment 5 Genady Beryozkin CLA 2002-10-04 05:27:01 EDT
You are not consisten with that. For example, the type hierarchy (when I press 
F4 on java.rmi.Remote) does include it. How does it get it ? I don't know. 
Either this situation is legal, and then I should get the class, or if it is 
not, JDT should warn the user about it.
Comment 6 Jerome Lanneluc CLA 2002-10-04 05:47:58 EDT
On which java.rmi.Remote do you open the hierarchy? On the one in JDK1.3.1 or 
the one in JDK1.4.0?
Comment 7 Jerome Lanneluc CLA 2002-10-04 10:06:53 EDT
There is no inconsistency here as a separate API is used in the case of F4: 
IType.newTypeHierarchy(IProgressMonitor). This API computes the hierarchy on 
the whole workspace and thus does not make a distinction between 
java.rmi.Remote in JDK1.3.1 and java.rmi.Remote in JDK1.4.0 .

Comment 8 Genady Beryozkin CLA 2002-10-04 11:32:09 EDT
Never mind, I don't use it anymore (I have a workaround). But I think that 
the current behavior must be carefully documented in order to avoid 
further confusion.

Genady
Comment 9 Genady Beryozkin CLA 2002-10-04 14:55:01 EDT
When requesting to open a type hierarchy I see it only when I request to open
the hierarchy on "java.rmi.Remote" from JDK 1.3.1. If I open the hierarchy 
on "Remote" from JDK 1.4.1 I do not see "Test1".

I will open a bug titled "consider warning the user if a project depends on a 
project with a different JRE".