JEP proposed to target JDK 24: 492: Flexible Constructor Bodies (Third Preview)
Mark Reinhold
mark.reinhold at oracle.com
Thu Nov 7 16:53:45 UTC 2024
The following JEP is proposed to target JDK 24:
492: Flexible Constructor Bodies (Third Preview)
https://openjdk.org/jeps/492
Summary: In constructors in the Java programming language, allow
statements to appear before an explicit constructor invocation, i.e.,
super(..) or this(..). The statements cannot reference the instance
under construction, but they can initialize its fields. Initializing
fields before invoking another constructor makes a class more reliable
when methods are overridden. This is a preview language feature.
Feedback on this proposal from JDK Project Committers and Reviewers [1]
is more than welcome, as are reasoned objections. If no such objections
are raised by 20:00 UTC on Thursday, 14 November, or if they’re raised
and then satisfactorily answered, then per the JEP 2.0 process proposal
[2] I’ll target this JEP to JDK 24.
- Mark
[1] https://openjdk.org/census#jdk
[2] https://cr.openjdk.java.net/~mr/jep/jep-2.0-02.html
More information about the jdk-dev
mailing list