public class SneakyThrow {

    void javac8_error() {
        sneakyThrow_error_with_javac_8(new Exception());
    }

    void javac8_error_with_throws() {
        throw sneakyThrow_error_with_javac_8(new Exception());
    }

    void works() {
        sneakyThrow_works_with_javac_8(new Exception());
    }

    @SuppressWarnings("unchecked")
    <T extends Throwable> T sneakyThrow_error_with_javac_8(Throwable t) throws T {
        throw (T) t;
    }

    @SuppressWarnings("unchecked")
    <T extends Throwable> void sneakyThrow_works_with_javac_8(Throwable t) throws T {
        throw (T) t;
    }
} 