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

MethodHandle.asCollector throws UnsupportedOperationException if arrayLength >= 10

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Duplicate
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: core-libs

      Description

      Please see the minimized test below to reproduce the issue.

      Minimized test:
      ===============
      $ cat Test.java
      import java.lang.invoke.*;
      import static java.lang.invoke.MethodType.*;
      import static java.lang.invoke.MethodHandles.*;

      public class Test {
          public static void main(String[] args) throws Exception {
              MethodHandle mh = lookup().findVirtual(String.class, "endsWith",
                      methodType(boolean.class, String.class));

              MethodType ret = mh.asCollector(Object[].class, 10).type();
          }
      }

      Minimized test output:
      ========================
      $ javac Test.java
      $ java -showversion -verify Test
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b139)
      Java HotSpot(TM) Server VM (build 21.0-b09, mixed mode)

      Exception in thread "main" java.lang.UnsupportedOperationException: NYI
              at java.lang.invoke.ToGeneric.buildAdapterFromBytecodes(ToGeneric.java:314)
              at java.lang.invoke.ToGeneric.<init>(ToGeneric.java:139)
              at java.lang.invoke.ToGeneric.of(ToGeneric.java:253)
              at java.lang.invoke.ToGeneric.make(ToGeneric.java:245)
              at java.lang.invoke.MethodHandleImpl.convertArguments(MethodHandleImpl.java:693)
              at java.lang.invoke.MethodHandleImpl.collectArguments(MethodHandleImpl.java:747)
              at java.lang.invoke.MethodHandles.collectArguments(MethodHandles.java:1596)
              at java.lang.invoke.MethodHandle.asCollector(MethodHandle.java:791)
              at Test.main(Test.java:10)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              ygaevsky Yuri Gaevsky
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: