RFR: 8292914: Drop the counter from lambda class names

David M. Lloyd duke at openjdk.org
Wed Feb 15 20:53:02 UTC 2023


On Wed, 15 Feb 2023 17:32:38 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.

(On the debugability topic) I had thought to change the lambda class dumping code so that it would dump the class bytes *after* the class was defined (to capture the unique hidden class name completely). But this would exclude the case where the class would fail to be defined, which would probably undermine some significant percentage of the cases where you'd want a dump in the first place. Maybe in this case, since the class name would never appear in any stack trace anyway (and thus there is nothing to actually correlate), it could be dumped with a separate counter like `..Lambda$$-error1.class` or something?

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

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


More information about the core-libs-dev mailing list