Class SneakyThrow

java.lang.Object
com.arjuna.ats.jta.cdi.SneakyThrow

public class SneakyThrow extends Object
An utility class which makes possible to throw any exception as a RuntimeException. It means to throw checked exception (subtype of Throwable or Exception) as un-checked exception. This considers the Java 8 inference rule that states that a throws E is inferred as RuntimeException.
  • Method Details

    • sneakyThrow

      public static <E extends Throwable> void sneakyThrow(Throwable e) throws E
      This method can be used in throw statement such as: throw sneakyThrow(exception);.
      Throws:
      E