I knew david is editing his class files manually! nerd! :D
On Thu, Mar 29, 2012 at 11:03 PM, Dawid Weiss <[email protected]> wrote: >> I know. The VM specification does not even need to know the Exception type. >> If you trick the > > Exactly. Students also always found it surprising that a try {} catch > block doesn't actually add any overhead (or generate any code). A > ghost instruction, truly. ;) > >> static void sneakyThrow(Throwable t) { >> Thread.currentThread().stop(t); >> } > > Yep, this one is one classic method, isn't it ;) > > There is yet another method that... It requires a hex editor though :) > Declare a method that throws: > > public static void rethrow(buzz.lang.Throwable e) { > throw e; > } > > and define buzz.lang.Throwable as extending RuntimeException (or > anything unchecked). Then open your hex editor and s/buzz/java/g. > Because Java classes have no integrity checking whatsoever -- voila, > you have your rethrow class/method now. A real keeper ;) > > I attach it for those unfaithful... > > Dawid > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
