Bug 72179 - IJavaProject.findType(..) does not work as expected ...
Summary: IJavaProject.findType(..) does not work as expected ...
Status: RESOLVED DUPLICATE of bug 36032
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 3.1 M2   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-08-18 12:25 EDT by Vikas Trivedi CLA
Modified: 2004-08-18 13:13 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 2004-08-18 12:25:32 EDT
I have a Java Project "jp1" which contains a package "p1".
p1 contains a single java file jc.java.
The contents of jc.java ...

package p1;

class jc008 {
}

class jc009 {
}

class jc010 extends jc009 {
	jc008 a;
}

While wokring with jc010 I am trying to obtain the SourceType associated with 
jc009. However calling IJavaProject.findType("p1", "jc009") returns null. I am 
able to search (Ctrl+Shift+T) jc009 and browse to it etc.

If all the above classes are defined in separate java files (jc008 in 
jc008.java, jc009 in jc009.java and jc010 in jc010.java) then I do not have 
this problem. IJavaProject.findType(..) returns the correct SourceType.

It should do the same if all classes are defined in the same java file.
Comment 1 Kent Johnson CLA 2004-08-18 13:13:15 EDT
Directly from the spec of findType():

"Note that in order to be found, a type name (or its toplevel enclosing type 
name) must match its corresponding compilation unit name. As a consequence, 
secondary types cannot be found using this functionality. Secondary types can 
however be explicitely accessed through their enclosing unit or found by the 
<code>SearchEngine</code>."

*** This bug has been marked as a duplicate of 36032 ***