Time to put a stop to Thread.stop?

Mike Duigou mike.duigou at oracle.com
Fri May 24 17:46:32 UTC 2013

I wonder if perhaps the the NPE check on the passed exception and the security permission check should be retained.

I am otherwise fine with Thread.stop(Throwable) unconditionally throwing UOE.


On May 24 2013, at 06:18 , Alan Bateman wrote:

> Thanks to everyone for the discussions and suggestions on this topic. I would like to proceed with the original proposal to change stop(Throwable) to throw UOE unconditionally. This means so special casing for ThreadDeath or the current thread. The no-arg Thread.stop() is not impacted.
> I think it's reasonable to say that this method is not widely used. Mandy did a static analysis of thousands of unique artifacts in maven and we found only a tiny number of usages. Other corpora were searched too. A number of people mailed me privately to report sightings, in almost all cases the usages were completely broken and never worked (incorrect assumption that Thread.stop would wake-up threads blocked in I/O in at least two cases).
> Clearly this change is significant and will need to documented in compatibility notes and migration documentation.
> The webrev with the proposed changes is here. As I mentioned in one of the replies, there are 4 j.u.c tests that need to be updated so I've changed these tests to use Unsafe.throwException.
> http://cr.openjdk.java.net/~alanb/7059085/webrev/
> -Alan.

More information about the core-libs-dev mailing list