Interface ExceptionSuppressor


  • public interface ExceptionSuppressor
    Small utility taken from Apache commons-lang ExceptionUtils class
    • Method Summary

      Static Methods 
      Modifier and Type Method Description
      static <R,​T extends java.lang.Throwable>
      R
      asUnchecked​(java.lang.Throwable throwable)
      Claim a Throwable is another Exception type using type erasure.
    • Method Detail

      • asUnchecked

        static <R,​T extends java.lang.Throwable> R asUnchecked​(java.lang.Throwable throwable)
                                                              throws T extends java.lang.Throwable
        Claim a Throwable is another Exception type using type erasure. This hides a checked exception from the java compiler, allowing a checked exception to be thrown without having the exception in the method's throw clause.
        Type Parameters:
        R - is return type of method caller if needed
        T - is exception type to erase
        Parameters:
        throwable - is exception to rethrow
        Returns:
        nothing
        Throws:
        T - is artificial construct to trick Java compiler
        T extends java.lang.Throwable