src/share/classes/com/sun/tools/javac/comp/Resolve.java

changeset 1006
a2d422d480cb
parent 972
694ff82ca68e
child 1059
0b5beb9562c6
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue May 10 19:53:49 2011 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed May 11 13:10:57 2011 +0200
     1.3 @@ -458,9 +458,7 @@
     1.4              throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args
     1.5  
     1.6          if (useVarargs) {
     1.7 -            //note: if applicability check is triggered by most specific test,
     1.8 -            //the last argument of a varargs is _not_ an array type (see JLS 15.12.2.5)
     1.9 -            Type elt = types.elemtypeOrType(varargsFormal);
    1.10 +            Type elt = types.elemtype(varargsFormal);
    1.11              while (argtypes.nonEmpty()) {
    1.12                  if (!types.isConvertible(argtypes.head, elt, warn))
    1.13                      throw inapplicableMethodException.setMessage("varargs.argument.mismatch",
    1.14 @@ -819,10 +817,10 @@
    1.15      private boolean signatureMoreSpecific(Env<AttrContext> env, Type site, Symbol m1, Symbol m2, boolean allowBoxing, boolean useVarargs) {
    1.16          noteWarner.clear();
    1.17          Type mtype1 = types.memberType(site, adjustVarargs(m1, m2, useVarargs));
    1.18 -        return (instantiate(env, site, adjustVarargs(m2, m1, useVarargs), types.lowerBoundArgtypes(mtype1), null,
    1.19 -                             allowBoxing, false, noteWarner) != null ||
    1.20 -                 useVarargs && instantiate(env, site, adjustVarargs(m2, m1, useVarargs), types.lowerBoundArgtypes(mtype1), null,
    1.21 -                                           allowBoxing, true, noteWarner) != null) &&
    1.22 +        Type mtype2 = instantiate(env, site, adjustVarargs(m2, m1, useVarargs),
    1.23 +                types.lowerBoundArgtypes(mtype1), null,
    1.24 +                allowBoxing, false, noteWarner);
    1.25 +        return mtype2 != null &&
    1.26                  !noteWarner.hasLint(Lint.LintCategory.UNCHECKED);
    1.27      }
    1.28      //where
    1.29 @@ -855,7 +853,7 @@
    1.30              //append varargs element type as last synthetic formal
    1.31              args.append(types.elemtype(varargsTypeTo));
    1.32              Type mtype = types.createMethodTypeWithParameters(to.type, args.toList());
    1.33 -            return new MethodSymbol(to.flags_field, to.name, mtype, to.owner);
    1.34 +            return new MethodSymbol(to.flags_field & ~VARARGS, to.name, mtype, to.owner);
    1.35          } else {
    1.36              return to;
    1.37          }

mercurial