RFR: 8376477: Avoid loading empty Lock classes in Shutdown and ReferenceQueue [v2]
Eirik Bjørsnøs
eirbjo at openjdk.org
Thu Feb 26 14:32:53 UTC 2026
On Thu, 26 Feb 2026 12:56:17 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`.
>
> Eirik Bjørsnøs has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>
> - Merge branch 'master' into remove-custom-lock-objects
> - Avoid loading custom empty Lock classes
Circling back to this PR now that the test fixes in #29455 is integrated.
I have synched this branch up with mainline and verified that the affected tests no longer fail in this PR.
While this PR is already marked ready for integration by the bots, I would appreciate a review after the latest merge commit, by @RogerRiggs, @shipilev or some other reviewer.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/29442#issuecomment-3967003149
More information about the core-libs-dev
mailing list