Bug 157657 - [model] IMethodBinding.getJavaElement returns non-existing handle
Summary: [model] IMethodBinding.getJavaElement returns non-existing handle
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 RC4   Edit
Assignee: Frederic Fusier CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-18 13:27 EDT by Olivier Thomann CLA
Modified: 2007-06-19 06:52 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Olivier Thomann CLA 2006-09-18 13:27:08 EDT
Could be a bug in JDT/Core.

Using 0912, I tried to define a class that implements javax.tools.JavaCompiler using the class wizard and I got an Internal Error in the .log file:

Java Model Exception: Java Model Status [getStandardFileManager(javax.tools.DiagnosticListener, java.util.Locale, java.nio.charset.Charset) {key=Ljavax/tools/JavaCompiler;.getStandardFileManager(Ljavax/tools/DiagnosticListener;Ljava/util/Locale;Ljava/nio/charset/Charset;)Ljavax/tools/StandardJavaFileManager;} [in JavaCompiler [in JavaCompiler.class [in javax.tools [in D:\jdks\jdk6\jre\lib\rt.jar]]]] does not exist]
at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:485)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:516)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:249)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:235)
at org.eclipse.jdt.internal.core.BinaryMethod.getParameterNames(BinaryMethod.java:167)
at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2.suggestArgumentNames(StubUtility2.java:922)
at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2.createParameters(StubUtility2.java:552)
at org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2.createImplementationStub(StubUtility2.java:396)
at org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedMethodsOperation.run(AddUnimplementedMethodsOperation.java:208)
at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createInheritedMethods(NewTypeWizardPage.java:2470)
at org.eclipse.jdt.ui.wizards.NewClassWizardPage.createTypeMembers(NewClassWizardPage.java:262)
at org.eclipse.jdt.ui.wizards.NewTypeWizardPage.createType(NewTypeWizardPage.java:2031)
at org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard.finishPage(NewClassCreationWizard.java:65)
at org.eclipse.jdt.internal.ui.wizards.NewElementWizard$2.run(NewElementWizard.java:117)
at org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:39)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:720)
at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1737)
at org.eclipse.jdt.core.JavaCore.run(JavaCore.java:4022)
at org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter.run(WorkbenchRunnableAdapter.java:87)
at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:113)

The signature of this method is:
StandardJavaFileManager getStandardFileManager(DiagnosticListener<? super JavaFileObject> diagnosticListener,                                               Locale locale, Charset charset)

From the javadoc. Might be related to the wildcard.
Comment 1 Olivier Thomann CLA 2006-09-18 13:53:26 EDT
I got it because my compiler settings were set to 1.4 compliance and I used a 1.6 execution environment on the classpath.
It worked fine once I switch to compliance 1.6.
Comment 2 Martin Aeschlimann CLA 2006-09-25 06:43:23 EDT
IMethodBinding.getJavaElement seems to return a IMethod that doesn't exist. However, there is a existing IMethod that corresponds to that method.

Would be better if IMethodBinding.getJavaElement can return an existing method of possible.
Comment 3 Olivier Thomann CLA 2006-09-25 11:31:27 EDT
Jérôme,

We might want to check the compliance to see what method should be returned.
Comment 4 Frederic Fusier CLA 2007-06-19 06:52:11 EDT
Cannot reproduce the JME using 3.3 RC4 (compliance project was 1.4 and JRE 1.6)