<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
The basic design seems sound enough. Probably time to dig to the
next level, which is assessing the spec impact. <br>
<br>
The places to start are Ch16 (definite assignment) and 8.8.7
(constructor bodies). <br>
<br>
<div class="moz-cite-prefix">On 1/24/2023 4:24 PM, Archie Cobbs
wrote:<br>
</div>
<blockquote type="cite" cite="mid:CANSoFxsw4z0YUvn0qPQzD9--RN_-1Er1rhRpPM38LCjLvHzNYg@mail.gmail.com">
<div dir="ltr">
<div dir="ltr">On Tue, Jan 24, 2023 at 2:21 PM Brian Goetz <<a href="mailto:brian.goetz@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">brian.goetz@oracle.com</a>>
wrote:</div>
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">
<div> <br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div>This made me realize there is another missing
requirement:</div>
<div>
<ul>
<li>Upon normal return from a constructor, the
`this` reference must be DA <br>
</li>
</ul>
</div>
</div>
</div>
</blockquote>
<br>
So, I think this is true by definition; on normal return
from a super/this/implicit super call, then `this` *is*
DA. <br>
<br>
You can simplify the rule about try blocks to:<br>
<br>
- if `this` is DU on entry to a try block, it must be DU
on normal completion of the try block. <br>
<br>
Can you simplify further, while still preventing `this`
calls inside a try block? I don't think so, since we
might want to allow a try block before the super/this
call.<br>
</div>
</blockquote>
<div><br>
</div>
<div>Ok thanks. I admit I'm getting a little out of my league
here.<br>
</div>
<div><br>
</div>
<div>Does this sound correct?</div>
<div style="margin-left:40px"><br>
</div>
<div>
<div style="margin-left:40px"> The JLS will be modified as
follows:<br>
<br>
* Remove the requirement that `super()` or `this()`
appear as the first statement in a constructor<br>
* Add superclass initialization to the existing
constructor dataflow analysis as follows:<br>
* The `this` reference is considered DU on entry to
the constructor<br>
* Before a `this()` or `super()` call, the `this`
reference must be DU<br>
* After a `this()` or `super()` call, the `this`
reference is considered DA<br>
* Before normal completion of the constructor, the
`this` reference must be DA<br>
* If `this` is DU on entry to a `try` block, it must
be DU on normal completion of the `try` block<br>
* If no explicit `this()` or `super()` appears in a
constructor, it is treated as if the first line of the
constructor were `super()`<br>
* Add the following restrictions on constructors:<br>
* No access to `this`, other than assignments to
fields, may occur unless `this` is DA<br>
* `super()` and `this()` may not appear within any
`try { }` block<br>
* Clarify that non-static field initializers and
initialization blocks are executed immediately after
`super()` invocation, wherever it occurs (see
"Initialization Order" below)<br>
</div>
<br>
</div>
<div><br>
</div>
<div>Thanks,</div>
<div> -Archie</div>
</div>
<br>
-- <br>
<div dir="ltr" class="gmail_signature">Archie L. Cobbs<br>
</div>
</div>
</blockquote>
<br>
</body>
</html>