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

changeset 1268
af6a4c24f4e3
parent 1239
2827076dbf64
child 1296
cddc2c894cc6
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri May 25 16:32:56 2012 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu May 31 17:42:14 2012 +0100
     1.3 @@ -224,12 +224,8 @@
     1.4  
     1.5      JCDiagnostic getVerboseApplicableCandidateDiag(int pos, Symbol sym, Type inst) {
     1.6          JCDiagnostic subDiag = null;
     1.7 -        if (inst.getReturnType().tag == FORALL) {
     1.8 -            Type diagType = types.createMethodTypeWithReturn(inst.asMethodType(),
     1.9 -                                                            ((ForAll)inst.getReturnType()).qtype);
    1.10 -            subDiag = diags.fragment("partial.inst.sig", diagType);
    1.11 -        } else if (sym.type.tag == FORALL) {
    1.12 -            subDiag = diags.fragment("full.inst.sig", inst.asMethodType());
    1.13 +        if (sym.type.tag == FORALL) {
    1.14 +            subDiag = diags.fragment("partial.inst.sig", inst);
    1.15          }
    1.16  
    1.17          String key = subDiag == null ?
    1.18 @@ -442,6 +438,7 @@
    1.19      Type rawInstantiate(Env<AttrContext> env,
    1.20                          Type site,
    1.21                          Symbol m,
    1.22 +                        ResultInfo resultInfo,
    1.23                          List<Type> argtypes,
    1.24                          List<Type> typeargtypes,
    1.25                          boolean allowBoxing,
    1.26 @@ -454,11 +451,7 @@
    1.27  
    1.28          // tvars is the list of formal type variables for which type arguments
    1.29          // need to inferred.
    1.30 -        List<Type> tvars = null;
    1.31 -        if (env.info.tvars != null) {
    1.32 -            tvars = types.newInstances(env.info.tvars);
    1.33 -            mt = types.subst(mt, env.info.tvars, tvars);
    1.34 -        }
    1.35 +        List<Type> tvars = List.nil();
    1.36          if (typeargtypes == null) typeargtypes = List.nil();
    1.37          if (mt.tag != FORALL && typeargtypes.nonEmpty()) {
    1.38              // This is not a polymorphic method, but typeargs are supplied
    1.39 @@ -499,6 +492,7 @@
    1.40              return infer.instantiateMethod(env,
    1.41                                      tvars,
    1.42                                      (MethodType)mt,
    1.43 +                                    resultInfo,
    1.44                                      m,
    1.45                                      argtypes,
    1.46                                      allowBoxing,
    1.47 @@ -515,13 +509,14 @@
    1.48      Type instantiate(Env<AttrContext> env,
    1.49                       Type site,
    1.50                       Symbol m,
    1.51 +                     ResultInfo resultInfo,
    1.52                       List<Type> argtypes,
    1.53                       List<Type> typeargtypes,
    1.54                       boolean allowBoxing,
    1.55                       boolean useVarargs,
    1.56                       Warner warn) {
    1.57          try {
    1.58 -            return rawInstantiate(env, site, m, argtypes, typeargtypes,
    1.59 +            return rawInstantiate(env, site, m, resultInfo, argtypes, typeargtypes,
    1.60                                    allowBoxing, useVarargs, warn);
    1.61          } catch (InapplicableMethodException ex) {
    1.62              return null;
    1.63 @@ -937,7 +932,7 @@
    1.64          if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
    1.65          Assert.check(sym.kind < AMBIGUOUS);
    1.66          try {
    1.67 -            Type mt = rawInstantiate(env, site, sym, argtypes, typeargtypes,
    1.68 +            Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes,
    1.69                                 allowBoxing, useVarargs, Warner.noWarnings);
    1.70              if (!operator)
    1.71                  currentResolutionContext.addApplicableCandidate(sym, mt);
    1.72 @@ -1071,7 +1066,7 @@
    1.73      private boolean signatureMoreSpecific(Env<AttrContext> env, Type site, Symbol m1, Symbol m2, boolean allowBoxing, boolean useVarargs) {
    1.74          noteWarner.clear();
    1.75          Type mtype1 = types.memberType(site, adjustVarargs(m1, m2, useVarargs));
    1.76 -        Type mtype2 = instantiate(env, site, adjustVarargs(m2, m1, useVarargs),
    1.77 +        Type mtype2 = instantiate(env, site, adjustVarargs(m2, m1, useVarargs), null,
    1.78                  types.lowerBoundArgtypes(mtype1), null,
    1.79                  allowBoxing, false, noteWarner);
    1.80          return mtype2 != null &&

mercurial