Wed, 24 Sep 2014 11:38:26 -0700
Added tag jdk8u40-b07 for changeset 2fa3858a281f
1 /*
2 * @test /nodynamiccopyright/
3 * @bug 8030218
4 * @summary javac, compile time error isn't shown when final static field is not assigned, follow-up
5 * @compile/fail/ref=CompileTimeErrorForNonAssignedStaticFieldTest.out -XDrawDiagnostics CompileTimeErrorForNonAssignedStaticFieldTest.java
6 */
8 public class CompileTimeErrorForNonAssignedStaticFieldTest {
9 private final static int i;
11 public CompileTimeErrorForNonAssignedStaticFieldTest()
12 throws InstantiationException {
13 throw new InstantiationException("Can't instantiate");
14 }
16 static class Inner {
17 private final int j;
18 public Inner(int x)
19 throws InstantiationException {
20 if (x == 0) {
21 throw new InstantiationException("Can't instantiate");
22 } else {
23 j = 1;
24 }
25 System.out.println(j);
26 }
27 }
29 }