Community
Participate
Working Groups
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.
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 ***