jdk-24/test/langtools/tools/javac/lambda/T8033483/IgnoreLambdaBodyDuringResolutionTest2.java
2017-09-12 19:03:39 +02:00

35 lines
749 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8033483
* @summary Should ignore nested lambda bodies during overload resolution
* @compile/fail/ref=IgnoreLambdaBodyDuringResolutionTest2.out -XDrawDiagnostics IgnoreLambdaBodyDuringResolutionTest2.java
*/
class IgnoreLambdaBodyDuringResolutionTest2 {
interface SAM<S> {
boolean test(S t);
}
<I, T extends I> I bar(final T l) {
return null;
}
class D<D1, D2> {
void foo() {
m(bar(e -> false));
}
void m(Class<D1> arg) {}
void m(SAM<D2> arg) {}
}
class F {
void foo() {
m(bar((String e) -> false));
}
<F1> void m(Class<F1> arg) {}
<F2> void m(SAM<F2> arg) {}
}
}