java-topology/test/langtools/tools/javac/T8194998/BrokenErrorMessageTest.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

19 lines
628 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8194998
* @summary broken error message for subclass of interface with private method
* @compile/fail/ref=BrokenErrorMessageTest.out -XDrawDiagnostics BrokenErrorMessageTest.java
*/
class BrokenErrorMessageTest {
void foo() {
// there is no error in this case but it is an interesting test, ::test is a member of I so this is acceptable
Runnable test1 = ((I)(new I() {}))::test;
// ::test is not a member of any subclass of I as it is private
Runnable test2 = ((new I() {}))::test;
}
interface I {
private void test() {}
}
}