Class Exceptions


  • public class Exceptions
    extends java.lang.Object
    Utility methods for exceptions
    Author:
    Tony Vaagenes
    • Constructor Summary

      Constructors 
      Constructor Description
      Exceptions()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.RuntimeException throwUnchecked​(java.lang.Throwable e)
      Allows treating checked exceptions as unchecked.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Exceptions

        public Exceptions()
    • Method Detail

      • throwUnchecked

        public static java.lang.RuntimeException throwUnchecked​(java.lang.Throwable e)
        Allows treating checked exceptions as unchecked. Usage: throw throwUnchecked(e); The reason for the return type is to allow writing throw at the call site instead of just calling throwUnchecked. Just calling throwUnchecked means that the java compiler won't know that the statement will throw an exception, and will therefore complain on things such e.g. missing return value.