Class Unchecked
java.lang.Object
net.emustudio.emulib.Unchecked
Runs actions which can throw checked exceptions, rethrowing them unchanged without declaring them ("sneaky throw").
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn action with a result which can throw checked exceptions.static interfaceAn action which can throw checked exceptions. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TCalls the action; checked exceptions are rethrown unchanged.static voidRuns the action; checked exceptions are rethrown unchanged.static <T> TThrows any exception without declaring it.
-
Method Details
-
run
Runs the action; checked exceptions are rethrown unchanged.- Parameters:
r- the action
-
call
Calls the action; checked exceptions are rethrown unchanged.- Type Parameters:
T- the result type- Parameters:
c- the action- Returns:
- the action result
-
sneakyThrow
Throws any exception without declaring it.- Type Parameters:
T- the "return" type, allowingreturn sneakyThrow(e);- Parameters:
e- the exception- Returns:
- never returns
-