The new "flexible constructors" JEP specifies that a local class declared in an early construction context does not have an immediate outer instance, i.e., same behavior as an anonymous class in that situation.
However, the compiler still (incorrectly) tries to verify one in the case of a method reference to the local class' constructor.
Example:
import java.util.function.Supplier;
class EarlyLocalCtorRef {
EarlyLocalCtorRef(int x) {
class InnerLocal { }
this(InnerLocal::new);
}
EarlyLocalCtorRef(Supplier<Object> s) {
}
}
Expected output:
Successful compilation.
Actual output:
EarlyLocalCtorRef.java:5: error: cannot reference this before supertype constructor has been called
this(InnerLocal::new);
^