diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java index 94a209f6e65..d2e63f024f5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -173,6 +173,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -209,9 +210,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -231,7 +229,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); classType = (ClassType) testedclass; @@ -241,7 +238,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up a breakpoint"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001a.java index b843a177d7b..f678ac244ca 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/invokeMethod/invokemethod001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -59,6 +59,8 @@ private static void logErr(String message) { //====================================================== test program + static Thread test_thread = null; + // String mName = //!!!!!!!!!!!!!!!!!!!!!! // "nsk.jdi.ClassType.invokeMethod"; @@ -98,8 +100,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadinvokemethod001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadinvokemethod001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java index b36d63c308e..6fc9a24bf89 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -184,6 +184,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -216,8 +217,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine1 = "breakpointLineNumber1"; - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -228,7 +227,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(threadClassName); threadClass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -237,21 +235,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - - log2("......getting Thread thread2 - 1-st argument"); - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up a breakpoint"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001a.java index 434918cf86e..da5121abede 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -59,6 +59,7 @@ private static void logErr(String message) { //====================================================== test program + static Thread test_thread = null; static TestClass obj = new TestClass(); //---------------------------------------------------- main method @@ -96,8 +97,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadnewinstance001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadnewinstance001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002.java index df33538733e..2ca320d1581 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -181,6 +181,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -213,8 +214,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine1 = "breakpointLineNumber1"; - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -225,7 +224,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(threadClassName); threadClass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -234,20 +232,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up a breakpoint"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002a.java index 4ae343397bb..21ddf900881 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ClassType/newInstance/newinstance002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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,6 +60,7 @@ private static void logErr(String message) { //====================================================== test program + static Threadnewinstance002a test_thread = null; // static TestClass obj = new TestClass(); //---------------------------------------------------- main method @@ -97,7 +98,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Threadnewinstance002a test_thread = + test_thread = new Threadnewinstance002a("testedThread"); log1(" thread2 is created"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001.java index 6c2e0e37db5..066848a9d81 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -168,6 +168,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -199,8 +200,6 @@ private int runThis (String argv[], PrintStream out) { String breakpointMethod1 = "runt1"; String bpLine1 = "breakpointLineNumber1"; - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -211,7 +210,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedClass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -220,19 +218,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up a breakpoint"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001a.java index d58fe7eba0c..1602c6633f7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadgetvalue001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadgetvalue001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002.java index cf137dd5785..3eed80a7fd1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -172,6 +172,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -204,8 +205,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine1 = "breakpointLineNumber1"; - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -216,7 +215,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(threadClassName); threadClass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -225,21 +223,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - - log2("......getting Thread thread2 - 1-st argument"); - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up a breakpoint"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002a.java index 6e47f790924..bf21a09c44d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/getValue/getvalue002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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,6 +60,7 @@ private static void logErr(String message) { //====================================================== test program + static getvalue002aThread test_thread = null; static getvalue002aTestClass obj = new getvalue002aTestClass(); //---------------------------------------------------- main method @@ -97,8 +98,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - getvalue002aThread test_thread = - new getvalue002aThread("testedThread"); + test_thread = new getvalue002aThread("testedThread"); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java index 6fda6375ee2..2fb81d7ddac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -176,6 +176,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -233,25 +234,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } - - if (thread2 == null) { - log3("ERROR: didn't find thread '" + threadName + "'"); - expresult = returnCode1; - break label0; - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); threadObjRef = thread2; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001a.java index d0bca2b31d9..cb322d75ee9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/invokeMethod/invokemethod001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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,6 +60,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Threadinvokemethod001a test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -95,8 +98,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Threadinvokemethod001a test_thread = - new Threadinvokemethod001a("testedThread"); + test_thread = new Threadinvokemethod001a("testedThread"); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java index 3acfeef10c3..0fdf879f673 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -153,6 +153,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -179,35 +180,9 @@ private int runThis (String argv[], PrintStream out) { String threadName = "testedThread"; - - List allThreads = null; - ListIterator listIterator = null; - - label0: { - log2("getting ThreadReference object"); - try { - allThreads = vm.allThreads(); - } catch ( Exception e) { - log3("ERROR: Exception at very beginning !? : " + e); - expresult = returnCode1; - break label0; - } - - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); } label1: { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001a.java index 471c13c44e4..88cdccadb4a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ObjectReference/referenceType/referencetype001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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,6 +60,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Threadreferencetype001a test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -95,8 +98,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Threadreferencetype001a test_thread = - new Threadreferencetype001a("testedThread"); + test_thread = new Threadreferencetype001a("testedThread"); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001.java index 3364faf11fa..38a13e0863a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -168,6 +168,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -204,9 +205,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -224,7 +222,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -233,7 +230,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001a.java index 81f8782f8d2..bb62a21e8e9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,7 +96,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = + test_thread = JDIThreadFactory.newThread(new Threadgetvalue001a("testedThread")); log1(" thread2 is created"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002.java index 4306c1024a9..1e61ed92720 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -174,6 +174,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -211,8 +212,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine3 = "breakpointLineNumber3"; - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -230,7 +229,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -239,7 +237,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002a.java index 2108d301698..96be4327c26 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValue/getvalue002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadgetvalue002a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadgetvalue002a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001.java index 59f2abab4de..1a2302983d4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -169,6 +169,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -205,9 +206,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -225,7 +223,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -234,7 +231,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001a.java index c640ba3138c..8ec36ad4ca2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadgetvalues001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadgetvalues001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002.java index 0c3b235fdf7..5609d7813b4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -176,6 +176,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -212,9 +213,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -232,7 +230,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -241,7 +238,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002a.java index 4d726cef3e5..4140c045521 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/getValues/getvalues002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadgetvalues002a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadgetvalues002a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java index 408122474b5..d111d5bab02 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -174,6 +174,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -210,9 +211,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -230,7 +228,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -239,7 +236,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up a breakpoint"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001a.java index af6ed716c15..8f4129ff34d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/location/location001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadlocation001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadlocation001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001.java index 910ecff94b4..978681c2c1d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -252,6 +252,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section @@ -289,9 +290,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -309,7 +307,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -318,7 +315,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001a.java index 00b234645d2..28e993f7005 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue001/setvalue001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,7 +58,10 @@ private static void logErr(String message) { } //====================================================== test program - //---------------------------------------------------- main method + + static Thread test_thread = null; + + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,7 +96,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = + test_thread = JDIThreadFactory.newThread(new Threadsetvalue001a("testedThread")); log1(" thread2 is created"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002.java index 49544e795d7..fa63588a11f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -266,6 +266,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -302,9 +303,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -322,7 +320,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -331,7 +328,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002a.java index c64790c1c41..7afbe3c80bb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue002/setvalue002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -59,7 +59,7 @@ private static void logErr(String message) { //====================================================== test program - static public Thread test_thread = null; + static Thread test_thread = null; //---------------------------------------------------- main method @@ -97,7 +97,7 @@ public static void main (String argv[]) { case 0: test_thread = - JDIThreadFactory.newThread(new Threadsetvalue002a("testedThread")); + JDIThreadFactory.newThread(new Threadsetvalue002a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java index 5470a720801..0e9f798e319 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -260,6 +260,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -296,9 +297,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -316,7 +314,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -325,7 +322,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003a.java index 615b8786a42..311fc2c8b30 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue003/setvalue003a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -57,6 +57,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -92,8 +95,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadsetvalue003a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadsetvalue003a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004.java index 5d8010ef48d..bbf4d95f95e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -253,6 +253,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -289,9 +290,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -309,7 +307,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -318,7 +315,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004a.java index 34b501fa176..e7ecdc4d930 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/setValue/setvalue004/setvalue004a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -57,6 +57,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -92,8 +95,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadsetvalue004a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadsetvalue004a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001.java index 97bd0ed68e7..2629dfc5e0f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -170,6 +170,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -206,9 +207,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -226,7 +224,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -235,7 +232,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001a.java index 80d06e0364f..10d34374c75 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -59,6 +59,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Threadthisobject001a test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -94,8 +97,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Threadthisobject001a test_thread = - new Threadthisobject001a("testedThread"); + test_thread = new Threadthisobject001a("testedThread"); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002.java index 92af5040a9d..82038fbaaaf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -169,6 +169,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -205,9 +206,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -225,7 +223,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -234,7 +231,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002a.java index f99281fce86..63a3ae9b657 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thisObject/thisobject002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -94,8 +97,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadthisobject002a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadthisobject002a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java index e95f92ddee9..3125c163d70 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -167,6 +167,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -203,9 +204,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -223,7 +221,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -232,7 +229,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up a breakpoint"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001a.java index 2ed786de5c4..9d48619f2c3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/thread/thread001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadthread001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadthread001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java index 4502fb235f2..6137275fa23 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -172,6 +172,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -208,9 +209,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -228,7 +226,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -237,7 +234,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001a.java index dcf210c8ef2..65abcc5c08f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadvisiblevarbyname001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadvisiblevarbyname001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002.java index 9e5c0e3d3d8..4899fd1aa1c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -163,6 +163,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -199,9 +200,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -219,7 +217,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -228,7 +225,8 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); + log2("setting up breakpoints"); breakpRequest1 = settingBreakpoint(breakpointMethod1, bpLine1, "one"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002a.java index be0f57e2a19..47afb882e3c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariableByName/visiblevarbyname002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadvisiblevarbyname002a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadvisiblevarbyname002a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001.java index 32b262071fd..86941e2edb7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -167,6 +167,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -203,9 +204,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -223,7 +221,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -232,7 +229,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001a.java index 7c5255421a0..b12d3ce1d66 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadvisiblevariables001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadvisiblevariables001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002.java index f1b00b5a975..14d2e7b267d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -164,6 +164,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -200,9 +201,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -220,7 +218,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference object"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -229,7 +226,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - thread2 = debuggee.threadByName(threadName); + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002a.java index 3f61c2fc00e..c72dba87a54 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/StackFrame/visibleVariables/visiblevariables002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,7 +96,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = + test_thread = JDIThreadFactory.newThread(new Threadvisiblevariables002a("testedThread")); log1(" thread2 is created"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java index e9a089bb0a3..7cc305c6293 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -83,6 +83,7 @@ public static int run(String argv[], PrintStream out) { public void doTest() { // initialize breakpoint + ReferenceType debuggeeClass = debuggee.classByName(debuggeeClassName()); ReferenceType referenceType = debuggee.classByName(ClassUsingTestClass.class.getName()); BreakpointRequest breakpointRequest = debuggee.makeBreakpoint(referenceType, @@ -116,7 +117,8 @@ public void doTest() { } } - ThreadReference threadReference = debuggee.threadByName(forceEarlyReturn002a.mainThreadName); + ThreadReference threadReference = + debuggee.threadByFieldNameOrThrow(debuggeeClass, "mainThread", forceEarlyReturn002a.mainThreadName); try { if (testClassIsLoaded) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java index 1351c7dacfd..9d138021374 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/forceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -59,12 +59,14 @@ public class forceEarlyReturn002a extends AbstractJDIDebuggee { public String[] doInit(String args[]) { args = super.doInit(args); - Thread.currentThread().setName(mainThreadName); + mainThread = Thread.currentThread(); + mainThread.setName(mainThreadName); return args; } public static String mainThreadName = "MainThread"; + public static Thread mainThread = null; // call testClassMethod() public final static String COMMAND_CALL_OBJECT_METHOD = "callObjectMethod"; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java index 85ac08b35a8..23f395da42d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -184,6 +184,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -221,9 +222,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -243,7 +241,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -252,19 +249,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001a.java index 1e539df3d0d..c6a57a58e95 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frame/frame001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadframe001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadframe001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001.java index 60610373b86..d55af33192b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -175,6 +175,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -212,9 +213,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -232,7 +230,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -241,19 +238,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001a.java index 86ce89e1d5f..9dc666a225b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frameCount/framecount001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadframecount001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadframecount001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java index 11827a71170..aa7765f487e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -189,6 +189,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -226,9 +227,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -248,7 +246,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -257,19 +254,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001a.java index 4e5f4987a0a..d8ede6ae49d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames/frames001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -59,6 +59,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Threadframes001a test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -94,7 +97,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Threadframes001a test_thread = + test_thread = new Threadframes001a("testedThread"); log1(" thread2 is created"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001.java index 3ac9a39da88..869bf03e28c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -190,6 +190,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -228,9 +229,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest0 = null; @@ -250,7 +248,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -259,19 +256,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001a.java index 5a87140a1dc..916d40cd4bb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,7 +96,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = + test_thread = JDIThreadFactory.newThread(new Threadframes_ii001a("testedThread")); log1(" thread2 is created"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002.java index 0109d783e97..54bcbc51d62 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -173,6 +173,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -211,9 +212,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest0 = null; @@ -234,7 +232,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -243,19 +240,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up a breakpoint"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002a.java index 013ef438b8c..8d2b7d1d928 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/frames_ii/frames_ii002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -59,6 +59,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Threadframes_ii002a test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -94,7 +97,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Threadframes_ii002a test_thread = + test_thread = new Threadframes_ii002a("testedThread"); log1(" thread2 is created"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java index ff41fb4caaf..7b03d08dcf5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -167,6 +167,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -204,9 +205,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -220,7 +218,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -229,19 +226,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001a.java index d2c49da45b5..2db902f6a63 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isAtBreakpoint/isatbreakpoint001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,7 +96,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = + test_thread = JDIThreadFactory.newThread(new Threadisatbreakpoint001a("testedThread")); log1(" thread2 is created"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001.java index 99b1ddd1f5a..e7fa75c042f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -129,7 +129,6 @@ private static void log3(String message) { ReferenceType testedclass = null; ThreadReference thread2 = null; - ThreadReference mainThread = null; static int testExitCode = PASSED; @@ -173,6 +172,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -212,9 +212,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -229,7 +226,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -238,34 +234,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } - - log2("getting ThreadReference objects for main thread"); - listIterator = allThreads.listIterator(); - for (;;) { - try { - mainThread = (ThreadReference) listIterator.next(); - if (mainThread.name().equals("main")) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next() for 'mainThread'"); - log3("ERROR: NO MAIN THREAD ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001a.java index 50046edf7e1..c3c34d385ef 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadissuspended001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadissuspended001a("testedThread")); log1("thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002.java index 3fb49c0c262..92d23c4f954 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -173,6 +173,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -210,9 +211,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -227,7 +225,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -236,34 +233,10 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("getting ThreadReference objects for main thread"); - listIterator = allThreads.listIterator(); - for (;;) { - try { - mainThread = (ThreadReference) listIterator.next(); - if (mainThread.name().equals("main")) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next() for 'mainThread'"); - log3("ERROR: NO MAIN THREAD ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + mainThread = debuggee.threadByFieldNameOrThrow(debuggeeClass, "mainThread", "main"); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002a.java index 483be91f3b9..7b55698c16c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,10 +58,16 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + static Thread mainThread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { + mainThread = Thread.currentThread(); + for (int i = 0; i < argv.length; i++) { if (argv[i].equals("-vbs") || argv[i].equals("-verbose")) { verbMode = true; @@ -91,8 +97,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadissuspended002a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadissuspended002a("testedThread")); log1(" thread2 is created"); label: synchronized (Threadissuspended002a.lockingObject) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003.java index 81549caccb4..365cc94d184 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -127,7 +127,6 @@ private static void log3(String message) { ReferenceType testedclass = null; ThreadReference thread2 = null; - ThreadReference mainThread = null; static int testExitCode = PASSED; @@ -171,6 +170,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -207,9 +207,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -223,7 +220,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -232,34 +228,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } - - log2("getting ThreadReference objects for main thread"); - listIterator = allThreads.listIterator(); - for (;;) { - try { - mainThread = (ThreadReference) listIterator.next(); - if (mainThread.name().equals("main")) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next() for 'mainThread'"); - log3("ERROR: NO MAIN THREAD ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003a.java index 8fe2442b376..e478979bfb9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended003a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadissuspended003a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadissuspended003a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004.java index 799ca455f47..05d46b3b066 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -125,7 +125,6 @@ private static void log3(String message) { ReferenceType testedclass = null; ThreadReference thread2 = null; - ThreadReference mainThread = null; static int testExitCode = PASSED; @@ -169,6 +168,7 @@ private int runThis (String argv[], PrintStream out) { } VirtualMachine vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -205,9 +205,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -222,7 +219,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -231,34 +227,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } - - log2("getting ThreadReference objects for main thread"); - listIterator = allThreads.listIterator(); - for (;;) { - try { - mainThread = (ThreadReference) listIterator.next(); - if (mainThread.name().equals("main")) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next() for 'mainThread'"); - log3("ERROR: NO MAIN THREAD ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004a.java index a6ae6ba4c7f..026cde9e777 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/isSuspended/issuspended004a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadissuspended004a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadissuspended004a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001.java index 219930df6b9..b4c840c9b13 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -162,6 +162,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -199,9 +200,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; //BreakpointRequest breakpRequest1 = null; @@ -213,7 +211,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -222,19 +219,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); } label1: { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001a.java index ebf93f55ee6..49b16f33cb1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/name/name001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,8 +96,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadname001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadname001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java index c7dd827a569..3bbd213c048 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -166,6 +166,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -203,9 +204,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -219,7 +217,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -228,19 +225,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001a.java index 7efc2dd7c01..0a4c2a88e35 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/resume/resume001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -99,8 +102,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadresume001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadresume001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java index c1baa909eec..cbefebb984f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -169,6 +169,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section @@ -196,8 +197,6 @@ private int runThis (String argv[], PrintStream out) { String threadName = "Thread2"; - List allThreads = null; - ListIterator listIterator = null; List classes = null; ReferenceType mainthreadClass = null; ObjectReference throwableObj = null; @@ -207,7 +206,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(debuggeeName); mainthreadClass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -216,19 +214,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "thread2", threadName); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java index 92ba863bbf2..60426af806f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -167,6 +167,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section @@ -205,9 +206,6 @@ private int runThis (String argv[], PrintStream out) { String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; BreakpointRequest breakpRequest1 = null; @@ -219,7 +217,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -228,19 +225,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); log2("setting up breakpoints"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001a.java index 0474ff84ed9..424ea3294bb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspend/suspend001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -57,6 +57,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -92,8 +95,8 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = - JDIThreadFactory.newThread(new Threadsuspend001a("testedThread")); + test_thread = + JDIThreadFactory.newThread(new Threadsuspend001a("testedThread")); log1(" thread2 is created"); label: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001.java index e6608f96646..a4febfdc641 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -166,6 +166,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -203,9 +204,6 @@ private int runThis (String argv[], PrintStream out) { //String bpLine2 = "breakpointLineNumber2"; //String bpLine3 = "breakpointLineNumber3"; - - List allThreads = null; - ListIterator listIterator = null; List classes = null; //BreakpointRequest breakpRequest1 = null; @@ -217,7 +215,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects and setting up breakponts"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -226,19 +223,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - thread2 = (ThreadReference) listIterator.next(); - if (thread2.name().equals(threadName)) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO THREAD2 ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + thread2 = debuggee.threadByFieldNameOrThrow(debuggeeClass, "test_thread", threadName); } label1: { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001a.java index 5ce0343b045..e7b676d3825 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/suspendCount/suspendcount001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -58,6 +58,9 @@ private static void logErr(String message) { } //====================================================== test program + + static Thread test_thread = null; + //---------------------------------------------------- main method public static void main (String argv[]) { @@ -93,7 +96,7 @@ public static void main (String argv[]) { //------------------------------------------------------ section tested case 0: - Thread test_thread = + test_thread = JDIThreadFactory.newThread(new Threadsuspendcount001a("testedThread")); log1(" thread2 is created"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001.java index a9e56f30b3a..ce889296bd7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -165,6 +165,7 @@ private int runThis (String argv[], PrintStream out) { } vm = debuggee.VM(); + ReferenceType debuggeeClass = debuggee.classByName(debuggeeName); //------------------------------------------------------ testing section log1(" TESTING BEGINS"); @@ -189,11 +190,7 @@ private int runThis (String argv[], PrintStream out) { int expresult = returnCode0; - String threadName = "testedThread"; - - List allThreads = null; ObjectReference monitor = null; - ListIterator listIterator = null; List classes = null; @@ -201,7 +198,6 @@ private int runThis (String argv[], PrintStream out) { log2("getting ThreadReference objects"); try { - allThreads = vm.allThreads(); classes = vm.classesByName(testedClassName); testedclass = (ReferenceType) classes.get(0); } catch ( Exception e) { @@ -210,19 +206,7 @@ private int runThis (String argv[], PrintStream out) { break label0; } - listIterator = allThreads.listIterator(); - for (;;) { - try { - mainThread = (ThreadReference) listIterator.next(); - if (mainThread.name().equals("main")) - break ; - } catch ( NoSuchElementException e ) { - log3("ERROR: NoSuchElementException for listIterator.next()"); - log3("ERROR: NO 'main' thread ?????????!!!!!!!"); - expresult = returnCode1; - break label0; - } - } + mainThread = debuggee.threadByFieldNameOrThrow(debuggeeClass, "mainThread", "main"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001a.java index 9275e236272..35b4b2bf788 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VirtualMachine/canGetCurrentContendedMonitor/cangccm001a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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,11 +60,14 @@ private static void logErr(String message) { //====================================================== test program private static Thread thread2 = null; + static Thread mainThread = null; //---------------------------------------------------- main method public static void main (String argv[]) { + mainThread = Thread.currentThread(); + for (int i=0; i