java-topology/test/langtools/tools/javac/lambda/8202372/T8202372.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

45 lines
No EOL
1.1 KiB
Java

/*
* @test /nodynamiccopyright/
* @bug 8202372
* @summary Diagnostic with incorrect line info generated when compiling lambda expression
* @compile/fail/ref=T8202372.out -XDrawDiagnostics T8202372.java
*/
class T8202372 {
interface NonVoidFunc {
String m();
}
interface VoidFunc {
void m();
}
interface ParamFunc {
void m(String s);
}
public void addVoid(VoidFunc v) {}
public void addNonVoid(NonVoidFunc nv) {}
public void addParam(ParamFunc p) {}
void testVoid(T8202372 test) {
test.addVoid(() -> "");
test.addVoid(() -> { return ""; });
test.addVoid(() -> { });
test.addVoid(() -> { return; });
}
void testNonVoid(T8202372 test) {
test.addNonVoid(() -> "");
test.addNonVoid(() -> { return ""; });
test.addNonVoid(() -> { });
test.addNonVoid(() -> { return; });
}
void testParam(T8202372 test) {
test.addParam(() -> {});
test.addParam((String x) -> { });
test.addParam((String x1, String x2) -> { });
test.addParam((int x) -> { });
}
}