langtools/test/tools/javac/InterfaceMemberClassModifiers.java
author jeff
Wed, 22 Jun 2011 10:10:54 -0700
changeset 9916 c35ecac744a5
parent 6150 d055fa8ced62
child 39812 6272642715a1
permissions -rw-r--r--
7057046: Add embedded license to THIRD PARTY README Reviewed-by: lana
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     1
/*
06bc494ca11e Initial load
duke
parents:
diff changeset
     2
 * @test  /nodynamiccopyright/
06bc494ca11e Initial load
duke
parents:
diff changeset
     3
 * @bug 4294065 4785453
06bc494ca11e Initial load
duke
parents:
diff changeset
     4
 * @summary Verify that invalid access modifiers on interface members don't cause crash.
06bc494ca11e Initial load
duke
parents:
diff changeset
     5
 * @author maddox
06bc494ca11e Initial load
duke
parents:
diff changeset
     6
 *
6150
d055fa8ced62 6971882: Remove -XDstdout from javac test
jjg
parents: 10
diff changeset
     7
 * @compile/fail/ref=InterfaceMemberClassModifiers.out -XDdiags=%b:%l:%_%m InterfaceMemberClassModifiers.java
10
06bc494ca11e Initial load
duke
parents:
diff changeset
     8
 */
06bc494ca11e Initial load
duke
parents:
diff changeset
     9
06bc494ca11e Initial load
duke
parents:
diff changeset
    10
public interface InterfaceMemberClassModifiers {
06bc494ca11e Initial load
duke
parents:
diff changeset
    11
06bc494ca11e Initial load
duke
parents:
diff changeset
    12
    Object nullWriter = null;
06bc494ca11e Initial load
duke
parents:
diff changeset
    13
06bc494ca11e Initial load
duke
parents:
diff changeset
    14
    class SomeClass1 implements InterfaceMemberClassModifiers {                 // OK
06bc494ca11e Initial load
duke
parents:
diff changeset
    15
        public Object getOut() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    16
            return nullWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    17
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    18
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    19
06bc494ca11e Initial load
duke
parents:
diff changeset
    20
    public class SomeClass2 implements InterfaceMemberClassModifiers {          // OK
06bc494ca11e Initial load
duke
parents:
diff changeset
    21
        public Object getOut() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    22
            return nullWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    23
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    24
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    25
06bc494ca11e Initial load
duke
parents:
diff changeset
    26
    // Compiler used to crash on these!  (after reporting error)
06bc494ca11e Initial load
duke
parents:
diff changeset
    27
06bc494ca11e Initial load
duke
parents:
diff changeset
    28
    protected class SomeClass3 implements InterfaceMemberClassModifiers {       // illegal
06bc494ca11e Initial load
duke
parents:
diff changeset
    29
        public Object getOut() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    30
            return nullWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    31
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    32
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    33
06bc494ca11e Initial load
duke
parents:
diff changeset
    34
    private class SomeClass4 implements InterfaceMemberClassModifiers {         // illegal
06bc494ca11e Initial load
duke
parents:
diff changeset
    35
        public Object getOut() {
06bc494ca11e Initial load
duke
parents:
diff changeset
    36
            return nullWriter;
06bc494ca11e Initial load
duke
parents:
diff changeset
    37
        }
06bc494ca11e Initial load
duke
parents:
diff changeset
    38
    }
06bc494ca11e Initial load
duke
parents:
diff changeset
    39
06bc494ca11e Initial load
duke
parents:
diff changeset
    40
}