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

22 lines
716 B
Java

/*
* @test /nodynamiccopyright/
* @bug 4526026
* @summary javac allows access to interface members inherited protected from Object
* @author gafter
*
* @compile/fail/ref=InterfaceObjectInheritance.out -XDrawDiagnostics InterfaceObjectInheritance.java
*/
interface InterfaceObjectInheritance {
class Inner {
static void bar(InterfaceObjectInheritance i) {
try {
// An inner class has access to any protected members, but
// according to JLS 9.2, an interface has no protected members,
// so this reference to finalize should not compile.
i.finalize();
} catch (Throwable t) {
}
}
}
}