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

[lworld] Bootstrap of instance-capturing lambda fails for reference favoring primitive types

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • repo-valhalla
    • repo-valhalla
    • tools
    • None
    • generic
    • generic

      This class:

      public primitive class CheckRefLambda.val {
          int theInteger;
          public CheckRefLambda(int newValue) {
              theInteger = newValue;
          }
          public Supplier<CheckRefLambda.ref> makeCopier() {
              return () -> new CheckRefLambda(this.theInteger + 1);
          }
          // ...
      }

      won't bootstrap the lambda, but fails with:

      java.lang.BootstrapMethodError: bootstrap method initialization exception
      at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:188)
      at java.base/java.lang.invoke.CallSite.makeSite(CallSite.java:315)
      at java.base/java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:281)
      at java.base/java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:271)
      at CheckRefLambda.makeCopyer(CheckRefLambda.java:42)
      at CheckRefLambda.main(CheckRefLambda.java:47)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:569)
      at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:312)
      at java.base/java.lang.Thread.run(Thread.java:833)
      Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type primitive CheckRefLambda; not a subtype of implementation type primitive CheckRefLambda
      at java.base/java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:271)
      at java.base/java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:340)
      at java.base/java.lang.invoke.BootstrapMethodInvoker.invoke(BootstrapMethodInvoker.java:134)
      ... 11 more

            jespersm Jesper Møller
            jespersm Jesper Møller
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: