Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.googlecode.junittoolbox.util;

This class provides the method sneakyThrow(java.lang.Throwable) which enables you to throw any checked java.lang.Exception from any method, even if its type is not listed in the method signature. Copied from Java Puzzlers.
 public class TigerThrower<T extends Throwable> {

Will throw the given java.lang.Throwable.
    public static void sneakyThrow(Throwable t) {
        new TigerThrower<Error>().sneakyThrow2(t);
    private void sneakyThrow2(Throwable tthrows T {
        throw (T) t;
New to GrepCode? Check out our FAQ X