Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8277987

Terminally deprecate Thread.stop

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 18
    • core-libs
    • None
    • behavioral
    • minimal
    • Java API
    • SE

      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.

            alanb Alan Bateman
            alanb Alan Bateman
            Mandy Chung, Roger Riggs
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: