Time to put a stop to Thread.stop?

Jeroen Frijters jeroen at sumatra.nl
Tue May 14 14:45:43 UTC 2013

IMO Thread.currentThread().stop(new Throwable()) should continue to work. It is not unsafe and it is probably used in a lot of code to workaround the madness that is checked exceptions.

> -----Original Message-----
> From: core-libs-dev-bounces at openjdk.java.net [mailto:core-libs-dev-
> bounces at openjdk.java.net] On Behalf Of Alan Bateman
> Sent: Tuesday, May 14, 2013 16:25
> To: core-libs-dev
> Subject: Time to put a stop to Thread.stop?
> I would like to broach the subject of pulling out the implementation of
> Thread.stop(Throwable), maybe suspend/resume later. By "pulling out" I
> mean changing it to unconditionally throw UnsupportedOperationException.
> As we all know, these methods have been deprecated since 1998 so that's
> 15 years to design out any need for these methods. That said, I
> periodically come across code that uses no-arg Thread.stop(). David
> Holmes mentioned to me recently that he came across a usage in the
> recent past too. I don't think I've ever come across code using
> Thread.stop(Throwable) and this one is arguably the most dangerous of
> the group.
> So I'm curious if anyone has come across a Thread.stop(Throwable) usage
> in recent times. Clearly changing this would be a significant change but
> the real impact might be close to zero. If we decide this is the right
> thing to do then there is a bit of detail to work out, that's for later.
> -Alan.

More information about the core-libs-dev mailing list