On Thu, 23 Feb 2023 23:50:16 GMT, Mandy Chung <mch...@openjdk.org> wrote:

>> David M. Lloyd has updated the pull request incrementally with two 
>> additional commits since the last revision:
>> 
>>  - Many tests have patterns for lambda class names; update them
>>  - Update comments and javadoc showin the old pattern
>
> src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java 
> line 370:
> 
>> 368:                 if (useImplMethodHandle) {
>> 369:                     lookup = 
>> caller.defineHiddenClassWithClassData(classBytes, implementation, 
>> !disableEagerInitialization,
>> 370:                         NESTMATE, STRONG);
> 
> nit: formatting - align this line to the first argument `classBytes` in L369.

Done.

> src/java.base/share/classes/java/lang/invoke/InnerClassLambdaMetafactory.java 
> line 374:
> 
>> 372:                     lookup = caller.defineHiddenClass(classBytes, 
>> !disableEagerInitialization, NESTMATE, STRONG);
>> 373:                 }
>> 374:             } catch (Throwable t) {
> 
> suggest to use try-finally in writing the file.
> 
> 
>             Lookup lookup = null;
>             try {
>                 if (useImplMethodHandle) {
>                     lookup = 
> caller.defineHiddenClassWithClassData(classBytes, implementation, 
> !disableEagerInitialization,
>                                                                    NESTMATE, 
> STRONG);
>                 } else {
>                     lookup = caller.defineHiddenClass(classBytes, 
> !disableEagerInitialization, NESTMATE, STRONG);
>                 }
>             } finally {
>                 // If requested, dump out to a file for debugging purposes
>                 if (dumper != null) {
>                     final String name;
>                     if (lookup != null) {
>                         String definedName = lookup.lookupClass().getName();
>                         int suffixIdx = definedName.lastIndexOf('/');
>                         assert suffixIdx != -1;
>                         name = lambdaClassName + '.' + 
> definedName.substring(suffixIdx + 1);
>                     } else {
>                         name = lambdaClassName + ".failed-" + 
> counter.incrementAndGet();
>                     }
>                     doDump(name, classBytes);
>                 }
>             }
>             return lookup.lookupClass();

Done, with the small difference that I move the `return lookup.lookupClass()` 
into the `try` block because IntelliJ IDEA thought that `lookup` could be 
`null` at the point of the `return` statement; I figure, if IDEA can get that 
wrong then a casual reader might get it wrong too.

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

PR: https://git.openjdk.org/jdk/pull/12579

Reply via email to