1 /* 2 * @test /nodynamiccopyright/ 3 * @bug 8325805 4 * @library /tools/javac/lib 5 * @summary Verify local class in early construction context has no outer instance 6 * @modules jdk.compiler/com.sun.tools.javac.tree 7 * jdk.compiler/com.sun.tools.javac.util 8 * @enablePreview 9 * @compile/fail/ref=EarlyLocalClass.out -XDrawDiagnostics EarlyLocalClass.java 10 */ 11 public class EarlyLocalClass { 12 EarlyLocalClass() { 13 class Local { 14 void foo() { 15 EarlyLocalClass.this.hashCode(); // this should FAIL 16 } 17 } 18 new Local(); // this is OK 19 super(); 20 new Local(); // this is OK 21 } 22 } --- EOF ---