RFR: 8311085: Remove implementation detail writeTo from LocalVariable(Type)
Brian Goetz
brian.goetz at oracle.com
Thu Jun 29 13:56:48 UTC 2023
It is irritating that one is a type descriptor and one is a signature,
but we can launder that by observing that both are Utf8Entry.
On 6/29/2023 9:53 AM, Chen Liang wrote:
> On Thu, 29 Jun 2023 13:41:17 GMT, Brian Goetz<briangoetz at openjdk.org> wrote:
>
>>> `LocalVariable` and `LocalVariableType` includes `writeTo(BufWriter)`, which should be implementation details.
>>>
>>> Seehttps://mail.openjdk.org/pipermail/classfile-api-dev/2023-June/000381.html for context.
>>>
>>> This patch moves the implementation to `DirectCodeBuilder`'s original use sites; the old `b.canWriteDirect` branch is redundant, as `writeIndex`'s implementation already performs such an optimization.
>> src/java.base/share/classes/jdk/internal/classfile/impl/DirectCodeBuilder.java line 280:
>>
>>> 278: b.writeIndex(l.name());
>>> 279: b.writeIndex(l.type());
>>> 280: b.writeU2(l.slot());
>> This idiom is repeated four times; seems like it can be factored somewhere into a helper?
> Good idea. The same routine is used in attribute mapper for the two tables, which could be factored as well.
>
> -------------
>
> PR Review Comment:https://git.openjdk.org/jdk/pull/14705#discussion_r1246652541
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20230629/bea6b896/attachment.htm>
More information about the core-libs-dev
mailing list