private <T> Supplier<T> abort(Class<T> exception) {
  return () -> {
    try {
      return exception.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
      throw new RuntimeException(e);
    }
  };
}

...

throw abort(MyException.class).get();
By Anonymous, 2017-12-14 11:27:50