<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4" face="monospace">Correct. ASM does guarantee an
order of events, but our experience is that such constraints do
not help the user very much, are error-prone to rely on, and can
limit future flexibility for the implementation.</font><br>
<br>
<br>
<div class="moz-cite-prefix">On 11/22/2024 1:07 PM, Mark Roberts
wrote:<br>
</div>
<blockquote type="cite" cite="mid:0a90ced46f14dd3dcb9fb58fcc2dc880@mail.gmail.com">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style>@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}@font-face
{font-family:Aptos;}p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:10.0pt;
font-family:"Calibri",sans-serif;}a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Calibri",sans-serif;
color:windowtext;}.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}div.WordSection1
{page:WordSection1;}</style>
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt">So to
summarize: it’s true today, but don’t rely on it.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Mark</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span></p>
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt">From:</span></b><span style="font-size:11.0pt"> Brian Goetz <<a href="mailto:brian.goetz@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">brian.goetz@oracle.com</a>>
<br>
<b>Sent:</b> Friday, November 22, 2024 8:02 AM<br>
<b>To:</b> Adam Sotona <<a href="mailto:adam.sotona@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">adam.sotona@oracle.com</a>>;
Mark Roberts <<a href="mailto:markro@cs.washington.edu" moz-do-not-send="true" class="moz-txt-link-freetext">markro@cs.washington.edu</a>>;
Chen Liang <<a href="mailto:chen.l.liang@oracle.com" moz-do-not-send="true" class="moz-txt-link-freetext">chen.l.liang@oracle.com</a>>;
<a href="mailto:classfile-api-dev@openjdk.org" moz-do-not-send="true" class="moz-txt-link-freetext">classfile-api-dev@openjdk.org</a><br>
<b>Subject:</b> Re: java.lang.classfile model
enumeration order</span></p>
</div>
</div>
<p class="MsoNormal"> </p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:13.5pt;font-family:"Courier New"">This
is a property of the implementation, but not something that
the spec guarantees, though. Also, in the middle of a
transformation pipeline, there is no longer a "classfile
order" to fall back on. So it is best to not assume
anything about ordering, unless the ordering is part of the
semantics (like the bytecodes in a method body.)<br>
<br>
<br>
<br>
</span><span style="font-size:11.0pt"></span></p>
<div>
<p class="MsoNormal">On 11/22/2024 5:42 AM, Adam Sotona wrote:</p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos">Hi Mark,</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos">Fields and
methods are included in the ClassElement stream or
iterator in the same order, and this order corresponds to
their order in the class file.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos">This principle
is common for the whole API, except for some
PseudoInstructions identifying their start and stop
positions in the stream by Labels. These
PseudoInstructions are always streamed before respective
LabelTargets.</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos">Adam</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:Aptos"> </span></p>
<div id="mail-editor-reference-message-container">
<div>
<div>
<div style="border:none;border-top:solid #b5c4df 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;font-family:Aptos;color:black">From: </span></b><span style="font-size:12.0pt;font-family:Aptos;color:black">classfile-api-dev
<a href="mailto:classfile-api-dev-retn@openjdk.org" moz-do-not-send="true"><classfile-api-dev-retn@openjdk.org></a>
on behalf of Mark Roberts <a href="mailto:markro@cs.washington.edu" moz-do-not-send="true"><markro@cs.washington.edu></a><br>
<b>Date: </b>Friday, 22 November 2024 at 1:12<br>
<b>To: </b>Chen Liang <a href="mailto:chen.l.liang@oracle.com" moz-do-not-send="true"><chen.l.liang@oracle.com></a>,
<a href="mailto:classfile-api-dev@openjdk.org" moz-do-not-send="true" class="moz-txt-link-freetext">classfile-api-dev@openjdk.org</a>
<a href="mailto:classfile-api-dev@openjdk.org" moz-do-not-send="true"><classfile-api-dev@openjdk.org></a><br>
<b>Subject: </b>java.lang.classfile model
enumeration order</span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt">Are
there any rules/guarantees that the order of items
in ClassModel::methods() will match the order in
‘for (ClassElement ce : cm)’ for the ce elements
that are MethodModel? And also for similar items
down the class hierarchy?</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span></p>
<p class="MsoNormal"><span style="font-size:11.0pt">Thank
you, Mark</span></p>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span></p>
</div>
</div>
</div>
</div>
</blockquote>
<p class="MsoNormal"><span style="font-size:11.0pt"> </span></p>
</div>
</blockquote>
<br>
</body>
</html>