RFD: Replace class java.lang.Shutdown.Lock with Object?
Roger Riggs
roger.riggs at oracle.com
Mon Jan 26 23:04:27 UTC 2026
Hi,
String is also an Identity class and its value could distinguish
between the cases. (Both strings can be very short).
About java.lang.Object as a lock, the pervasiveness of `new Object()`
for locks resulted in giving it special dispensation in as a supertype
of value objects. Trying to change its existing uses was determined to
be infeasible.
Regards, Roger
On 1/25/26 11:17 AM, Chen Liang wrote:
> Checked this and noted this Lock is used by both lock and shutdownLock
> - this makes the Lock class less informative to me.
> Maybe we should replace one of the locks with Object, or add a new
> class to distinguish these two locks?
>
> Confidential- Oracle Internal
>
> ------------------------------------------------------------------------
> *From:* core-libs-dev <core-libs-dev-retn at openjdk.org> on behalf of
> Eirik Bjørsnøs <eirbjo at gmail.com>
> *Sent:* Wednesday, January 21, 2026 12:28 AM
> *To:* David Holmes <david.holmes at oracle.com>
> *Cc:* core-libs-dev at openjdk.org <core-libs-dev at openjdk.org>
> *Subject:* Re: RFD: Replace class java.lang.Shutdown.Lock with Object?
> On Wed, Jan 21, 2026 at 6:38 AM David Holmes <david.holmes at oracle.com>
> wrote:
>
> No I suppose not. Though I'm not sure trimming the class will make
> any
> observable/practical difference in the normal case.
>
>
> Thanks! I agree trimming these two classes (of ~428 loaded at startup)
> alone has limited value. But there are other berries to pick and
> the cumulative impact may have an observable effect on startup. Two
> berries feed no one, with a handful we can make a delicious jam :)
>
> So effectively this is like declaring a single global class that all
> "new Object()'s" would be instances of.
>
> So using new Object() will not be a problem.
>
>
> Thanks for the Valhalla reference, interesting to see how "new
> Object()" can be redefined like this.
>
> Eirik.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.org/pipermail/core-libs-dev/attachments/20260126/e111a704/attachment.htm>
More information about the core-libs-dev
mailing list