RFR: 8301622: ProcessTools.java compilation gets ThreadDeath deprecation warning
Afshin Zafari
duke at openjdk.org
Thu Mar 2 17:31:18 UTC 2023
On Thu, 2 Mar 2023 14:13:10 GMT, Alan Bateman <alanb 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?
I assumed the `ThreadDeath` was there to catch `Thread.stop()` calls and just ignore them. So, I wanted to keep this functionality.
Can we remove using `ThreadDeath` relying on that `Thread.stop()` is also deprecated?
-------------
PR: https://git.openjdk.org/jdk/pull/12827
More information about the core-libs-dev
mailing list