| Summary: | [1.7] ASTParser#createASTs(..) doesn't resolve IMethodBinding for @PolymorphicSignature method reference | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Markus Keller <markus.kell.r> | ||||||
| Component: | Core | Assignee: | Olivier Thomann <Olivier_Thomann> | ||||||
| Status: | VERIFIED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | Olivier_Thomann, raksha.vasisht | ||||||
| Version: | 3.7 | ||||||||
| Target Milestone: | 3.7.1 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows 7 | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
Created attachment 198554 [details]
Proposed fix + regression test
For polymorphic method, we should not try to match parameter types. Markus, please give it a try. Comment on attachment 198554 [details]
Proposed fix + regression test
Hmm, that gives me the binding for the declaration, not for the given key. Add this to the test:
assertEquals("Wrong key", key, bindings[0].getKey());
Created attachment 198666 [details]
Proposed fix + regression test
Updated patch. More complex code to create the right binding.
Markus, let me know if this looks better for you.
Looks good, thanks. Released in BETA_JAVA7 branch Verified. |
BETA_JAVA7 Have: void bar() throws Throwable { MethodType mt; MethodHandle mh; MethodHandles.Lookup lookup = MethodHandles.lookup(); mt = MethodType.methodType(String.class, char.class, char.class); mh = lookup.findVirtual(String.class, "replace", mt); String s = (String) mh.invokeExact("daddy",'d','n'); } The IMethodBinding for reference mh.invokeExact("daddy",'d','n') has key Ljava/lang/invoke/MethodHandle;.invokeExact(Ljava/lang/String;CC)Ljava/lang/String;|Ljava/lang/Throwable; Passing this key to ASTParser#createASTs(..) doesn't resolve the original IMethodBinding, but only resolves an ITypeBinding for class MethodHandle. Works fine for the method declaration. To reproduce, you can choose "Parse Binding from Key..." from the ASTView's view menu.