On Wed, 25 Sep 2024 12:03:58 GMT, Chen Liang <li...@openjdk.org> wrote:

>> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 2276:
>> 
>>> 2274:                 var thisClass = cm.thisClass();
>>> 2275:                 name = thisClass.asInternalName();
>>> 2276:                 sym = thisClass.asSymbol();
>> 
>> We only use this for determining package name are equal, and 
>> sym.packageName() does the similar transformations plus a bit more. Likely 
>> not a significant cost compared to the `ClassFile::parse` - but perhaps 
>> there's room for a utility method to get the package name directly from an 
>> internal name?
>
> This is not part of internal code path so I don't think it is that sensitive

Agree - was just thinking out loud on this one. What you have is good enough 
here.

>> src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 2440:
>> 
>>> 2438:         }
>>> 2439: 
>>> 2440:         record ClassDefiner(Lookup lookup, String name, byte[] bytes, 
>>> int classFlags, ClassFileDumper dumper) {
>> 
>> Rename `name` to `internalName`, dropping the explicit `internalName()` 
>> method.
>
> Should I rename other existing name vars too?

AFAICT they already use the record names, so we're not generating redundant 
code there.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/21170#discussion_r1775111423
PR Review Comment: https://git.openjdk.org/jdk/pull/21170#discussion_r1775110617

Reply via email to