jdk-24/test/langtools/tools/javac/OverrideChecks/T4721069.java

26 lines
606 B
Java
Raw Normal View History

2007-12-01 00:00:00 +00:00
/*
* @test /nodynamiccopyright/
* @bug 4721069
2007-12-01 00:00:00 +00:00
* @summary javac allows an interface to override a final method in Object
* @author gafter
2007-12-01 00:00:00 +00:00
*
* @compile/fail/ref=T4721069.out -XDrawDiagnostics T4721069.java
2007-12-01 00:00:00 +00:00
*/
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);
2007-12-01 00:00:00 +00:00
} else {
I x = i;
x.getClass();
}
}
public static void meth() {
2007-12-01 00:00:00 +00:00
f(null);
}
}
}