-
Bug
-
Resolution: Duplicate
-
P3
-
8u40, 9
BootstrapMethodError is thrown for the following code:
interface Fun {
<T extends String & Runnable> String m(T p);
}
class A {
public static <S extends Runnable> String methodS(S a) {
return null;
}
}
public class Test {
public static void main(String argv[]) {
Fun f = A::methodS;
}
}
Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:328)
at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at Test.main(Test.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:484)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.invoke.LambdaConversionException: Type mismatch for lambda argument 0: class java.lang.String is not convertible to interface java.lang.Runnable
at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:267)
at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
at java.lang.invoke.CallSite.makeSite(CallSite.java:289)
... 8 more
interface Fun {
<T extends String & Runnable> String m(T p);
}
class A {
public static <S extends Runnable> String methodS(S a) {
return null;
}
}
public class Test {
public static void main(String argv[]) {
Fun f = A::methodS;
}
}
Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:328)
at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at Test.main(Test.java:14)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:484)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.invoke.LambdaConversionException: Type mismatch for lambda argument 0: class java.lang.String is not convertible to interface java.lang.Runnable
at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:267)
at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
at java.lang.invoke.CallSite.makeSite(CallSite.java:289)
... 8 more
- duplicates
-
JDK-8065821 Invalid BootstrapMethod for constructor/method reference
- Closed
- relates to
-
JDK-8059632 Method reference compilation uses incorrect qualifying type
- Resolved
-
JDK-8073755 Constructor reference doesn't work with non-static inner class.
- Closed