Summary
-------
Degrade `Thread.suspend()` and `Thread.resume()` to throw `UnsupportedOperationException` (UOE) unconditionally.
Problem
-------
Thread.suspend dates from JDK 1.0 as a user facing API to suspend a victim thread from execution. It is inherently deadlock prone. Thread.suspend and Thread.resume have been deprecated since JDK 1.2 with a link to the "Java Thread Primitive Deprecation" page that explains the reasoning for the deprecation.
The recent steps on degrading and removing the feature are:
- Thread.suspend and Thread.resume were terminally deprecated in Java 14
- ThreadGroup.suspend and ThreadGroup.resume were degraded to throw UOE in Java 19
At this time, Thread.suspend will suspend a platform thread as it always done. Both Thread.suspend and Thread.resume throw UOE if invoked on a virtual Thread.
Solution
--------
- Re-specify Thread.suspend and Thread.resume to throw UOE.
- Update the JVM TI, JDWP and JDI specifications to drop Thread.suspend/resume as possible suspend/resume functions. This change has otherwise no impact on the suspend/resume APIs defined for debuggers.
- Minor adjustments to java.lang.IllegalThreadStateException.
- Minor updates to java.lang.SecurityManager to drop references to Thread.suspend/resume and other degraded methods that no longer call into the security manager.
Specification
-------------
A zip file with the specdiffs is attached to this CSR with changes to the docs of the following API elements:
```
java.lang.Thread.suspend
java.lang.Thread.resume
java.lang.IllegalThreadStateException
java.lang.SecurityManager.checkAccess(Thread)
java.lang.SecurityManager.checkAccess(ThreadGroup)
java.lang.RuntimePermission modifyThread and modifyThreadGroup targets
com.sun.jdi.ThreadReference.suspend()
com.sun.jdi.ThreadReference.resume()
com.sun.jdi.VirtualMachine.suspend()
com.sun.jdi.VirtualMachine.resume()
JDWP ThreadReference/Suspend and ThreadReference/Resume commands
JVMTI ResumeThread / ResumeThreadList functions
JVMTI GetThreadState description of JVMTI_THREAD_STATE_SUSPENDED
```