Integrated: 8376477: Avoid loading empty Lock classes in Shutdown and ReferenceQueue

Eirik Bjørsnøs eirbjo at openjdk.org
Thu Feb 26 16:37:25 UTC 2026


On Tue, 27 Jan 2026 10:01:34 GMT, Eirik Bjørsnøs <eirbjo at openjdk.org> wrote:

> Please review this PR which removes empty nested `Lock` classes in `java.lang.Shutdown` and `java.lang.ref.ReferenceQueue`. 
> 
> These are replaced with the more common "new Object()" idiom, which saves us loading these two nested classes.
> 
> Additionally, this PR marks the lock objects in `Shutdown` as `final`
> 
> This was initially discussed in https://mail.openjdk.org/pipermail/core-libs-dev/2026-January/157704.html.
> 
> Except the observability of the lock name class, this should be a strict refactoring. No tests updated, `noreg-cleanup`.

This pull request has now been integrated.

Changeset: 8b805630
Author:    Eirik Bjørsnøs <eirbjo at openjdk.org>
URL:       https://git.openjdk.org/jdk/commit/8b805630b4c54a8e9e489cff08f0260cd42dc362
Stats:     7 lines in 2 files changed: 0 ins; 2 del; 5 mod

8376477: Avoid loading empty Lock classes in Shutdown and ReferenceQueue

Reviewed-by: rriggs, shade

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

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


More information about the core-libs-dev mailing list