THREAD_NOT_ALIVE originates from JVMTI. However, the debug agent converts it to 
INVALID_THREAD before passing it on to the debug agent client (the debugger, 
usually JDI), so debug agent users (JDI) should never see it. Currently 
ThreadReference.forceEarlyReturn() is the only API that even bothers to check 
for it, and it throws com.sun.jdi.IllegalThreadStateException, which is the 
same thing it already does for INVALID_THREAD.

In the JDWP spec I change the description of THREAD_NOT_ALIVE  to "Not used". 
If you have a suggestion for better wording, please let me now. (I was thinking 
maybe "Unused" would be better.

In the JDI ThreadReference.forceEarlyReturn implementation, I removed the code 
that checks for THREAD_NOT_ALIVE since it should never occur. There is no 
behavior change associated with this change, and there is no JDI spec update 
necessary. The spec already says IllegalThreadStateException means "the thread 
is not suspended", and not being alive implies not suspended.

Note the JDWP spec for ThreadReference.ForceEarlyReturn used to mention 
THREAD_NOT_ALIVE as a possible error code, but it was removed as part of the 
loom work.

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

Commit messages:
 - Cleanup THREAD_NOT_ALIVE usage

Changes: https://git.openjdk.org/jdk/pull/10189/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=10189&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8283224
  Stats: 4 lines in 2 files changed: 0 ins; 3 del; 1 mod
  Patch: https://git.openjdk.org/jdk/pull/10189.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/10189/head:pull/10189

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

Reply via email to