Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 349486

Summary: [1.7] codeSelect doesn't work on @PolymorphicSignature methods
Product: [Eclipse Project] JDT Reporter: Markus Keller <markus.kell.r>
Component: CoreAssignee: Satyam Kandula <satyam.kandula>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: amj87.iitr, daniel_megert, deepakazad, Olivier_Thomann, satyam.kandula, srikanth_sankaran
Version: 3.7   
Target Milestone: 3.7.1   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Bug Depends on:    
Bug Blocks: 349683    
Attachments:
Description Flags
Proposed patch + tests
none
Tests none

Description Markus Keller CLA 2011-06-15 14:26:13 EDT
BETA_JAVA7

codeSelect doesn't work on @PolymorphicSignature methods.

Put the "Usage examples" from the Javadoc of java.lang.invoke.MethodHandle into a method. codeSelect doesn't work on calls to invokeExact and invokeGeneric.
Comment 1 Ayushman Jain CLA 2011-06-15 14:40:09 EDT
I'll take a look
Comment 2 Markus Keller CLA 2011-06-16 05:33:32 EDT
See also bug 349487 comment 4:
> For references to the methods, IMethodBinding#getJavaElement() and
> codeSelect(..) should return IMethods whose isResolved() is true and whose
> getKey() returns the binding key of the method binding of the corresponding
> MethodInvocation node.
Comment 3 Dani Megert CLA 2011-06-17 07:16:16 EDT
This is something we need to fix for the final release.
Comment 4 Satyam Kandula CLA 2011-06-20 10:04:18 EDT
Ayush, I need for another search bug and hence, I will look at this.
Comment 5 Satyam Kandula CLA 2011-06-20 10:42:58 EDT
(In reply to comment #2)
> See also bug 349487 comment 4:
> > For references to the methods, IMethodBinding#getJavaElement() and
> > codeSelect(..) should return IMethods whose isResolved() is true and whose
> > getKey() returns the binding key of the method binding of the corresponding
> > MethodInvocation node.
and to put it explicitly, codeSelect fails because it could not find the exact method, for the same reason as of 349487.
Comment 6 Markus Keller CLA 2011-06-22 08:16:59 EDT
> and to put it explicitly, codeSelect fails because it could not find the exact
> method, for the same reason as of 349487.

This bug needs an additional fix. Bug 349487 has been fixed with the patch from bug 349488.
Comment 7 Satyam Kandula CLA 2011-06-22 08:34:13 EDT
(In reply to comment #6)
> > and to put it explicitly, codeSelect fails because it could not find the exact
> > method, for the same reason as of 349487.
> 
> This bug needs an additional fix. Bug 349487 has been fixed with the patch from
> bug 349488.
Yes, you are right. The patch is in line with the bug fix for 349487, but it doesn't fix and I am working on it.
Comment 8 Satyam Kandula CLA 2011-06-22 09:56:31 EDT
Created attachment 198402 [details]
Proposed patch + tests

With this patch, the selection works good except that the the javadoc doesn't show (Object ...) as parameters. This is because the binding key is not correct, whose problem is being tracked with bug 350039.
Comment 9 Markus Keller CLA 2011-06-22 14:19:54 EDT
(In reply to comment #8)
The fix looks good, but it raises the question where else you also need to replace methodBinding.original() and funnel in the polymorphicMethod(). Maybe this should go straight into PolymorphicMethodBinding#original()?

> With this patch, the selection works good except that the the javadoc doesn't
> show (Object ...) as parameters. This is because the binding key is not
> correct, whose problem is being tracked with bug 350039.

I don't think so. The binding key looks correct to me. I think the problem is on the UI side, see bug 350087.
Comment 10 Satyam Kandula CLA 2011-06-23 01:05:29 EDT
(In reply to comment #9)
> (In reply to comment #8)
> The fix looks good, but it raises the question where else you also need to
> replace methodBinding.original() and funnel in the polymorphicMethod(). Maybe
> this should go straight into PolymorphicMethodBinding#original()?
I also think, this should go into original. Olivier, is there any reason that is shouldn't?
Comment 11 Olivier Thomann CLA 2011-06-24 13:11:43 EDT
(In reply to comment #10)
> I also think, this should go into original. Olivier, is there any reason that
> is shouldn't?
I made the modification. Please let me know how it works for you.
Comment 12 Satyam Kandula CLA 2011-06-27 02:33:31 EDT
(In reply to comment #11)
> I made the modification. Please let me know how it works for you.
Thanks Olivier. This fixes both this bug and bug 349683. 
I will release the tests.
Comment 13 Satyam Kandula CLA 2011-06-27 02:41:32 EDT
Created attachment 198622 [details]
Tests

Added tests..
Comment 14 Satyam Kandula CLA 2011-06-27 02:44:12 EDT
(In reply to comment #13)
> Created attachment 198622 [details]
> Tests
> 
> Added tests..
This got fixed by the fix for bug 349487. 
Released the tests in BETA_JAVA7 branch
Comment 15 Markus Keller CLA 2011-06-27 13:40:47 EDT
Everything looks good in BETA_JAVA7 now.