@ SuppressWarnings ( "unchecked" ) static < T extends Throwable > void uncheckedThrow ( Throwable t ) throws T { if ( t != null ) throw ( T ) t ; // rely on vacuous cast else throw new Error ( "Unknown Exception" ) ; }
The sneaky part of sneaky throw relying on generics limitations to evade compiler complaints about rethrowing unchecked exceptions .