<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4" face="monospace">I think there really is nothing to
be done about type annotation consistency, and the cost of trying
to do so would be really high (both in effort and in runtime
cost.) </font><br>
<br>
<div class="moz-cite-prefix">On 2/27/2025 3:44 PM, Chen Liang wrote:<br>
</div>
<blockquote type="cite" cite="mid:SJ2PR10MB7669947A84EBE78392A55DC9A2CD2@SJ2PR10MB7669.namprd10.prod.outlook.com">
<style type="text/css" style="display:none;">P {margin-top:0;margin-bottom:0;}</style>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
In the recent documentation cleanup for the ClassFile API, I
noted there are a few inconsistencies in the handling of
attributes on the Code attribute.</div>
<ol start="1" data-editing-info="{"applyListStyleFromLevel":false,"orderedStyleType":1}" style="list-style-type: decimal;">
<li style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div class="elementToProof">CustomAttribute or
UnknownAttribute are not streamed; they can only be
discovered via AttributedElement methods.</div>
</li>
<li style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div class="elementToProof">While most attributes with LABELS
AttributeStability is not directly writable, StackMapTable
is; yet it does not recompute the BCI offsets if they are no
longer compatible.</div>
</li>
<li style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div class="elementToProof">Type annotations in Code are not
streamed if debug elements are off; yet CodeBuilder accepts
them if users provide them. Other debug elements like local
vars are dropped on both sides.</div>
</li>
</ol>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Here are my proposals:</div>
<ol start="1" data-editing-info="{"applyListStyleFromLevel":false,"orderedStyleType":1}" style="list-style-type: decimal;">
<li style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div class="elementToProof">To make both CustomAttribute and
UnknownAttribute CodeElement, and deliver them in
traversals, like as if they are class, method, or field
elements.</div>
</li>
<li style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div class="elementToProof">Inflate and recompute offsets if a
bound StackMapTable is written to another code body (such as
one with head injection)</div>
</li>
<li style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div class="elementToProof">Do nothing for type annotation
inconsistency for now. This one is a bit hard to determine
the best course of action.</div>
</li>
</ol>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
What do you think of my proposals for #1 and #2? FYI I have a
pull request open for the proposals at
<a href="https://github.com/openjdk/jdk/pull/23521" moz-do-not-send="true" class="moz-txt-link-freetext">https://github.com/openjdk/jdk/pull/23521</a>,
feel free to review.</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Also, I understand there is a demand for Labels in user
attributes. That topic is a bit more complex, and I wish to
address in another mail thread. (Feel free to start a thread
about it, too!)</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Regards,</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Chen Liang</div>
</blockquote>
<br>
</body>
</html>