JDK-8277861 : Terminally deprecate Thread.stop
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-11-26
  • Updated: 2022-07-02
  • Resolved: 2021-12-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 18
18 b26Fixed
Related Reports
CSR :  
Relates :  
Relates :  
Sub Tasks
JDK-8278051 :  
Description
Thread.stop is inherently unsafe and has been deprecated since Java 1.2. In addition to being unsafe for applications and libraries to use, it works inconsistently and creates a burden on the runtime to have to deal with "async" exceptions at sensitive times.  Project Loom is planning virtual threads that will not support Thread.stop. All told, it's time to terminally deprecate this method so it can be degraded and removed in the future.

Terminally deprecating Thread.stop has no impact on JVM TI StopThread. This is used by debugger to have threads throw an exception when resumed at a breakpoint. Further work is required to find an alternative before deprecating the JVM TI function (and corresponding method in JDI and command in JDWP).
Comments
Changeset: fde0b95e Author: Alan Bateman <alanb@openjdk.org> Date: 2021-12-01 08:44:51 +0000 URL: https://git.openjdk.java.net/jdk/commit/fde0b95ede68c188479852c46df7e28dc4b79594
01-12-2021