langtools/test/tools/javac/OverrideChecks/T4721069.java
author hseigel
Wed, 02 Mar 2016 23:48:41 +0000
changeset 36397 c487ced7231c
parent 24797 850ebd4d80a7
child 37636 6c6e6e25189d
permissions -rw-r--r--
Merge

/*
 * @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 = new Integer(2);
            } else {
                I x = i;
                x.getClass();
            }
        }
        public static void main(String[] args) {
            f(null);
        }
    }
}