Draft Spec for Flexible Constructor Bodies (JEP 513)

Gavin Bierman gavin.bierman at oracle.com
Tue Apr 22 13:48:31 UTC 2025


Dear experts,

The first draft of a spec covering JEP 513 (Flexible Constructor Bodies) is available at:

https://cr.openjdk.org/~gbierman/jep513/latest/

Feel free to contact me directly or on this list with any comments/corrections.

Thanks,
Gavin

On 22 Apr 2025, at 13:02, Mark Reinhold <mark.reinhold at oracle.com> wrote:

https://openjdk.org/jeps/513

 Summary: In the body of a constructor, allow statements to appear
 before an explicit constructor invocation, i.e., super(...) or
 this(...).  Such statements cannot reference the object under
 construction, but they can initialize its fields and perform other safe
 computations.  This change allows many constructors to be expressed
 more naturally.  It also allows fields to be initialized before they
 become visible to other code in the class, such as methods called from
 a superclass constructor, thereby improving safety.

- Mark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/amber-spec-observers/attachments/20250422/6e71bb0e/attachment-0001.htm>


More information about the amber-spec-observers mailing list