You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@groovy.apache.org by "Paul King (Jira)" <ji...@apache.org> on 2024/04/23 02:09:00 UTC
[jira] [Updated] (GROOVY-11363) Bootstrap method error for method reference used with a primitive literal
[ https://issues.apache.org/jira/browse/GROOVY-11363?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paul King updated GROOVY-11363:
-------------------------------
Description:
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)
...
Caused by: java.lang.invoke.LambdaConversionException: Type mismatch in captured lambda parameter 0: expecting int, found class java.lang.Object
{noformat}
My initial expectation is that the wrapper type/boxed version should be used.
was:
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.
> 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
> Priority: Major
>
> 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)
> ...
> Caused by: java.lang.invoke.LambdaConversionException: Type mismatch in captured lambda parameter 0: expecting int, found class java.lang.Object
> {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)