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

MethodHandle.invokeGeneric throws NPE for null instead of primitive type

XMLWordPrintable

      Please see the following code:
      ------------------------------------------------------
      import java.dyn.*;
      public class Test {
          public static void foo(int i){}
          public static void main(String argv[]) throws Throwable {
              MethodHandle handle = MethodHandles.lookup().findStatic
                  (Test.class, "foo", MethodType.methodType(void.class, int.class));
              handle.invokeGeneric(null);
          }
      }
      ------------------------------------------------------
      Its output is:
      Exception in thread "main" java.lang.NullPointerException
              at sun.dyn.FromGeneric$A4.invoke_I4(FromGeneric.java:552)
              at sun.dyn.FilterGeneric$F3.invoke_F2(FilterGeneric.java:573)
              at Test.main(Test.java:7)

            Unassigned Unassigned
            dmiltsov Dmitry Miltsov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: