<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<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">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>
</body>
</html>