Throw even checked exceptions without being required to declare them or catch them. Suggested idiom: throw sneakyThrow( some exception );
(Throwable t)
| 232 | * <code>throw sneakyThrow( some exception );</code> |
| 233 | */ |
| 234 | static public RuntimeException sneakyThrow(Throwable t) { |
| 235 | // http://www.mail-archive.com/javaposse@googlegroups.com/msg05984.html |
| 236 | if (t == null) |
| 237 | throw new NullPointerException(); |
| 238 | Util.<RuntimeException>sneakyThrow0(t); |
| 239 | return null; |
| 240 | } |
| 241 | |
| 242 | @SuppressWarnings("unchecked") |
| 243 | static private <T extends Throwable> void sneakyThrow0(Throwable t) throws T { |
no test coverage detected