On Fri, 13 Sep 2024 15:40:46 GMT, Claes Redestad <redes...@openjdk.org> wrote:
> Simple internal refactor to load a few classes less on startup. Arguably > cleaner. The private methods don’t need to be `ACC_VARARGS`, also remove excess whitespace between `ClassOption` and `...` to match the code style of the rest of the JDK. Also, it might be a good idea to add overloads which don’t take any options to avoid unnecessary allocation of zero‑length arrays, such as those in `InvokerBytecodeGenerator`, `MethodHandleProxies`, and `StringConcatFactory`. src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java line 80: > 78: private static final boolean disableEagerInitialization; > 79: > 80: public static final MethodHandles.Lookup.ClassOption[] > LAMBDA_CLASS_OPTIONS = { NESTMATE, STRONG }; Suggestion: private static final MethodHandles.Lookup.ClassOption[] LAMBDA_CLASS_OPTIONS = { NESTMATE, STRONG }; src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 1909: > 1907: } > 1908: > 1909: static int optionsToFlag(ClassOption ... options) { Suggestion: static int optionsToFlag(ClassOption[] options) { src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 2390: > 2388: private ClassDefiner makeHiddenClassDefiner(byte[] bytes, > 2389: boolean > accessVmAnnotations, > 2390: ClassOption ... > options) { Suggestion: ClassOption[] options) { src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 2405: > 2403: * @return ClassDefiner that defines a hidden class of the > given bytes and options. > 2404: */ > 2405: ClassDefiner makeHiddenClassDefiner(String name, byte[] bytes, > ClassFileDumper dumper, ClassOption ... options) { Suggestion: ClassDefiner makeHiddenClassDefiner(String name, byte[] bytes, ClassFileDumper dumper, ClassOption... options) { src/java.base/share/classes/java/lang/invoke/MethodHandles.java line 2423: > 2421: boolean > accessVmAnnotations, > 2422: ClassFileDumper > dumper, > 2423: ClassOption ... > options) { Suggestion: ClassOption[] options) { ------------- PR Review: https://git.openjdk.org/jdk/pull/21002#pullrequestreview-2303790450 PR Review Comment: https://git.openjdk.org/jdk/pull/21002#discussion_r1759296535 PR Review Comment: https://git.openjdk.org/jdk/pull/21002#discussion_r1759296736 PR Review Comment: https://git.openjdk.org/jdk/pull/21002#discussion_r1759297371 PR Review Comment: https://git.openjdk.org/jdk/pull/21002#discussion_r1759297457 PR Review Comment: https://git.openjdk.org/jdk/pull/21002#discussion_r1759297538