On 12/11/05, Guilhem Lavaux <[EMAIL PROTECTED]> wrote: > 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.
I dunno, this seems pretty clean if it works: public class Throw { private static Throwable t; public Throw() throws Throwable {throw t;} public static synchronized void uncheckedThrow(Throwable t) { Throw.t = t; try { Throw.class.newInstance(); } catch (InstantiationException e) { } catch (IllegalAccessException e) { } } } Throw.uncheckedThrow(new InvalidClassException("...")); A perfectly portable illegal-exception-thrower :) -- http://sab39.dev.netreach.com/ _______________________________________________ Classpath-patches mailing list Classpath-patches@gnu.org http://lists.gnu.org/mailman/listinfo/classpath-patches