Image

Imagedplass wrote in Imagejava_dev

Static exceptions

What do y'all think of this code:

public class Foo
{
 private static final Exception bad;

 static 
 {
   bad = new Exception();
 }

 public void amethod() throws Exception
 {
    throw bad;
 }
}


I though this was REALLY weird. Would'n't it screw up the call stack to throw an exception that is statically allocated?