0N/A/*
0N/A * @test /nodynamiccopyright/
0N/A * @bug 4095568 4277286 4785453
0N/A * @summary Verify rejection of illegal static variables in inner classes.
0N/A * @author William Maddox (maddox)
0N/A *
610N/A * @compile/fail/ref=InnerNamedConstant_2.out -XDrawDiagnostics InnerNamedConstant_2.java
0N/A */
0N/A
0N/Apublic class InnerNamedConstant_2 {
0N/A
0N/A static class Inner1 {
0N/A static int x = 1; // OK - class is top-level
0N/A static final int y = x * 5; // OK - class is top-level
0N/A static final String z; // OK - class is top-level
0N/A static {
0N/A z = "foobar";
0N/A }
0N/A }
0N/A
0N/A class Inner2 {
0N/A static int x = 1; // ERROR - static not final
0N/A static final String z; // ERROR - static blank final
0N/A {
0N/A z = "foobar"; // Error may be reported here. See 4278961.
0N/A }
0N/A }
0N/A
0N/A // This case must go in a separate class, as otherwise the detection
0N/A // of the error is suppressed as a result of recovery from the other
0N/A // errors.
0N/A
0N/A class Inner3 {
0N/A static final int y = Inner1.x * 5; // ERROR - initializer not constant
0N/A }
0N/A
0N/A}