<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>As a data point, i've never used classData() directly from a condy, mostly because either</div><div>- I had some other constraints to check,</div><div>- the requirement that the name is "_" make it uneasy to read the generated bytecode,<br></div><div>- classData() is called in the static block.<br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>regards,<br data-mce-bogus="1"></div><div>RĂ©mi<br data-mce-bogus="1"></div><div><br></div><hr id="zwchr" data-marker="__DIVIDER__"><div data-marker="__HEADERS__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><b>From: </b>"Brian Goetz" <brian.goetz@oracle.com><br><b>To: </b>"-" <liangchenblue@gmail.com>, "classfile-api-dev" <classfile-api-dev@openjdk.org><br><b>Sent: </b>Monday, March 13, 2023 6:54:23 PM<br><b>Subject: </b>Re: New constant API addition proposals for Classfile API<br></blockquote></div><div data-marker="__QUOTED_TEXT__"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;"><font size="4"><font face="monospace">(1) and (2) make total sense;
(3) seems a little much, since it is just defaulting in a single
argument?<br>
<br>
</font></font><br>
<div class="moz-cite-prefix">On 3/13/2023 1:49 PM, - wrote:<br>
</div>
<blockquote cite="mid:CABe8uE2UOb4wX7X04krpG-t5AGEacaufXFuikPMoxHxN943_Bg@mail.gmail.com">
<pre class="moz-quote-pre">Hi,
After migrating 26/30 classes in test/jdk/java to Classfile API
(<a class="moz-txt-link-freetext" href="https://github.com/liachmodded/jdk/commit/65ca55bc2e838823471de40f0e16f9770d932117" target="_blank">https://github.com/liachmodded/jdk/commit/65ca55bc2e838823471de40f0e16f9770d932117</a>),
I suggest to add these new APIs to constant API for ease of Classfile
API usage:
1. In ConstantDescs:
public static final String CONSTRUCTOR_NAME = "<init>";
public static final String CLASS_INITIALIZER_NAME = "<clinit>";
public static final MethodTypeDesc MTD_void = MethodTypeDesc.of(CD_void);
Since every instance class always has a constructor, and most likely,
its constructor has to call Object's no-arg constructor. The same
method type descriptor is shared for the static initializer too.
2. In ConstantDescs:
public static final DirectMethodHandleDesc BSM_CLASS_DATA = ...
public static final DirectMethodHandleDesc BSM_CLASS_DATA_AT = ...
Representing MethodHandles.classData and MethodHandles.classDataAt,
used by hidden classes frequently.
3. In DynamicConstantDesc:
public static DynamicConstantDesc ofTyped(DirectMethodHandleDesc
bootstrapMethod, ClassDesc constantType, ConstantDesc...
bootstrapArgs)
This is equivalent to calling ofNamed with ConstantDescs.DEFAULT_NAME,
useful for classData and classDataAt bootstrap methods.
</pre>
</blockquote>
<br><br></blockquote></div></div></body></html>