RFR: 8368226: Remove Thread.stop
Roger Riggs
rriggs at openjdk.org
Mon Sep 22 14:39:02 UTC 2025
On Mon, 22 Sep 2025 08:13:55 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> The no-arg Thread.stop has been deprecated since JDK 1.2, deprecated for removal since JDK 18, and re-specified to throw UOE unconditionally since JDK 20. It is time to finally remove the method. Its more evil sibling Thread.stop(Throwable) was removed in JDK 11.
>
> Code that uses Thread.stop will no longer compile. Code using this method that was compiled to older releases will throw NoSuchMethodError instead of UnsupportedOperationException.
>
> Most of the tests using Thread.stop have already been fixed in advance of this PR. However, the tests for Kerberos and DTLS use the KDC server as infrastructure and don't compile because it uses Thread.stop and swallows the UOE. This is tracked by JDK-8360979. It is temporarily changed to use Thread.interrupt to avoid excluding many of tests in these areas. If JDK-8360979 is fixed then no change to KDC is needed.
Changes requested by rriggs (Reviewer).
src/java.base/share/classes/java/lang/doc-files/threadPrimitiveDeprecation.html line 1:
> 1: <!doctype html>
This seems like it should have been a file delete, but there is 1 line left.
test/jdk/java/lang/Thread/ThreadStopTest.java line 1:
> 1: /*
This seems like it should have been a file delete, but there is 1 line left.
-------------
PR Review: https://git.openjdk.org/jdk/pull/27419#pullrequestreview-3253212818
PR Review Comment: https://git.openjdk.org/jdk/pull/27419#discussion_r2368742789
PR Review Comment: https://git.openjdk.org/jdk/pull/27419#discussion_r2368744219
More information about the security-dev
mailing list