<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<font size="4"><font face="monospace">All of these are potential
uses in the long run. </font></font><br>
<br>
<div class="moz-cite-prefix">On 3/15/2023 3:17 PM, - wrote:<br>
</div>
<blockquote type="cite" cite="mid:CABe8uE3W9-7=kXNRBCk4pMkGgT6o1P4O2344vmoKwmaUEmb5jA@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">Since Classfile API is already seeing increased usage within JDK for
its convenience, I wonder about the feasibility of a few potential
usages:
1. In other JDK projects that change bytecode format, such as
Valhalla. I guess the Classfile API within these projects will just
adapt to the custom additions due to how it's distributed. Do we plan
to switch the bytecode generation in Valhalla to Classfile too? It
seems its constant API, which doesn't consider value or primitive
classes, needs an update in the first place.</pre>
</blockquote>
<br>
This is really three questions ;)<br>
<br>
- Once the classfile API is in the JDK, Valhalla can extend it to
support the new classfile flags, new bytecodes, and new descriptor
strings. Later, when Valhalla integrates, these changes to the API
will come in with it. <br>
- The compiler and related tools currently have their own classfile
library. It would be nice, eventually, to replace this with the
official classfile API. We will likely start with `javap`, but the
compiler is likely to be the last piece to change. <br>
- The constants API will need some changes to support value class
descriptors, but this is waiting for the Valhalla translation scheme
to be locked down. (It is still possible we will find a way to do
without Q descriptors.)<br>
<br>
<blockquote type="cite" cite="mid:CABe8uE3W9-7=kXNRBCk4pMkGgT6o1P4O2344vmoKwmaUEmb5jA@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">2. External tools, like asmtools. Don't know if Classfile API can
simplify its logic or not, and whether it can use Classfile API in the
first place.</pre>
</blockquote>
<br>
Over time, we will migrate internal tools and JDK usages to the
classfile API. This is an area where the community can likely
help, if you're looking :)<br>
<br>
<blockquote type="cite" cite="mid:CABe8uE3W9-7=kXNRBCk4pMkGgT6o1P4O2344vmoKwmaUEmb5jA@mail.gmail.com">
<pre class="moz-quote-pre" wrap="">3. Reflection API for Annotations. The reflection API currently pulls
annotation attribute bytes directly from the class bytes in the VM,
and Classfile API might be able to handle the bytes to annotation
conversion better.
</pre>
</blockquote>
<br>
I hadn't considered this one, but yes, this is a possible
application. <br>
<br>
It will surely take a long time to fully migrate away from ASM,
classreader, and other forms of bytecode analysis, but we'd like to
get there.<br>
</body>
</html>