code: public static void asUnchecked(Throwable t, Class<? extends RuntimeException> checkedExceptionWrapper) {
          if (t instanceof AssertionError) {
              throw (AssertionError) t;
          } else if (t instanceof RuntimeException) {
              throw (RuntimeException) t;
          } else {
              RuntimeException exception;
              try {
                  exception = checkedExceptionWrapper.getConstructor(Throwable.class).newInstance(t);
              } catch (Exception e) {
                  throw new RuntimeException(t);
              }
              throw exception;
          }
      }
docs: Checks whether given throwable is unchecked and if not, it will be wrapped as unchecked exception of given type