argtypes.size() != formals.size()) {
reportMC(env.tree, MethodCheckDiag.ARITY_MISMATCH, inferenceContext); // not enough args
}
while (argtypes.nonEmpty() && formals.head != varargsFormal) {
DiagnosticPosition pos = trees != null ? trees.head : null;
checkArg(pos, false, argtypes.head, formals.head, deferredAttrContext, warn);
argtypes = argtypes.tail;
formals = formals.tail;
trees = trees != null ? trees.tail : trees;
}
if (formals.head != varargsFormal) {
reportMC(env.tree, MethodCheckDiag.ARITY_MISMATCH, inferenceContext); // not enough args
}
if (useVarargs) {
//note: if applicability check is triggered by most specific test,
//the last argument of a varargs is _not_ an array type (see JLS 15.12.2.5)
final Type elt = types.elemtype(varargsFormal);
while (argtypes.nonEmpty()) {
DiagnosticPosition pos = trees != null ? trees.head : null;
checkArg(pos, true, argtypes.head, elt, deferredAttrContext, warn);
argtypes = argtypes.tail;
trees = trees != null ? trees.tail : trees;
}
}