From b3af5061923fcfd1b8564ec0a5873a9be3e463ee Mon Sep 17 00:00:00 2001 From: awturner Date: Sun, 20 Sep 2015 23:25:46 +0100 Subject: [PATCH] Remove Thrower class and return Throwable Based on suggestions in http://stackoverflow.com/a/32683393/3788176 --- .../cyclops/invokedynamic/ExceptionSoftener.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/cyclops-invokedynamic/src/main/java/com/aol/cyclops/invokedynamic/ExceptionSoftener.java b/cyclops-invokedynamic/src/main/java/com/aol/cyclops/invokedynamic/ExceptionSoftener.java index 5c8715c7..ce7babba 100644 --- a/cyclops-invokedynamic/src/main/java/com/aol/cyclops/invokedynamic/ExceptionSoftener.java +++ b/cyclops-invokedynamic/src/main/java/com/aol/cyclops/invokedynamic/ExceptionSoftener.java @@ -9,14 +9,13 @@ public class ExceptionSoftener { - public static void throwSoftenedException(final Throwable e) { - new Thrower().uncheck(e); + public static RuntimeException throwSoftenedException(final Throwable e) { + throw ExceptionSoftener.uncheck(e); } - static class Thrower { - @SuppressWarnings("unchecked") - private void uncheck(Throwable throwable) throws T { - throw (T) throwable; - } + + @SuppressWarnings("unchecked") + private static T uncheck(Throwable throwable) throws T { + throw (T) throwable; }