1 /*
 2  * @test /nodynamiccopyright/
 3  * @bug 8324873 8325805
 4  * @summary Permit non-superclass instance field assignments before this/super in constructors
 5  * @compile/fail/ref=DA_DUConstructors.out -XDrawDiagnostics DA_DUConstructors.java
 6  */
 7 
 8 public class DA_DUConstructors {
 9     // identity
10     class C1 {
11         final int x;
12         final int y = x + 1;
13         C1() {
14             x = 12;
15             super();
16         }
17     }
18 
19     class C2 {
20         final int x;
21         C2() {
22             this(x = 3); // error
23         }
24         C2(int i) {
25             x = 4;
26         }
27     }
28 
29     class C3 {
30         C3(int i) {}
31     }
32     class C4 extends C3 {
33         final int x;
34         C4() {
35             super(x = 3); // ok
36         }
37     }
38 
39     class C5 {
40         final int x;
41         final int y = x + 1; // x is not DA
42         C5() {
43             x = 12; super();
44         }
45         C5(int i) {
46             /* no prologue */
47             x = i;
48         }
49     }
50 }