RFR: 8292914: Drop the counter from lambda class names [v4]

Ioi Lam iklam at openjdk.org
Thu Feb 16 06:52:27 UTC 2023


On Thu, 16 Feb 2023 01:42:16 GMT, David M. Lloyd <duke at openjdk.org> wrote:

>> The class generated for lambda proxies is now defined as a hidden class. This means that the counter, which was used to ensure a unique class name and avoid clashes, is now redundant. In addition to performing redundant work, this also impacts build reproducibility for native image generators which might already have a strategy to cope with hidden classes but cannot cope with indeterminate definition order for lambda proxy classes.
>> 
>> This solves JDK-8292914 by making lambda proxy names always be stable without any configuration needed. This would also replace #10024.
>
> David M. Lloyd has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Fix LambdaAsm test
>  - Fix stack walker test

For debugging, the `-Djava.lang.invoke.MethodHandle.DUMP_CLASS_FILES=true`  property addes a unique suffix to the generated `LambdaForm$MH` classes.

https://github.com/openjdk/jdk/blob/1480d418e3b7d1f36ace24a043a273fca446eefa/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java#L128-L130

So for Lambda proxy classes, instead of inventing a new way of unique class names, perhaps we can use the existing AtomicInteger counter only when `-Djdk.internal.lambda.dumpProxyClasses=` is specified?

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

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


More information about the core-libs-dev mailing list