Class Exceptions

java.lang.Object
com.complexible.common.base.Exceptions

public final class Exceptions extends Object
  • Method Details

    • rethrowChecked

      public static <T extends Throwable> RuntimeException rethrowChecked(Exception e) throws T
      Rethrow a checked exception without wrapping into an unchecked exception, bypassing the Java compiler's checks. This method is particularly useful in lambdas, which are defined not throwing any checked exceptions, e. g. Map.compute(Object, BiFunction). This method will never return anything, it will just throw the exception that was passed to it as an argument. This method is defined to return RuntimeException to allow the following code: ... catch (IOException e) { throw Exceptions.rethrowChecked(e); }
      Throws:
      T