Bug 10499

Summary: DOM/AST: need a way to access the IMethodBinding of a ClassInstanceCreation
Product: [Eclipse Project] JDT Reporter: Dirk Baeumer <dirk_baeumer>
Component: CoreAssignee: Jim des Rivieres <jeem>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: eclipse, Olivier_Thomann
Version: 2.0   
Target Milestone: 2.0 M4   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Dirk Baeumer CLA 2002-02-28 12:02:58 EST
Build 20020226

How do I access the IMethodBinding of the constructor represented by a 
ClassInstanceCreation node ? We need this method binding since a constructor 
can throw exceptions.

I think there should be a method resolveBinding() -> IMethodBinding.
Comment 1 Jim des Rivieres CLA 2002-02-28 14:42:34 EST
Agreed. There is no way to get a binding for the constructor being invoked.
Presumably the same concern applies to ConstructorInvocation
and SuperConstructorInvocation as well.

I suggest calling the method 
   resolveConstructorBinding() -> IMethodBinding
to make it clear what it is for.

For a ClassInstanceCreation expression that declares an anonymous
class, which constructor binding is expected:
(a) the 'anonymous constructor' (JLS 15.9.5.1) of the anonymous class,
or (b) the constructor on the direct superclass.

Comment 2 Dirk Baeumer CLA 2002-03-01 06:05:05 EST
IMO the method should return the binding of the anonymous constructor
Comment 3 Olivier Thomann CLA 2002-03-01 09:23:29 EST
Are you aware that this binding can contain synthetic arguments? Is this ok for 
you?
Comment 4 Dirk Baeumer CLA 2002-03-01 09:56:50 EST
Can you give me an example
Comment 5 Olivier Thomann CLA 2002-03-01 17:12:22 EST
I was wrong. The synthetic arguments are not in the binding. I tried several 
examples that use this$0 or other type of synthetic argument and I don't get 
them in the binding parameter types. So it is fine.
I released changes that should return the proper method binding.
Comment 6 Olivier Thomann CLA 2002-03-04 12:12:02 EST
*** Bug 10674 has been marked as a duplicate of this bug. ***
Comment 7 Olivier Thomann CLA 2002-03-06 11:12:02 EST
Fixed and released in HEAD.