On Wed, 25 Sep 2024 10:02:37 GMT, Claes Redestad <redes...@openjdk.org> wrote:

>> `MethodHandles.Lookup` defines a `ClassFile` for simple validations; it is 
>> unnecessary and can be scalarized manually. The removal of `ClassFile` class 
>> is also slightly helpful for bootstrap by reducing class loading. Also 
>> improved class file version checking in `VM` class.
>
> 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

> 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?

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21170#discussion_r1775101786
PR Review Comment: https://git.openjdk.org/jdk/pull/21170#discussion_r1775102743

Reply via email to