Class SneakyThrow


  • public class SneakyThrow
    extends Object
    • Method Detail

      • sneakyThrow

        public static <E extends ThrowableRuntimeException sneakyThrow​(Throwable e)
                                                                  throws E extends Throwable
        This method can and should be used as part of a throw statement, such as: throw sneakyThrow(exception);. It is guaranteed to never return normally, and this style of usage makes sure that the Java compiler is aware of that.
        Throws:
        E extends Throwable