langtools/test/tools/javac/OverrideChecks/T4721069.java
author mcimadamore
Wed, 26 Oct 2016 15:41:25 +0100
changeset 41856 13a056e8f16e
parent 37636 6c6e6e25189d
permissions -rw-r--r--
8168774: Polymorhic signature method check crashes javac Summary: Check for polysig method assumes arity is greater than zero Reviewed-by: vromero

/*
 * @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 main(String[] args) {
            f(null);
        }
    }
}