package com.wizzardo.tools.misc;

/**
 * @author: wizzardo
 * Date: 08.12.14
 */
public class UncheckedThrow {

    @SuppressWarnings("unchecked")
    private static <T extends Exception> void throwsUnchecked(Exception toThrow) throws T {
        throw (T) toThrow;
    }

    public static RuntimeException rethrow(final Exception ex) {
        UncheckedThrow.<RuntimeException>throwsUnchecked(ex);

        return new IllegalStateException("unreachable statement");
    }
}

@@ -27,16 +27,55 @@
 .misc;%0A%0A
+import java.util.concurrent.Callable;%0A%0A
 /**%0A * @
@@ -352,14 +352,8 @@
 row(
-final 
 Exce
@@ -499,11 +499,456 @@
 );%0A    %7D
+%0A%0A    public static void run(UncheckedRunnable runnable) %7B%0A        try %7B%0A            runnable.run();%0A        %7D catch (Exception e) %7B%0A            throw rethrow(e);%0A        %7D%0A    %7D%0A%0A    public static %3CT%3E T call(Callable%3CT%3E callable) %7B%0A        try %7B%0A            return callable.call();%0A        %7D catch (Exception e) %7B%0A            throw rethrow(e);%0A        %7D%0A    %7D%0A%0A    public interface UncheckedRunnable %7B%0A        void run() throws Exception;%0A    %7D
 %0A%7D%0A

add run and call methods