Bug 88892 - [1.5] IMethodBinding#getJavaElement() returns nonexistent IMethods (wrong parameter types)
Summary: [1.5] IMethodBinding#getJavaElement() returns nonexistent IMethods (wrong par...
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.1 M7   Edit
Assignee: Jerome Lanneluc CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 88765 (view as bug list)
Depends on:
Blocks: 88860
  Show dependency tree
 
Reported: 2005-03-23 12:45 EST by Markus Keller CLA
Modified: 2005-05-11 11:18 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 Markus Keller CLA 2005-03-23 12:45:32 EST
v_542

To reproduce, use JDT/UI from HEAD and enable debug option
    org.eclipse.jdt.ui/debug/useCoreBindingGetJavaElement
(and also the checkCoreBinding.. options, if you want)

- optionally, set a breakpoint in Bindings.findMethod(IMethodBinding,
IJavaProject) to watch the bug

- xy/DD.java:
package xy;
import java.util.ArrayList;
public class DD extends ArrayList<String> {
}

- Source > Add Constructor from Superclass
- select the interesting one that takes a Collection<? extends String>, press OK

-> IMethodBinding#getJavaElement() converts the IMethodBinding with key
"Ljava/util/ArrayList<Ljava/lang/String;>;.(Ljava/util/Collection;)V" into an
inexistent IMethod with name="ArrayList<String>" and
parameterTypes=[Ljava.util.Collection;]

=> The exception below is logged, and the generated constructor parameter name
is "arg0" instead of "c".

Java Model Exception: Java Model Status [ArrayList<String>(java.util.Collection)
[in ArrayList [in ArrayList.class [in java.util [in
C:\java\jdk1.5.0_01\jre\lib\rt.jar [in zz1.5]]]]] does not exist]
	at
org.eclipse.jdt.internal.core.JavaElement.newNotPresentException(JavaElement.java:467)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:498)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:231)
	at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:217)
	at
org.eclipse.jdt.internal.core.BinaryMethod.getParameterNames(BinaryMethod.java:200)
	at
org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2.suggestArgumentNames(StubUtility2.java)
	at
org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2.createParameters(StubUtility2.java:526)
	at
org.eclipse.jdt.internal.corext.codemanipulation.StubUtility2.createConstructorStub(StubUtility2.java:101)
	at
org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedConstructorsOperation.run(AddUnimplementedConstructorsOperation.java:243)
	at
org.eclipse.jdt.internal.core.BatchOperation.executeOperation(BatchOperation.java:34)
Comment 1 Jerome Lanneluc CLA 2005-04-20 05:40:51 EDT
Changed MethodBinding#getJavaElement() to use the compiler binding's selector
(or the declaring type name if it is a constructor) and the compiler binding's
parameters (instead of its signature).

Added regression test ASTModelBridgeTests#testParameterizedBinaryMethod()
Comment 2 Jerome Lanneluc CLA 2005-04-20 07:04:53 EDT
*** Bug 88765 has been marked as a duplicate of this bug. ***
Comment 3 Frederic Fusier CLA 2005-05-11 11:18:51 EDT
Verified for 3.1 M7 using build I20050509-2010 + jdt.core HEAD.