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

Remove Thread.stop

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Approved
    • Icon: P4 P4
    • 26
    • core-libs
    • None
    • source, binary
    • low
    • Thread.stop was deprecated in JDK 1.2 and its usage strongly discouraged for 25+ years. The method was "degraded" to throw UOE in JDK 20. Unlikely that any new code written in the last few years depends on this method.
    • Java API
    • SE

      Summary

      Remove java.lang.Thread.stop().

      Problem

      The no-arg Thread.stop method has been deprecated since JDK 1.2, deprecated for removal since JDK 18, and re-specified to throw UnsupportedOperationException unconditionally since JDK 20. It is time to finally remove the method.

      Solution

      Remove java.lang.Thread.stop().

      Remove the "Java Thread Primitive Deprecation" page.

      Update the specification of java.lang.ThreadDeath to not link to Thread.stop.

      A release note is planned.

      There is follow on docs work (guides, not specs) to ensure that all references to this method are removed.

      Specification

      Remove java.lang.Thread.stop().

      Change java.lang.ThreadDeath as follows:

        * An instance of {@code ThreadDeath} was originally specified to be thrown
      - * by a victim thread when "stopped" with {@link Thread#stop()}.
      + * by a victim thread when "stopped" with the {@link Thread} API.
        *
      - * @deprecated {@link Thread#stop()} was originally specified to "stop" a victim
      - *      thread by causing the victim thread to throw a {@code ThreadDeath}. It
      - *      was inherently unsafe and deprecated in an early JDK release. The ability
      - *      to "stop" a thread with {@code Thread.stop} has been removed and the
      - *      {@code Thread.stop} method changed to throw an exception. Consequently,
      - *      {@code ThreadDeath} is also deprecated, for removal.
      + * @deprecated {@code Thread} originally specified a "{@code stop}" method to stop a
      + *      victim thread by causing the victim thread to throw a {@code ThreadDeath}. It
      + *      was inherently unsafe and deprecated in an early JDK release. The stop method
      + *      has since been removed and {@code ThreadDeath} is deprecated, for removal.

            alanb Alan Bateman
            alanb Alan Bateman
            Daniel Fuchs, Jaikiran Pai, Roger Riggs
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: