Paul King created GROOVY-11363:
----------------------------------

             Summary: Bootstrap method error for method reference used with a 
primitive literal
                 Key: GROOVY-11363
                 URL: https://issues.apache.org/jira/browse/GROOVY-11363
             Project: Groovy
          Issue Type: Bug
            Reporter: Paul King


This code:
{code}
import groovy.transform.CompileStatic
import java.util.function.Supplier

@CompileStatic
Supplier<String> method() {
  5::toString
}

method().get()
{code}
Fails with this error:
{noformat}
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 ConsoleScript9.method(ConsoleScript9:6)
{noformat}

My initial expectation is that the wrapper type/boxed version should be used.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to