Bug 52379 - JavaElement.getElementInfo no longer works
Summary: JavaElement.getElementInfo no longer works
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M3   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-02-18 11:43 EST by Sachin Patel CLA
Modified: 2004-11-04 06:07 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sachin Patel CLA 2004-02-18 11:43:02 EST
I am porting my plugins over to 3.0 and I had a builder in which I called a 
utility class that I can pass in a Resource.  If that resource is a class file 
it would allow me to retrieve its class information (superclass, interfaces, 
packagename etc.)  When running on 3.0 M6 and M7 this no longer works and 
causes an exception when my utility class is invoked.  The exception is:

Java Model Exception: Java Model Status [Hello.class [in bin.com.example.wrd 
[in <project root> [in fsdfs]]] does not exist.]
	at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException
(JavaElement.java:525)
	at org.eclipse.jdt.internal.core.ClassFile.buildStructure
(ClassFile.java:76)
	at org.eclipse.jdt.internal.core.Openable.generateInfos
(Openable.java:169)
	at org.eclipse.jdt.internal.core.BinaryMember.generateInfos
(BinaryMember.java:46)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed
(JavaElement.java:536)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo
(JavaElement.java:280)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo
(JavaElement.java:266)
	at org.eclipse.jdt.internal.core.BinaryType.getSuperclassName
(BinaryType.java:391)
	at com.ibm.ws.rd.io.services.ClassFileInfoUtil.getSuperClassName
(ClassFileInfoUtil.java:31)

ClassFileInfoUtil is my class and if needed I can provide you with a copy of 
it.  This used to work in 2.1 perfectly, and i could retrieve class info for 
class files with or without source.  After porting I get this exception 
everytime.  This is a blocking defect since we are completley dependent on 
this and is blocking our development.
Comment 1 Philipe Mulet CLA 2004-02-18 12:13:20 EST
Are these classfiles located in the binary output ? i.e. are these generated 
classfiles ?
Comment 2 Sachin Patel CLA 2004-02-18 13:39:29 EST
Got a workaround.  Now using ClassFileReader to get at Interfaces and 
Superclass instead of calling getSuperClass and getIntefaces on the IType 
object.  Lowering severity.
Comment 3 Sachin Patel CLA 2004-02-18 13:40:16 EST
Sev Lowered
Comment 4 Sachin Patel CLA 2004-02-18 13:43:00 EST
To answer your question.  Both, they are generated classes files.  As well as 
pre-compiled class files with out source that are placed inside the project.
Comment 5 Jerome Lanneluc CLA 2004-03-04 07:01:59 EST
Need to change the message to indicate that the resource is not on the build 
path (the output folder not being on the build path).
Comment 6 Jerome Lanneluc CLA 2004-05-19 11:25:34 EDT
Not for 3.0
Comment 7 Jerome Lanneluc CLA 2004-07-06 05:11:19 EDT
Reopening
Comment 8 Jerome Lanneluc CLA 2004-10-11 07:31:15 EDT
Changed message to indicate that the .class file's folder is not on its
project's build path. This involved adding a new constant:
IJavaModelStatusConstants#ELEMENT_NOT_ON_CLASSPATH that is used when throwing a
JavaModelException. Also changed JavaModelException#isDoesNotExist() to return
true when this constant is used.

Added regression test ExistenceTests#testNonExistingClassFile2().
Comment 9 David Audel CLA 2004-11-04 06:07:02 EST
Verified for 3.1M3 with build I200411040100