Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7016637

(jsr292) MethodHandles.filterReturnValue throws unexpected IllegalArgumentException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • 7
    • 7
    • core-libs

      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)

            jrose John Rose
            sundar Sundararajan Athijegannathan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: