<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Remi,</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Even with strict fields, fields initialized before super calls can still be non-strict. It is just that if a field is definitely assigned before super constructor invocation, they can be trivially marked strict.</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
However, one problem with FCB I see that can block its finalization is its lack of support for records - records must not have a superconstructor invocation, and as a result, records cannot have early construction field assignments, because without an explicit
 invocation, per JLS, the canonical constructor body will be late construction; and such a body can use "this", which makes it incompatible to simply reinterpret a canonical constructor body as in an early construction context.</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards, Chen</div>
<div id="appendonsend"></div>
<hr style="display: inline-block; width: 98%;">
<div dir="ltr" id="divRplyFwdMsg"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> forax@univ-mlv.fr <forax@univ-mlv.fr><br>
<b>Sent:</b> Tuesday, April 22, 2025 12:24 PM<br>
<b>To:</b> Chen Liang <chen.l.liang@oracle.com><br>
<b>Cc:</b> amber-spec-experts <amber-spec-experts@openjdk.java.net><br>
<b>Subject:</b> [External] : Re: Draft Spec for Flexible Constructor Bodies (JEP 513)</span>
<div> </div>
</div>
<hr>
<blockquote style="margin-left: 5px; padding-left: 5px; border-left: 2px solid rgb(16, 16, 255);">
<div style="font-family: helvetica, arial, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>From: </b>"Chen Liang" <chen.l.liang@oracle.com><br>
<b>To: </b>"amber-spec-comments" <amber-spec-comments@openjdk.org><br>
<b>Cc: </b>"Remi Forax" <forax@univ-mlv.fr><br>
<b>Sent: </b>Tuesday, April 22, 2025 5:21:22 PM<br>
<b>Subject: </b>Re: Draft Spec for Flexible Constructor Bodies (JEP 513)</div>
</blockquote>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<blockquote style="margin-left: 5px; padding-left: 5px; border-left: 2px solid rgb(16, 16, 255);">
<div style="font-family: "calibri light", "helvetica light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Rémi,</div>
<div style="font-family: "calibri light", "helvetica light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
>From valhalla development, we find that strict fields has a dependency on flexible constructor bodies, but flexible constructors are not tied down by strict fields (like strict fields aren't tied down by value objects). The early construction context allows
 Java programs to write code that can more smoothly transition to use strict fields without constructor code updates, so delivering flexible constructors early seems fine to me.</div>
</blockquote>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
>From the development POV, i agree, but from the users perspective, we have a 3 phases change instead of 2, so it's harder to understand.</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
With flexible constructor bodies not in preview in Java 25:</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
phase 1: now, fields can not be initialized before a super() call</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
phase 2: fields are initialized before a super() call</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
phase 3: fields initialized before a super() call are strict</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
If flexible constructor bodies and strict fields are delivered at the same time:</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
phase 1: fields can not be initialized before a super() call</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
phase 2: fields can be initialized before super() and are strict</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<blockquote style="margin-left: 5px; padding-left: 5px; border-left: 2px solid rgb(16, 16, 255);">
<div style="font-family: "calibri light", "helvetica light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: "calibri light", "helvetica light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards,</div>
<div style="font-family: "calibri light", "helvetica light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Chen Liang</div>
</blockquote>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
regards,</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Rémi</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr>
<hr style="display: inline-block; width: 98%;">
<div dir="ltr" id="x_divRplyFwdMsg"><span style="font-family: Calibri, sans-serif; font-size: 11pt; color: rgb(0, 0, 0);"><b>From:</b> amber-spec-observers <amber-spec-observers-retn@openjdk.org> on behalf of Remi Forax <forax@univ-mlv.fr><br>
<b>Sent:</b> Tuesday, April 22, 2025 9:59 AM<br>
<b>To:</b> Gavin Bierman <gavin.bierman@oracle.com><br>
<b>Cc:</b> amber-spec-experts <amber-spec-experts@openjdk.org><br>
<b>Subject:</b> Re: Draft Spec for Flexible Constructor Bodies (JEP 513)</span>
<div> </div>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hello,</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
i'm not sure it's wise to have flexible constructor bodies to be out of preview.</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
There is a non trivial interaction with the introduction of strict fields and i am not sure those two should be separated, mostly because with strict fields, initializing a field before the call to super() change its semantics while with a flexible constructor
 body, one can already initialize the field before the call to super() without the semantics being changed.</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
But i'm sure i'm missing something ...</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
regards,</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Rémi</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>From: </b>"Gavin Bierman" <gavin.bierman@oracle.com><br>
<b>To: </b>"amber-spec-experts" <amber-spec-experts@openjdk.org><br>
<b>Sent: </b>Tuesday, April 22, 2025 3:48:31 PM<br>
<b>Subject: </b>Draft Spec for Flexible Constructor Bodies (JEP 513)</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Dear experts,</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
The first draft of a spec covering JEP 513 (Flexible Constructor Bodies) is available at:</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://cr.openjdk.org/~gbierman/jep513/latest/" id="OWAc2f5b162-8b08-8d7c-36fd-8fd5c2cf97e8" class="OWAAutoLink" data-auth="NotApplicable">https://cr.openjdk.org/~gbierman/jep513/latest/</a></div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Feel free to contact me directly or on this list with any comments/corrections.</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Thanks,</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Gavin</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
On 22 Apr 2025, at 13:02, Mark Reinhold <mark.reinhold@oracle.com> wrote:</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<a href="https://openjdk.org/jeps/513" id="OWA74fc060d-c506-2458-7a2b-f314aa6228e6" class="OWAAutoLink" data-auth="NotApplicable">https://openjdk.org/jeps/513</a><br>
<br>
 Summary: In the body of a constructor, allow statements to appear<br>
 before an explicit constructor invocation, i.e., super(...) or<br>
 this(...).  Such statements cannot reference the object under<br>
 construction, but they can initialize its fields and perform other safe<br>
 computations.  This change allows many constructors to be expressed<br>
 more naturally.  It also allows fields to be initialized before they<br>
 become visible to other code in the class, such as methods called from<br>
 a superclass constructor, thereby improving safety.<br>
<br>
- Mark</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
<br>
</div>
<div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
</body>
</html>