public class SneakyException
extends java.lang.Object
| Constructor and Description |
|---|
SneakyException() |
| Modifier and Type | Method and Description |
|---|---|
static java.lang.RuntimeException |
sneakyThrow(java.lang.Throwable t)
Throws
t, even if the declared throws clause doesn't permit it. |
public static java.lang.RuntimeException sneakyThrow(java.lang.Throwable t)
t, even if the declared throws clause doesn't permit it.
This is a terrible – but terribly convenient – hack that makes it easy to
catch and rethrow exceptions after cleanup. See Java Puzzlers #43.t - Throwable to sneakily-throw.throw SneakException.sneakyThrow(e)