question: @ SuppressWarnings ( "unchecked" ) public static < K extends Throwable > void rewrapAndThrowIfInstance ( String newMessage , Throwable t , Class < K > clazz ) throws K { if ( ( t != null ) && clazz . isAssignableFrom ( t . getClass ( ) ) ) { K kt = ( K ) t ; K wrapped = Throwables . rewrap ( newMessage , kt ) ; throw wrapped ; } }
target:  if (t instanceof K) throw Throwables.rewrap((K)t); <p> Note: The runtime type of the thrown exception will be the same as t even if clazz is a supertype of t.