Skip to content

Commit

Permalink
Merge pull request #58 from awturner/patch-1
Browse files Browse the repository at this point in the history
Remove Thrower class and return Throwable. Looks good, going to merge into trunk!
  • Loading branch information
johnmcclean committed Sep 21, 2015
2 parents 5e9f102 + b3af506 commit 541bfbd
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ public class ExceptionSoftener {



public static void throwSoftenedException(final Throwable e) {
new Thrower<RuntimeException>().uncheck(e);
public static RuntimeException throwSoftenedException(final Throwable e) {
throw ExceptionSoftener.<RuntimeException>uncheck(e);
}
static class Thrower<T extends Throwable> {
@SuppressWarnings("unchecked")
private void uncheck(Throwable throwable) throws T {
throw (T) throwable;
}

@SuppressWarnings("unchecked")
private static <T extends Throwable> T uncheck(Throwable throwable) throws T {
throw (T) throwable;
}


Expand Down

0 comments on commit 541bfbd

Please sign in to comment.