<div dir="ltr">I analyzed a sample of code using the changes at 08c8b1f3c64. I can re-analyze with the latest version, but the initial results were:<div><br></div><div> 120 METHODDEF<br> 74 IF<br> 44 FORLOOP<br> 13 WHILELOOP<br> 10 TRY<br> 5 FOREACHLOOP<br> 2 DOLOOP<br> 1 LAMBDA</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, Oct 17, 2024 at 8:08 AM Maurizio Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com">maurizio.cimadamore@oracle.com</a>> wrote:<br></div><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>
<p><br>
</p>
<div>On 17/10/2024 16:03, Archie Cobbs
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">On Thu, Oct 17, 2024 at 5:34 AM Maurizio
Cimadamore <<a href="mailto:maurizio.cimadamore@oracle.com" target="_blank">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">
<div>
<div>Funny to see the FOREACHLOOP popping out. This code
is (at least) from 17 years ago (!!) and predates any
form of effectively final analysis - back then even
for-each required to hoist the variable in a separate <code style="font-size:0.85em;font-family:Consolas,Inconsolata,Courier,monospace;margin:0px 0.15em;padding:0px 0.3em;white-space:pre-wrap;border:1px solid rgb(234,234,234);background-color:rgb(248,248,248);border-radius:3px;display:inline">final</code>
one :-)</div>
</div>
</blockquote>
<div><br>
</div>
<div>I was wondering about that as well. I didn't realize that
there was a point where foreach() already existed and this
effectively final tweak was added. I don't see a relevant
JEP, did it predate the JEP process?<br>
</div>
</div>
</div>
</blockquote>
Effectively final support was added as part of Java 8 and Project
Lambda. Java 7 also had some bits of effective finality here and
there, but Java 8 is what sealed the deal. Back then we did not have
the JEP process.<br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<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">
<div>
<div>I realize, the important info is not where the dummy
variable is declared. It's the declaration of the
variable it points to in the initializer that matters!</div>
</div>
</blockquote>
<div><br>
</div>
<div>D'oh, yes of course... easy to fix though.</div>
</div>
</div>
</blockquote>
Thanks<br>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<div>Here are the new stats - these look more like what one
might expect:</div>
<div><br>
</div>
<div><span style="font-family:monospace"> 87 METHODDEF<br>
11 FORLOOP<br>
3 TRY<br>
3 IF<br>
3 FOREACHLOOP<br>
3 DOLOOP<br>
2 WHILELOOP<br>
1 CASE</span></div>
<div><br>
</div>
<div>Now there are 3 <span style="font-family:monospace">FOREACHLOOP</span>'s
:)<br>
</div>
</div>
</div>
</blockquote>
<p>Yowza! For each gained more than the regular loop :-)</p>
<p>Maurizio<br>
</p>
<blockquote type="cite">
<div dir="ltr">
<div class="gmail_quote">
<div><br>
</div>
<div>-Archie<br>
</div>
</div>
<br>
<span class="gmail_signature_prefix">-- </span><br>
<div dir="ltr" class="gmail_signature">Archie L. Cobbs<br>
</div>
</div>
</blockquote>
</div>
</blockquote></div>