Last active
May 21, 2018 09:03
-
-
Save ryenus/779e52768fcaddf6daae73f7a8f3f3bf to your computer and use it in GitHub Desktop.
java exception checkness remover
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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