langtools/test/tools/javac/OverrideChecks/T4721069.java
author sogoel
Thu, 05 Jun 2014 10:57:10 -0700
changeset 24797 850ebd4d80a7
parent 5520 86e4b9a9da40
child 37636 6c6e6e25189d
permissions -rw-r--r--
8044072: Group 2: create .out files for OverrideChecks tests in tools/javac dir Reviewed-by: jjg

/*
 * @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);
        }
    }
}