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

changeset 1510
7873d37f5b37
parent 1497
7aa2025bbb7b
child 1513
cf84b07a82db
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Jan 21 11:16:28 2013 -0800
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Jan 21 20:13:56 2013 +0000
     1.3 @@ -36,7 +36,6 @@
     1.4  import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
     1.5  import com.sun.tools.javac.util.List;
     1.6  
     1.7 -import com.sun.tools.javac.tree.JCTree.*;
     1.8  import com.sun.tools.javac.code.Lint;
     1.9  import com.sun.tools.javac.code.Lint.LintCategory;
    1.10  import com.sun.tools.javac.code.Type.*;
    1.11 @@ -44,6 +43,8 @@
    1.12  import com.sun.tools.javac.comp.DeferredAttr.DeferredAttrContext;
    1.13  import com.sun.tools.javac.comp.Infer.InferenceContext;
    1.14  import com.sun.tools.javac.comp.Infer.InferenceContext.FreeTypeListener;
    1.15 +import com.sun.tools.javac.tree.JCTree.*;
    1.16 +import com.sun.tools.javac.tree.JCTree.JCPolyExpression.*;
    1.17  
    1.18  import static com.sun.tools.javac.code.Flags.*;
    1.19  import static com.sun.tools.javac.code.Flags.ANNOTATION;
    1.20 @@ -900,7 +901,6 @@
    1.21                     syms.methodClass);
    1.22          }
    1.23          if (useVarargs) {
    1.24 -            JCTree tree = env.tree;
    1.25              Type argtype = owntype.getParameterTypes().last();
    1.26              if (!types.isReifiable(argtype) &&
    1.27                      (!allowSimplifiedVarargs ||
    1.28 @@ -911,22 +911,13 @@
    1.29                                    argtype);
    1.30              }
    1.31              if (!((MethodSymbol)sym.baseSymbol()).isSignaturePolymorphic(types)) {
    1.32 -                Type elemtype = types.elemtype(argtype);
    1.33 -                switch (tree.getTag()) {
    1.34 -                    case APPLY:
    1.35 -                        ((JCMethodInvocation) tree).varargsElement = elemtype;
    1.36 -                        break;
    1.37 -                    case NEWCLASS:
    1.38 -                        ((JCNewClass) tree).varargsElement = elemtype;
    1.39 -                        break;
    1.40 -                    case REFERENCE:
    1.41 -                        ((JCMemberReference) tree).varargsElement = elemtype;
    1.42 -                        break;
    1.43 -                    default:
    1.44 -                        throw new AssertionError(""+tree);
    1.45 -                }
    1.46 +                TreeInfo.setVarargsElement(env.tree, types.elemtype(argtype));
    1.47              }
    1.48           }
    1.49 +         PolyKind pkind = (sym.type.hasTag(FORALL) &&
    1.50 +                 sym.type.getReturnType().containsAny(((ForAll)sym.type).tvars)) ?
    1.51 +                 PolyKind.POLY : PolyKind.STANDALONE;
    1.52 +         TreeInfo.setPolyKind(env.tree, pkind);
    1.53           return owntype;
    1.54      }
    1.55      //where

mercurial