Skip to content

Instantly share code, notes, and snippets.

@ryenus
Last active May 21, 2018 09:03
Show Gist options
  • Save ryenus/779e52768fcaddf6daae73f7a8f3f3bf to your computer and use it in GitHub Desktop.
Save ryenus/779e52768fcaddf6daae73f7a8f3f3bf to your computer and use it in GitHub Desktop.
java exception checkness remover
// http://johannesbrodwall.com/2018/05/15/a-wicked-java-trick-to-make-the-jvm-forget-to-check-exceptions/
// https://www.reddit.com/r/java/comments/8kz1tl/a_wicked_java_trick_to_make_the_jvm_forget_to/
// https://www.reddit.com/r/programming/comments/8kz1vf/a_wicked_java_trick_to_make_the_jvm_forget_to/
static RuntimeException softenException(Exception e) {
return checkednessRemover(e);
}
static <T extends Exception> T checkednessRemover(Exception e) throws T {
throw (T) e;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment