JEP 492: Flexible Constructor Bodies (Third Preview)
🚀 What is it?
Fixed calling subclass overriden method
class Super {
Super() { overriddenMethod(); }
void overriddenMethod() { System.out.println("hello"); }
}
class Sub extends Super {
final int x;
Sub(int x) {
this.x = x; // Initialize the field
super(); // Then invoke the Super constructor explicitly
}
@Override
void overriddenMethod() { System.out.println(x); }
}RUN:
PreviousJEP 491: Synchronize Virtual Threads without PinningNextJEP 493: Linking Run-Time Images without JMODs
Last updated