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

MethodHandle.asCollector throws undocumented NPE

XMLWordPrintable

      Please see the minimized test below to reproduce the issue.

      Minimized test:
      ===============
      $ cat test.java
      import java.lang.invoke.*;
      import java.util.Arrays;

      public class test {
          public static void main(String[] args) throws Throwable {
              MethodHandle dts = MethodHandles.publicLookup().findStatic(
                      Arrays.class,
                      "deepToString",
                      MethodType.methodType(String.class, Object[].class));
              dts.asCollector((Class) null, 1);
          }
      }

      Minimized test output:
      ======================
      $ java -version
      java version "1.7.0-ea"
      Java(TM) SE Runtime Environment (build 1.7.0-ea-b142)
      Java HotSpot(TM) Server VM (build 21.0-b12, mixed mode)

      $ java -verify test
      Exception in thread "main" java.lang.NullPointerException
              at java.lang.invoke.MethodHandle.asCollector(MethodHandle.java:783)
              at test.main(test.java:10)

      If the behaviour just need to be documented in javadoc then please feel free to close this CR as duplicate of 7032323.

            jrose John Rose
            ygaevsky Yuri Gaevsky (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: