|
From: Eric E. A. <ea...@cs...> - 2002-04-12 23:58:51
|
Oops; here's another thing we never told you about: Sometimes, the Java static type system will force you to deal with "ghost exceptions", i.e., checked exceptions that you _know_ will never happen. And I mean that they will never occur unless there is a bug in your program. It's wordy and tedious to add these these exceptions to the throws clauses of the transitive closure of all callers. Originally we handled such cases by simply catching them and doing nothing in the catch clause. But we stopped that after the first time we had to debug a case where such an exception was actually thrown. So now, we catch such exceptions and throw an instance of a special class, called UnexpectedException. Whenever we see an UnexpectedException thrown, we know there's a bug in the program. So please don't use this UnexceptedException class for any purpose other than to deal with these ghost exceptions. On the other hand, if you really do have a ghost exception to deal with, please _do_ throw an UnexpectedException in the corresponding catch clause. Thanks, -- Eric |