RFR: 8301622: ProcessTools.java compilation gets ThreadDeath deprecation warning

Alan Bateman alanb at openjdk.org
Thu Mar 2 14:16:06 UTC 2023


On Thu, 2 Mar 2023 12:15:21 GMT, Afshin Zafari <duke at openjdk.org> wrote:

> ### Description
> The use of `ThreadDeath` is replaced with checking the exception be of type `Error` and the thread is `TERMINATED`.
> 
> 
> ### Test
> local and mach5 tier1

test/lib/jdk/test/lib/process/ProcessTools.java line 827:

> 825: 
> 826:         public void uncaughtException(Thread t, Throwable e) {
> 827:             if (e instanceof Error && t.getState() == State.TERMINATED) {

Dropping the check for ThreadDeath is fine but checking the thread state is puzzling. When a Thread completes with an uncaught exception/error then the UHE is called from the thread before it terminates so it's state won't be TERMINATED. Is there more going on here that the UHE is called with an already terminated Thread?

-------------

PR: https://git.openjdk.org/jdk/pull/12827


More information about the core-libs-dev mailing list