@SuppressWarnings("unchecked")
    public <R> R invokeChecked(Object target, Object... args) throws Exception {
      try {
        if (argLength < 0) {
          return (R) method.invoke(target, args);
        } else {
          return (R) method.invoke(target, Arrays.copyOfRange(args, 0, argLength));
        }

      } catch (InvocationTargetException e) {
        Throwables.throwIfInstanceOf(e.getCause(), Exception.class);
        Throwables.throwIfInstanceOf(e.getCause(), RuntimeException.class);
        Throwables.throwIfUnchecked(e.getCause());
        throw new RuntimeException(e.getCause());
      }
    }
Convenience wrapper class around {@link java.lang.reflect.Method}.

<p>Allows callers to invoke the wrapped method with all Exceptions wrapped by RuntimeException,
or with a single Exception catch block.
amoro-common/src/main/java/org/apache/amoro/utils/DynMethods.java