Details
-
Bug
-
Resolution: Fixed
-
P4
-
None
-
b93
-
generic
-
generic
-
Verified
Description
The test case from http://mail.openjdk.java.net/pipermail/compiler-dev/2015-November/009824.html
inlined here:
public class Intersection {
interface I {
}
interface J {
void foo();
}
static <T extends I & J> void bar(T t) {
Runnable r = t::foo;
}
public static void main(String[] args) {
class A implements I, J { public void foo() {} }
bar(new A());
}
}
fails with
Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at X.bar(X.java:9)
at X.main(X.java:14)
Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type interface X$I; not a subtype of implementation type interface X$J
at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:233)
at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
... 4 more
inlined here:
public class Intersection {
interface I {
}
interface J {
void foo();
}
static <T extends I & J> void bar(T t) {
Runnable r = t::foo;
}
public static void main(String[] args) {
class A implements I, J { public void foo() {} }
bar(new A());
}
}
fails with
Exception in thread "main" java.lang.BootstrapMethodError: call site initialization exception
at java.lang.invoke.CallSite.makeSite(CallSite.java:341)
at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307)
at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297)
at X.bar(X.java:9)
at X.main(X.java:14)
Caused by: java.lang.invoke.LambdaConversionException: Invalid receiver type interface X$I; not a subtype of implementation type interface X$J
at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:233)
at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:303)
at java.lang.invoke.CallSite.makeSite(CallSite.java:302)
... 4 more
Attachments
Issue Links
- duplicates
-
JDK-8175128 Multiply-bound generic parameters do not produce correct lambda bootstrap method instantiatedMethodType parameter
- Closed
-
JDK-8308360 LambdaConversionException when using ::-Operator and Generics
- Resolved
- relates to
-
JDK-8229811 using method reference throws java.lang.BootstrapMethodError
- Closed
-
JDK-8141508 java.lang.invoke.LambdaConversionException: Invalid receiver type ...
- Closed