code: public static Class<?>[] resolveArguments(Type genericType, Class<?> targetType) {
          Class<?>[] result = null;
  
          if (genericType instanceof ParameterizedType) {
              ParameterizedType paramType = (ParameterizedType) genericType;
              Type[] arguments = paramType.getActualTypeArguments();
              result = new Class[arguments.length];
              for (int i = 0; i < arguments.length; i++)
                  result[i] = resolveClass(arguments[i], targetType);
          } else if (genericType instanceof TypeVariable) {
              result = new Class[1];
              result[0] = resolveClass(genericType, targetType);
          }
  
          return result;
      }
docs: Resolves the arguments for the {@code genericType} using the type variable information for the
  {@code targetType}. Returns {@code null} if {@code genericType} is not parameterized or if
  arguments cannot be resolved.