static O[] massageArgsForVarArgsCall(Executable m, O[] args) { Class[] types = m.getParameterTypes(); int n = types.length-1, nArgs = args.length; if (nArgs < n) null; for i to n: if (!argumentCompatibleWithType(args[i], types[i])) null; Class varArgType = types[n].getComponentType(); for (int i = n; i < nArgs; i++) if (!argumentCompatibleWithType(args[i], varArgType)) null; O[] newArgs = new O[n+1]; arraycopy(args, 0, newArgs, 0, n); O[] varArgs = arrayOfType(varArgType, nArgs-n); arraycopy(args, n, varArgs, 0, nArgs-n); newArgs[n] = varArgs; ret newArgs; }