Community
Participate
Working Groups
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.
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.
IMO the method should return the binding of the anonymous constructor
Are you aware that this binding can contain synthetic arguments? Is this ok for you?
Can you give me an example
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.
*** Bug 10674 has been marked as a duplicate of this bug. ***
Fixed and released in HEAD.