JDK-7039220 : MethodHandle.asCollector throws UnsupportedOperationException if arrayLength >= 10
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang.invoke
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic
  • CPU: generic
  • Submitted: 2011-04-25
  • Updated: 2012-03-22
  • Resolved: 2011-05-13
Related Reports
Duplicate :  
Relates :  
Relates :  
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)

Comments
EVALUATION Fixed as part of 6939861.
13-05-2011