langtools/test/tools/javac/InterfaceMemberClassModifiers.java
author sogoel
Thu, 05 Jun 2014 10:57:10 -0700
changeset 24797 850ebd4d80a7
parent 6150 d055fa8ced62
child 39812 6272642715a1
permissions -rw-r--r--
8044072: Group 2: create .out files for OverrideChecks tests in tools/javac dir Reviewed-by: jjg

/*
 * @test  /nodynamiccopyright/
 * @bug 4294065 4785453
 * @summary Verify that invalid access modifiers on interface members don't cause crash.
 * @author maddox
 *
 * @compile/fail/ref=InterfaceMemberClassModifiers.out -XDdiags=%b:%l:%_%m InterfaceMemberClassModifiers.java
 */

public interface InterfaceMemberClassModifiers {

    Object nullWriter = null;

    class SomeClass1 implements InterfaceMemberClassModifiers {                 // OK
        public Object getOut() {
            return nullWriter;
        }
    }

    public class SomeClass2 implements InterfaceMemberClassModifiers {          // OK
        public Object getOut() {
            return nullWriter;
        }
    }

    // Compiler used to crash on these!  (after reporting error)

    protected class SomeClass3 implements InterfaceMemberClassModifiers {       // illegal
        public Object getOut() {
            return nullWriter;
        }
    }

    private class SomeClass4 implements InterfaceMemberClassModifiers {         // illegal
        public Object getOut() {
            return nullWriter;
        }
    }

}