jdk-24/test/langtools/tools/javac/SuperInit/EarlyIndirectOuterCapture.java
Maurizio Cimadamore 5b9932f8f3 8338288: Compiler Implementation for Flexible Constructor Bodies (Third Preview)
8322882: Null pointer error when compiling Static initializer in a local class
8334248: Invalid error for early construction local class constructor method reference
8330037: Compiler produces invalid bytecode for method class creation from static method

Reviewed-by: jlahoda, vromero
2024-11-15 10:07:18 +00:00

30 lines
893 B
Java

/*
* @test /nodynamiccopyright/
* @bug 8334248
* @summary Invalid error for early construction local class constructor method reference
* @compile/fail/ref=EarlyIndirectOuterCapture.out -XDrawDiagnostics EarlyIndirectOuterCapture.java
*/
public class EarlyIndirectOuterCapture {
EarlyIndirectOuterCapture() {
this(null);
}
EarlyIndirectOuterCapture(InnerSuperclass inner) { }
class InnerSuperclass { }
static class InnerOuter extends EarlyIndirectOuterCapture { // accessible
class InnerInnerOuter extends EarlyIndirectOuterCapture { // not accessible
InnerInnerOuter() {
super(/* which enclosing instance here ? */new InnerSuperclass() { });
}
InnerInnerOuter(boolean b) {
super(InnerOuter.this.new InnerSuperclass() { }); // ok, explicit
}
}
}
}