langtools/test/tools/javac/InterfaceMemberClassModifiers.java
author jlahoda
Tue, 16 Aug 2016 16:43:00 +0200
changeset 40504 0a01f6710c84
parent 39812 6272642715a1
child 40835 6ab9ed1abc46
permissions -rw-r--r--
8078561: Error message should be generated once when -source 6 is specified Summary: Code to avoid duplicated errors about features not supported in the current source level moved to Log Reviewed-by: jjg
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
 *
39812
6272642715a1 8161019: javac, fold formatter options
vromero
parents: 6150
diff changeset
     7
 * @compile/fail/ref=InterfaceMemberClassModifiers.out -diags:layout=%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
}