Converts the tested threads in nsk/jdwp to jdk.test.lib.thread.ThreadWrapper so 
they can run under JTREG_TEST_THREAD_FACTORY=Virtual. Per JDK-8381657, the 
conversion targets spawned threads that make actual work in the tests.

23 tests converted. These debuggers obtain the tested thread by reading a 
debuggee static field over JDWP (Debugee.queryThreadID, or queryObjectID with 
JDWP.Tag.THREAD), so the field itself must remain a Thread - where a field is 
exposed that way it is retyped to Thread and assigned from getThread().

Four tests are left on platform threads, each with a comment giving the reason: 
ThreadReference/Stop - Stop returns THREAD_NOT_SUSPENDED for a virtual thread 
that is not suspended at an event
StackFrame/SetValues - returns OPAQUE_FRAME for a virtual thread suspended via 
ThreadReference.Suspend rather than at an event
ObjectReference/MonitorInfo - reports no owner and no waiters for virtual 
threads
ThreadReference/FrameCount  - asserts an exact frame count, which the wrapper's 
extra frames change

Reverting these rather than problem listing them keeps the tests running as 
platform threads in both configurations.

The ThreadWrapper import adds a line to each debuggee, so the hard-coded 
BREAKPOINT_LINE / *_LINE constants in those files are bumped by one (21 
constants across 12 files).

VirtualMachine/Resume/resume001.java is unchanged - its extends Thread is a 
debugger-side timeout watchdog, not a thread doing test work.

Testing: nsk/jdwp on linux-x64-OL-9, with the default factory and with 
JTREG_TEST_THREAD_FACTORY=Virtual - all pass in both


---------
- [x] I confirm that I make this contribution in accordance with the [OpenJDK 
Interim AI Policy](https://openjdk.org/legal/ai).

-------------

Commit messages:
 - 8382276: Update nsk/jdwp to use ThreadWrapper

Changes: https://git.openjdk.org/jdk/pull/32100/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=32100&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8382276
  Stats: 136 lines in 27 files changed: 35 ins; 0 del; 101 mod
  Patch: https://git.openjdk.org/jdk/pull/32100.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/32100/head:pull/32100

PR: https://git.openjdk.org/jdk/pull/32100

Reply via email to