<div dir="ltr"><div dir="ltr">On Thu, Jan 26, 2023 at 11:25 AM Brian Goetz <<a href="mailto:brian.goetz@oracle.com">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>
<font size="4"><font face="monospace">For example, would this be allowed?<br>
<br>
class A { <br>
final int a;<br>
<br>
A() { this.a = 0; }<br>
}<br>
<br>
class B extends A { <br>
B() { <br>
this.a = 1;<br>
super();<br>
}<br>
}<br></font></font></div></blockquote><div><br></div><div>No, that's definitely not supposed to be allowed.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><font size="4"><font face="monospace">
The current draft JEP says it would:<br>
<br>
<blockquote type="cite"><font size="4"><font face="monospace">Add
the following restrictions on constructors:<br>
No access to this, other than assignments to fields,
may occur unless this is DA<br></font></font></blockquote></font></font></div></blockquote><div><br></div><div>Thanks for pointing that out. I've updated the draft to say "other than assignments to local fields".</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><font size="4"><font face="monospace">So, its possible that #3 also
has reasonable cost/benefit. The current "pinch point" approach
could probably be brought to bear on it with modifications,
without having to thread everything through DA. But I think
there are subtleties to think through first. </font></font><br><font size="4"><font face="monospace">
</font></font></blockquote></div><br><div>I'm hopeful we can include #3 - I think it's important because it gives users a way to address a problem that is all at once subtle, dangerous, and difficult to avoid.</div><div><br></div><div>-Archie<br></div><div><br></div><div>-- </div><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>