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 C3 { 20 C3(int i) {} 21 } 22 class C4 extends C3 { 23 final int x; 24 C4() { 25 super(x = 3); // ok 26 } 27 } 28 29 class C5 { 30 final int x; 31 final int y = x + 1; // x is not DA 32 C5() { 33 x = 12; super(); 34 } 35 C5(int i) { 36 /* no prologue */ 37 x = i; 38 } 39 } 40 }