Skip to content

Commit 986d377

Browse files
author
Eirik Bjørsnøs
committed
8376533: Remove test dependencies on ReferenceQueue$Lock in preparation for JDK-8376477
Reviewed-by: rriggs, shade, cjplummer
1 parent cd5256d commit 986d377

File tree

5 files changed

+18
-20
lines changed

5 files changed

+18
-20
lines changed

test/hotspot/jtreg/serviceability/sa/ClhsdbInspect.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@ public static void main(String[] args) throws Exception {
5252
System.out.println("Started LingeredApp with pid " + theApp.getPid());
5353

5454
// Run the 'jstack -v' command to get the address of a Method*,
55-
// the oop address of a java.lang.ref.ReferenceQueue$Lock
55+
// the oop address of a LingeredAppWithLock$NestedLock
5656
// and the oop address of a java.lang.Class object
5757
List<String> cmds = List.of("jstack -v");
5858

@@ -63,8 +63,8 @@ public static void main(String[] args) throws Exception {
6363
tokensMap.put("(a java.lang.Class for LingeredAppWithLock)",
6464
"instance of Oop for java/lang/Class");
6565
tokensMap.put("Method*=", "Type is Method");
66-
tokensMap.put("(a java.lang.ref.ReferenceQueue$Lock)",
67-
"instance of Oop for java/lang/ref/ReferenceQueue\\$Lock");
66+
tokensMap.put("(a LingeredAppWithLock$NestedLock)",
67+
"instance of Oop for LingeredAppWithLock\\$NestedLock");
6868

6969
String[] lines = jstackOutput.split("\\R");
7070

test/hotspot/jtreg/serviceability/sa/LingeredAppWithLock.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2017, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -27,6 +27,8 @@
2727
public class LingeredAppWithLock extends LingeredApp {
2828
private static Object lockObj = new Object();
2929

30+
private static class NestedLock {}
31+
3032
public static void lockMethod(Object lock) {
3133
synchronized (lock) {
3234
try {
@@ -50,12 +52,14 @@ public static void waitMethod() {
5052
public static void main(String args[]) {
5153
Thread classLock1 = new Thread(() -> lockMethod(LingeredAppWithLock.class));
5254
Thread classLock2 = new Thread(() -> lockMethod(LingeredAppWithLock.class));
55+
Thread nestedClassLock = new Thread(() -> lockMethod(new NestedLock()));
5356
Thread objectLock = new Thread(() -> lockMethod(classLock1));
5457
Thread primitiveLock = new Thread(() -> lockMethod(int.class));
5558
Thread objectWait = new Thread(() -> waitMethod());
5659

5760
classLock1.start();
5861
classLock2.start();
62+
nestedClassLock.start();
5963
objectLock.start();
6064
primitiveLock.start();
6165
objectWait.start();
@@ -65,6 +69,8 @@ public static void main(String args[]) {
6569
classLock1.getState() != Thread.State.TIMED_WAITING) ||
6670
(classLock2.getState() != Thread.State.BLOCKED &&
6771
classLock2.getState() != Thread.State.TIMED_WAITING) ||
72+
(nestedClassLock.getState() != Thread.State.BLOCKED &&
73+
nestedClassLock.getState() != Thread.State.TIMED_WAITING) ||
6874
(objectLock.getState() != Thread.State.TIMED_WAITING) ||
6975
(primitiveLock.getState() != Thread.State.TIMED_WAITING) ||
7076
(objectWait.getState() != Thread.State.TIMED_WAITING)) {

test/jdk/java/util/concurrent/ConcurrentHashMap/ConcurrentAssociateTest.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2013, 2016, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2013, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -171,13 +171,9 @@ static void dumpTestThreads() {
171171
String lockName;
172172
if ("Signal Dispatcher".equals(name))
173173
continue;
174-
if ("Reference Handler".equals(name)
175-
&& (lockName = info.getLockName()) != null
176-
&& lockName.startsWith("java.lang.ref.Reference$Lock"))
174+
if ("Reference Handler".equals(name))
177175
continue;
178-
if ("Finalizer".equals(name)
179-
&& (lockName = info.getLockName()) != null
180-
&& lockName.startsWith("java.lang.ref.ReferenceQueue$Lock"))
176+
if ("Finalizer".equals(name))
181177
continue;
182178
System.err.print(info);
183179
}

test/jdk/java/util/concurrent/Phaser/Basic.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -434,11 +434,9 @@ static void dumpTestThreads() {
434434
String name = info.getThreadName();
435435
if ("Signal Dispatcher".equals(name))
436436
continue;
437-
if ("Reference Handler".equals(name)
438-
&& info.getLockName().startsWith("java.lang.ref.Reference$Lock"))
437+
if ("Reference Handler".equals(name))
439438
continue;
440-
if ("Finalizer".equals(name)
441-
&& info.getLockName().startsWith("java.lang.ref.ReferenceQueue$Lock"))
439+
if ("Finalizer".equals(name))
442440
continue;
443441
if (name.startsWith("process reaper"))
444442
continue;

test/micro/org/openjdk/bench/jdk/internal/jrtfs/ImageReaderBenchmark.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2025, 2026, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -447,7 +447,6 @@ private static void reportMissingClassesAndFail(ColdStart state, int errors) thr
447447
"/modules/java.base/jdk/internal/access/JavaLangRefAccess.class",
448448
"/modules/java.base/java/lang/ref/ReferenceQueue.class",
449449
"/modules/java.base/java/lang/ref/ReferenceQueue$Null.class",
450-
"/modules/java.base/java/lang/ref/ReferenceQueue$Lock.class",
451450
"/modules/java.base/jdk/internal/access/JavaLangAccess.class",
452451
"/modules/java.base/jdk/internal/util/SystemProps.class",
453452
"/modules/java.base/jdk/internal/util/SystemProps$Raw.class",
@@ -1073,6 +1072,5 @@ private static void reportMissingClassesAndFail(ColdStart state, int errors) thr
10731072
"/modules/java.base/java/nio/charset/CoderResult.class",
10741073
"/modules/java.base/java/util/IdentityHashMap$IdentityHashMapIterator.class",
10751074
"/modules/java.base/java/util/IdentityHashMap$KeyIterator.class",
1076-
"/modules/java.base/java/lang/Shutdown.class",
1077-
"/modules/java.base/java/lang/Shutdown$Lock.class");
1075+
"/modules/java.base/java/lang/Shutdown.class");
10781076
}

0 commit comments

Comments
 (0)