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

25 lines
606 B
Java

/*
* @test /nodynamiccopyright/
* @bug 4721069
* @summary javac allows an interface to override a final method in Object
* @author gafter
*
* @compile/fail/ref=T4721069.out -XDrawDiagnostics T4721069.java
*/
interface I {
Class getClass(); // error: cannot overide final from Object
static class T {
static void f(I i) {
if (i == null) {
Integer x = Integer.valueOf(2);
} else {
I x = i;
x.getClass();
}
}
public static void meth() {
f(null);
}
}
}