<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);">
Hello all,</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Since the release of Java 24, I wish to share some latest news about the upcoming features in the ClassFile API.</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<ol start="1" data-editing-info="{"applyListStyleFromLevel":false,"orderedStyleType":1}" style="margin-top: 0px; margin-bottom: 0px; 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">UnknownAttribute and CustomAttribute are now delivered in traversal of CodeModel.
<a href="https://bugs.openjdk.org/browse/JDK-8347472" id="OWA3a96d0e3-85b6-86ad-42b5-ac7bc2138258" class="OWAAutoLink">
https://bugs.openjdk.org/browse/JDK-8347472</a></div>
</li><li style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div class="elementToProof">StackMapsTableAttribute reused for NO_STACK_MAPS transformation (such as System.out.println on method entry) now updates its BCIs. (Same above, JDK-8347472)</div>
</li><li style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div class="elementToProof">The default flags of ClassBuilder is now ACC_PUBLIC + ACC_SUPER, in anticipation of identity classes when Value Objects JEP is integrated.</div>
</li></ol>
<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);">
And there are a few proposed features, please don't hesitate to comment or review:</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<ol start="1" data-editing-info="{"applyListStyleFromLevel":false,"orderedStyleType":1}" style="margin-top: 0px; margin-bottom: 0px; 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">Add matches() methods to CP entries for convenient and fast checking.
<a href="https://github.com/openjdk/jdk/pull/23548">https://github.com/openjdk/jdk/pull/23548</a></div>
</li><li style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div class="elementToProof">Add explicit counter support for performance-sensitive code building.
<a href="https://github.com/openjdk/jdk/pull/24903">https://github.com/openjdk/jdk/pull/24903</a></div>
</li><li style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<div class="elementToProof">Add XxxBuilder::transforming the same way CodeBuilder::transforming behaves.
<a href="https://github.com/openjdk/jdk/pull/24908">https://github.com/openjdk/jdk/pull/24908</a></div>
</li></ol>
<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);">
Note for XxxBuilder::transforming:</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
It covers this ASM usage pattern currently not supported by the ClassFile API:</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
// ASM</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
ClassVisitor cv = new DelegateClassVisitor(new ClassWriter(...));</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
cv.visitXxx(); // write elements through the delegate</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);">
// ClassFile API</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
cf.build(..., clb0 -> clb0.transforming((clb, cle) -> /*process */, clb -> {</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
// write elements through delegate</div>
<div style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
}));</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
And it introduces a source incompatibility if you are using ClassFileBuilder as a variable type, like ClassFileBuilder<?, ?>.</div>
<div class="elementToProof" style="font-family: "Calibri Light", "Helvetica Light", sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
See this draft release note <a href="https://bugs.openjdk.org/browse/JDK-8355665">
https://bugs.openjdk.org/browse/JDK-8355665</a> for migration help.</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 on the Valhalla side: ClassFile API is providing first-class support for strict fields and the updated stack map table format, including parsing, manual creation, and automatic generation.</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);">
Please feel free to review the PRs linked! And don't hesitate to reply with any comment or question.</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>