JDK-8277987 : Terminally deprecate Thread.stop
  • Type: CSR
  • Component: core-libs
  • Sub-Component: java.lang
  • Priority: P4
  • Status: Closed
  • Resolution: Approved
  • Fix Versions: 18
  • Submitted: 2021-11-30
  • Updated: 2021-12-06
  • Resolved: 2021-11-30
Related Reports
CSR :  
Description
Summary
-------

Terminally deprecate `Thread.stop()`.

Problem
-------

`Thread.stop` is inherently unsafe. It 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 do not support `Thread.stop` and will re-specify this method to work in a degraded way.

Solution
--------

Terminally deprecate `Thread.stop()` so that it can be degraded and/or removed in the future.

No changes are proposed for the the JVM TI function `StopThread`, the JDWP `ThreadReference/Stop` command, or the JDI `ThreadReference.stop` methods.

Specification
-------------

Change:   @Deprecated(since="1.2")
          to:    @Deprecated(since="1.2", forRemoval=true)

No change is proposed for the deprecation message.



Comments
Moving to Approved.
30-11-2021