posted 19 years ago
Hi,
It seems that you are trying to play with java language feature. When catch statement is used compiler should be informed about the type of the exception so that it can check whetehr the order of catch are correct and whether it is inherited form the proper class(e.g Excpetion,RuntimeException, Throwable) by allowing class literal it will have no clue of the class type an its heirachy.
I don'tnow any elegant soln to the problem. but you can catch throwable then use reflection to check whether the exception is of expected type.
...
cath(Throwable th)
{
if (th.isAssingable(use))
{
......................
}
}