On Thu, 30 Jul 2026 10:11:10 GMT, Shiv Shah <[email protected]> wrote:

> 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).

This all looks fine to me. Best to get a second set of eyes on it though.

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

Marked as reviewed by dholmes (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/32100#pullrequestreview-4840636687

Reply via email to