diff --git a/src/java.base/share/classes/java/lang/Shutdown.java b/src/java.base/share/classes/java/lang/Shutdown.java index 87c4732a5ce..a9d4d6a28a9 100644 --- a/src/java.base/share/classes/java/lang/Shutdown.java +++ b/src/java.base/share/classes/java/lang/Shutdown.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -55,11 +55,10 @@ class Shutdown { private static int currentRunningHook = -1; /* The preceding static fields are protected by this lock */ - private static class Lock { }; - private static Object lock = new Lock(); + private static final Object lock = new Object(); /* Lock object for the native halt method */ - private static Object haltLock = new Lock(); + private static final Object haltLock = new Object(); /** * Add a new system shutdown hook. Checks the shutdown state and diff --git a/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java b/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java index d3879d4a8fc..ee1892e8878 100644 --- a/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java +++ b/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2026, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -60,8 +60,7 @@ public class ReferenceQueue<@jdk.internal.RequiresIdentity T> { private volatile Reference head; private long queueLength = 0; - private static class Lock { }; - private final Lock lock = new Lock(); + private final Object lock = new Object(); /** * Constructs a new reference-object queue.