<div dir="ltr"><div dir="ltr">On Mon, Jun 10, 2024 at 12:10 PM Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com">maurizio.cimadamore@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"><u></u>
<div>
<div>I’m saying that the
model put forward by the spec is (a) not very intuitive (despite
what you seem to claim) and (b) not a very useful
generalization.
</div></div></blockquote><div><br></div>I agree with you that it's totally debatable what is most "intuitive" and "useful" because those are opiniony words. So I don't have an ironclad counter-argument.</div><div class="gmail_quote"><br></div><div class="gmail_quote">I also agree that your complicated example is (a) unrealistic and (b) demonstrates that the compiler still has bugs in this area.<br></div><div class="gmail_quote"><br></div><div class="gmail_quote">The strongest argument I have for preserving the current behavior is that the overall Java/JDK project has been traditionally very careful to preserve backward compatibility. Changing the compiler so that code in the world that has compiled successfully since Java 8 no longer compiles is not something to be taken lightly.</div><div class="gmail_quote"><br></div><div class="gmail_quote">In fact the compiler itself has a few examples, e.g., TypeEnter.java line 301 - the constructor TypeEnter.ImportsPhase() invokes super(..., new TypeEnter.HierarchyPhase()) which wouldn't be possible if early construction contexts were treated as static (i.e., no access to enclosing instances).</div><div class="gmail_quote"><br></div><div class="gmail_quote">There may be some better, less draconian restriction than "treated as static" but I'm not sure it would be appreciably more intuitive than what we've currently got, though I'm curious to hear your ideas. To put it another way, I think things only get non-intuitive with the current proposal for contrived examples.<br></div><br><div class="gmail_quote">-Archie<br clear="all"></div><br><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature">Archie L. Cobbs<br></div></div>