Bug 10499 - DOM/AST: need a way to access the IMethodBinding of a ClassInstanceCreation
Summary: DOM/AST: need a way to access the IMethodBinding of a ClassInstanceCreation
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.0   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: 2.0 M4   Edit
Assignee: Jim des Rivieres CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 10674 (view as bug list)
Depends on:
Blocks:
 
Reported: 2002-02-28 12:02 EST by Dirk Baeumer CLA
Modified: 2002-03-06 11:12 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.