java-topology/test/langtools/tools/javac/lambda/T8033483/IgnoreLambdaBodyDuringResolutionTest2.java
russell@unturf.com 0a580b313d undefect. CWE-407 — 63 sites patched across 27 ecosystems
Authors: russell@unturf.com · brackishbert@gmail.com · foxhop.net · TimeHexOn.com

Patches, unit tests, benchmarks, whitepaper, and outreach briefs.
Public domain — no copyright claimed. Use freely.
2026-03-26 17:11:57 -04:00

34 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) {}
}
}