1 /* 2 * @test /nodynamiccopyright/ 3 * @bug 4721069 4 * @summary javac allows an interface to override a final method in Object 5 * @author gafter 6 * 7 * @compile/fail/ref=T4721069.out -XDrawDiagnostics T4721069.java 8 */ 9 10 interface I { 11 Class getClass(); // error: cannot overide final from Object 12 static class T { 13 static void f(I i) { 14 if (i == null) { 15 Integer x = Integer.valueOf(2); 16 } else { 17 I x = i; 18 x.getClass(); 19 } 20 } 21 public static void main(String[] args) { 22 f(null); 23 } 24 } 25 }