- if (methods[j].getName().equals(k) && methods[j].getParameterTypes().length == nargs) {
- Object[] args = new Object[nargs];
- for(int i = 0; i<args.length; i++) {
- if (i==0) args[i] = a0;
- else if (i==1) args[i] = a1;
- else if (i==2) args[i] = a2;
- else args[i] = rest[i-3];
- }
- return wrap(methods[j].invoke(this, args));
+ if (methods[j].getName().equals(k) &&
+ methods[j].getParameterTypes().length == args.length) {
+ return wrap(methods[j].invoke(this, (Object[])args));