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

JSR 292: MHs.constant() doesn't accept primitives

XMLWordPrintable

    • generic
    • generic

      The following test case:

      public class Test {
          public static void main(String[] args) throws Exception {
              java.lang.invoke.MethodHandles.constant(boolean.class, true);
          }
      }

      throws an exception:

      Exception in thread "main" java.lang.ExceptionInInitializerError
      at Test.main(Test.java:5)
      Caused by: java.lang.IllegalArgumentException: no leading reference parameter: true
      at java.lang.invoke.MethodHandleStatics.newIllegalArgumentException(MethodHandleStatics.java:81)
      at java.lang.invoke.MethodHandle.bindTo(MethodHandle.java:1009)
      at java.lang.invoke.MethodHandles.constant(MethodHandles.java:1625)
      ...

            Unassigned Unassigned
            kshiroko Kirill Shirokov (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: