if (sym.name==names.init &&
sym.owner == syms.enumSym)
formals = formals.tail.tail;
List<JCExpression> args = argtrees;
while (formals.head != last) {
JCTree arg = args.head;
Warner warn = chk.convertWarner(arg.pos(), arg.type, formals.head);
assertConvertible(arg, arg.type, formals.head, warn);
warned |= warn.warned;
args = args.tail;
formals = formals.tail;
}
if (useVarargs) {
Type varArg = types.elemtype(last);
while (args.tail != null) {
JCTree arg = args.head;
Warner warn = chk.convertWarner(arg.pos(), arg.type, varArg);
assertConvertible(arg, arg.type, varArg, warn);
warned |= warn.warned;
args = args.tail;
}
} else if ((sym.flags() & VARARGS) != 0 && allowVarargs) {
// non-varargs call to varargs method
Type varParam = owntype.getParameterTypes().last();
Type lastArg = argtypes.last();
if (types.isSubtypeUnchecked(lastArg, types.elemtype(varParam)) &&
!types.isSameType(types.erasure(varParam), types.erasure(lastArg)))
log.warning(argtrees.last().pos(), "inexact.non-varargs.call",
types.elemtype(varParam),
varParam);
}
if (warned && sym.type.tag == FORALL) {
String typeargs = "";
if (typeargtypes != null && typeargtypes.nonEmpty()) {
typeargs = "<" + Type.toString(typeargtypes) + ">";
}
chk.warnUnchecked(env.tree.pos(),
"unchecked.meth.invocation.applied",
sym,
sym.location(),
typeargs,
Type.toString(argtypes));
owntype = new MethodType(owntype.getParameterTypes(),
types.erasure(owntype.getReturnType()),
owntype.getThrownTypes(),
syms.methodClass);
}
if (useVarargs) {
JCTree tree = env.tree;
Type argtype = owntype.getParameterTypes().last();
if (!types.isReifiable(argtype))
chk.warnUnchecked(env.tree.pos(),
"unchecked.generic.array.creation",
argtype);
Type elemtype = types.elemtype(argtype);
switch (tree.getTag()) {
case JCTree.APPLY:
((JCMethodInvocation) tree).varargsElement = elemtype;
break;
case JCTree.NEWCLASS:
((JCNewClass) tree).varargsElement = elemtype;