Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > thread safety - using deprecated stuff Bloches example.

Reply
Thread Tools

thread safety - using deprecated stuff Bloches example.

 
 
puzzlecracker
Guest
Posts: n/a
 
      01-30-2006
public static void sneakyThrow(Throwable t){
Thread.currentThread().stop(t);
}

----It appears that you can throw exception from any point in your
code.
what does it mean?

How and why it bypasses all the exceptions? bypassed where?

it is item 43 in Java Puzzlers.

I am not quite sure what it means.

Can someone elaborate....

 
Reply With Quote
 
 
 
 
Thomas Hawtin
Guest
Posts: n/a
 
      01-30-2006
puzzlecracker wrote:
> public static void sneakyThrow(Throwable t){
> Thread.currentThread().stop(t);
> }
>
> ----It appears that you can throw exception from any point in your
> code.
> what does it mean?
>
> How and why it bypasses all the exceptions? bypassed where?


Exceptions aren't bypassed, but exception checking is.

For a method (in source code) to be able to throw an exception that does
not extend Error or RuntimeException, a throws clause needs to be
present. The checking is done at compile-time, not at runtime. There are
a number of ways to throw a checked exception from methods that do not
declare that exception, as detailed in the book.

Tom Hawtin
--
Unemployed English Java programmer
http://jroller.com/page/tackline/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thread safety when subclassing the Page class thechaosengine ASP .Net 2 12-10-2004 02:48 PM
What is thread safety? Hans ASP .Net 1 10-12-2004 03:15 PM
A thread safety question Simon Harvey ASP .Net 3 08-06-2004 02:17 PM
LiteralControl thread safety. George Ter-Saakov ASP .Net 1 04-06-2004 10:06 AM
Deprecated warnings within deprecated code Barney Barumba Java 0 07-23-2003 12:46 AM



Advertisments