Community
Participate
Working Groups
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.
Are these classfiles located in the binary output ? i.e. are these generated classfiles ?
Got a workaround. Now using ClassFileReader to get at Interfaces and Superclass instead of calling getSuperClass and getIntefaces on the IType object. Lowering severity.
Sev Lowered
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.
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).
Not for 3.0
Reopening
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().
Verified for 3.1M3 with build I200411040100