On Tue, 24 Sep 2024 22:07:25 GMT, Chen Liang <li...@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. Changes requested by redestad (Reviewer). 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? 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. ------------- PR Review: https://git.openjdk.org/jdk/pull/21170#pullrequestreview-2327774125 PR Review Comment: https://git.openjdk.org/jdk/pull/21170#discussion_r1774943742 PR Review Comment: https://git.openjdk.org/jdk/pull/21170#discussion_r1774934606