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

changeset 1341
db36841709e4
parent 1338
ad2ca2a4ab5e
child 1342
1a65d6565b45
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Tue Sep 25 13:11:05 2012 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Sep 26 14:22:41 2012 +0100
     1.3 @@ -1972,10 +1972,12 @@
     1.4                  steps = steps.tail;
     1.5              }
     1.6              if (sym.kind >= AMBIGUOUS) {
     1.7 -                final JCDiagnostic details = sym.kind == WRONG_MTH ?
     1.8 -                                currentResolutionContext.candidates.head.details :
     1.9 +                Symbol errSym =
    1.10 +                        currentResolutionContext.resolutionCache.get(currentResolutionContext.firstErroneousResolutionPhase());
    1.11 +                final JCDiagnostic details = errSym.kind == WRONG_MTH ?
    1.12 +                                ((InapplicableSymbolError)errSym).errCandidate().details :
    1.13                                  null;
    1.14 -                Symbol errSym = new ResolveError(WRONG_MTH, "diamond error") {
    1.15 +                errSym = new InapplicableSymbolError(errSym.kind, "diamondError") {
    1.16                      @Override
    1.17                      JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos,
    1.18                              Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
    1.19 @@ -2015,16 +2017,23 @@
    1.20          for (Scope.Entry e = site.tsym.members().lookup(names.init);
    1.21               e.scope != null;
    1.22               e = e.next()) {
    1.23 +            final Symbol sym = e.sym;
    1.24              //- System.out.println(" e " + e.sym);
    1.25 -            if (e.sym.kind == MTH &&
    1.26 -                (e.sym.flags_field & SYNTHETIC) == 0) {
    1.27 +            if (sym.kind == MTH &&
    1.28 +                (sym.flags_field & SYNTHETIC) == 0) {
    1.29                      List<Type> oldParams = e.sym.type.tag == FORALL ?
    1.30 -                            ((ForAll)e.sym.type).tvars :
    1.31 +                            ((ForAll)sym.type).tvars :
    1.32                              List.<Type>nil();
    1.33                      Type constrType = new ForAll(site.tsym.type.getTypeArguments().appendList(oldParams),
    1.34 -                            types.createMethodTypeWithReturn(e.sym.type.asMethodType(), site));
    1.35 +                            types.createMethodTypeWithReturn(sym.type.asMethodType(), site));
    1.36 +                    MethodSymbol newConstr = new MethodSymbol(sym.flags(), names.init, constrType, site.tsym) {
    1.37 +                        @Override
    1.38 +                        public Symbol baseSymbol() {
    1.39 +                            return sym;
    1.40 +                        }
    1.41 +                    };
    1.42                      bestSoFar = selectBest(env, site, argtypes, typeargtypes,
    1.43 -                            new MethodSymbol(e.sym.flags(), names.init, constrType, site.tsym),
    1.44 +                            newConstr,
    1.45                              bestSoFar,
    1.46                              allowBoxing,
    1.47                              useVarargs,

mercurial