JDK-7016637 : (jsr292) MethodHandles.filterReturnValue throws unexpected IllegalArgumentException
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 7
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2011-02-02
  • Updated: 2011-05-13
  • Resolved: 2011-05-13
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 7
7Resolved
Related Reports
Duplicate :  
Description
The second argument of the call to dropArguments in MethodHandles.filterReturnValue should be one and not zero.  The goal is to drop the arguments "after" the combined value, not including the combined value.  This shows up as a problem when you use a virtual method as a target.


The attachment "TestFilter.java" is a test case to reproduce this issue. The output from running this test is as follows:


10.0
10.0
10.0
java.lang.IllegalArgumentException: target and combiner types must match: (TestFilter,int)double != (TestFilter)int
        at sun.dyn.MemberName.newIllegalArgumentException(MemberName.java:511)
        at java.dyn.MethodHandles.misMatchedTypes(MethodHandles.java:1845)
        at java.dyn.MethodHandles.foldArguments(MethodHandles.java:1784)
        at java.dyn.MethodHandles.filterReturnValue(MethodHandles.java:1725)
        at TestFilter.main(TestFilter.java:68)

Comments
EVALUATION Yes, the operand to dropArguments should be 1 not 0. Thanks. This fix is folded into 7012650.
04-02-2011