Avoid loading custom empty Lock classes

This commit is contained in:
Eirik Bjorsnos 2026-01-27 10:51:23 +01:00
parent 932556026d
commit 4f17d3fa88
2 changed files with 5 additions and 7 deletions

View File

@ -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

View File

@ -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<? extends T> 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.