Archie Cobbs wrote:
Stuart Ballard wrote:

Jeroen pointed out to me a while back that you can use generics to throw an
unchecked exception:


There's also a way to do this without using JDK 1.5 stuff, but it's
even uglier :-)

Construct a class (dynamically) that has a default constructor
that simply throws whatever exception you want. Then invoke
Class.newInstance() on the class.


Bah ! I would rather use a native function that will throw directly InvalidClassException. The problem is that's will be anyway hidden to the general user and that he/she may be surprised getting that sort of exception.

Guilhem.


_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to