docs: private static Object[] fitToVargs(Object[] argumentArrayOrig, CachedClass[] paramTypes) {
          Class vargsClassOrig = paramTypes[paramTypes.length - 1].getTheClass().getComponentType();
          Class vargsClass = ReflectionCache.autoboxType(vargsClassOrig);
          Object[] argumentArray = argumentArrayOrig.clone();
          MetaClassHelper.unwrap(argumentArray);
  
          if (argumentArray.length == paramTypes.length - 1) {
              // the vargs argument is missing, so fill it with an empty array
              Object[] newArgs = new Object[paramTypes.length];
              System.arraycopy(argumentArray, 0, newArgs, 0, argumentArray.length);
              Object vargs = Array.newInstance(vargsClass, 0);
              newArgs[newArgs.length - 1] = vargs;
              return newArgs;
          } else if (argumentArray.length == paramTypes.length) {
              // the number of arguments is correct, but if the last argument
              // is no array we have to wrap it in a array. If the last argument
              // is null, then we don't have to do anything
              Object lastArgument = argumentArray[argumentArray.length - 1];
              if (lastArgument != null && !lastArgument.getClass().isArray()) {
                  // no array so wrap it
                  Object wrapped = makeCommonArray(argumentArray, paramTypes.length - 1, vargsClass);
                  Object[] newArgs = new Object[paramTypes.length];
                  System.arraycopy(argumentArray, 0, newArgs, 0, paramTypes.length - 1);
                  newArgs[newArgs.length - 1] = wrapped;
                  return newArgs;
              } else {
                  // we may have to box the argument!
                  return argumentArray;
              }
          } else if (argumentArray.length > paramTypes.length) {
              // the number of arguments is too big, wrap all exceeding elements
              // in an array, but keep the old elements that are no vargs
              Object[] newArgs = new Object[paramTypes.length];
              // copy arguments that are not a varg
              System.arraycopy(argumentArray, 0, newArgs, 0, paramTypes.length - 1);
              // create a new array for the vargs and copy them
              Object vargs = makeCommonArray(argumentArray, paramTypes.length - 1, vargsClass);
              newArgs[newArgs.length - 1] = vargs;
              return newArgs;
          } else {
              throw new GroovyBugError("trying to call a vargs method without enough arguments");
          }
      }