Package de.bmiag.tapir.util.exception
Class SneakyThrow
- java.lang.Object
-
- de.bmiag.tapir.util.exception.SneakyThrow
-
public class SneakyThrow extends java.lang.Object
Utility class for providing Sneaky Throw functionalities.- Since:
- 2.0.0
- Author:
- Oliver Libutzki <[email protected]>
-
-
Constructor Summary
Constructors Constructor Description SneakyThrow()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
sneakyRethrow(java.lang.Throwable throwable)
Throws any throwable 'sneakily' - you don't need to catch it, nor declare that you throw it onwards.
-
-
-
Method Detail
-
sneakyRethrow
public static void sneakyRethrow(java.lang.Throwable throwable)
Throws any throwable 'sneakily' - you don't need to catch it, nor declare that you throw it onwards. The exception is still thrown - javac will just stop whining about it.
Example usage:public void run() { throw sneakyThrow(new IOException("You don't need to catch me!")); }
This method is heavily inspired by project Lombok.- Parameters:
throwable
- The throwable to throw without requiring you to catch its type.- Since:
- 2.0.0
-
-