1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Oct 23 13:58:56 2012 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Oct 25 11:09:36 2012 -0700 1.3 @@ -59,7 +59,7 @@ 1.4 import static com.sun.tools.javac.code.Flags.BLOCK; 1.5 import static com.sun.tools.javac.code.Kinds.*; 1.6 import static com.sun.tools.javac.code.Kinds.ERRONEOUS; 1.7 -import static com.sun.tools.javac.code.TypeTags.*; 1.8 +import static com.sun.tools.javac.code.TypeTag.*; 1.9 import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*; 1.10 import static com.sun.tools.javac.tree.JCTree.Tag.*; 1.11 1.12 @@ -228,7 +228,7 @@ 1.13 1.14 JCDiagnostic getVerboseApplicableCandidateDiag(int pos, Symbol sym, Type inst) { 1.15 JCDiagnostic subDiag = null; 1.16 - if (sym.type.tag == FORALL) { 1.17 + if (sym.type.hasTag(FORALL)) { 1.18 subDiag = diags.fragment("partial.inst.sig", inst); 1.19 } 1.20 1.21 @@ -331,7 +331,7 @@ 1.22 } 1.23 1.24 boolean isAccessible(Env<AttrContext> env, Type t, boolean checkInner) { 1.25 - return (t.tag == ARRAY) 1.26 + return (t.hasTag(ARRAY)) 1.27 ? isAccessible(env, types.elemtype(t)) 1.28 : isAccessible(env, t.tsym, checkInner); 1.29 } 1.30 @@ -467,10 +467,10 @@ 1.31 // need to inferred. 1.32 List<Type> tvars = List.nil(); 1.33 if (typeargtypes == null) typeargtypes = List.nil(); 1.34 - if (mt.tag != FORALL && typeargtypes.nonEmpty()) { 1.35 + if (!mt.hasTag(FORALL) && typeargtypes.nonEmpty()) { 1.36 // This is not a polymorphic method, but typeargs are supplied 1.37 // which is fine, see JLS 15.12.2.1 1.38 - } else if (mt.tag == FORALL && typeargtypes.nonEmpty()) { 1.39 + } else if (mt.hasTag(FORALL) && typeargtypes.nonEmpty()) { 1.40 ForAll pmt = (ForAll) mt; 1.41 if (typeargtypes.length() != pmt.tvars.length()) 1.42 throw inapplicableMethodException.setMessage("arg.length.mismatch"); // not enough args 1.43 @@ -487,7 +487,7 @@ 1.44 actuals = actuals.tail; 1.45 } 1.46 mt = types.subst(pmt.qtype, pmt.tvars, typeargtypes); 1.47 - } else if (mt.tag == FORALL) { 1.48 + } else if (mt.hasTag(FORALL)) { 1.49 ForAll pmt = (ForAll) mt; 1.50 List<Type> tvars1 = types.newInstances(pmt.tvars); 1.51 tvars = tvars.appendList(tvars1); 1.52 @@ -499,7 +499,7 @@ 1.53 for (List<Type> l = argtypes; 1.54 l.tail != null/*inlined: l.nonEmpty()*/ && !instNeeded; 1.55 l = l.tail) { 1.56 - if (l.head.tag == FORALL) instNeeded = true; 1.57 + if (l.head.hasTag(FORALL)) instNeeded = true; 1.58 } 1.59 1.60 if (instNeeded) 1.61 @@ -807,7 +807,7 @@ 1.62 1.63 @Override 1.64 protected Type check(DiagnosticPosition pos, Type found) { 1.65 - if (found.tag == DEFERRED) { 1.66 + if (found.hasTag(DEFERRED)) { 1.67 DeferredType dt = (DeferredType)found; 1.68 return dt.check(this); 1.69 } else { 1.70 @@ -875,7 +875,7 @@ 1.71 Type site, 1.72 Name name, 1.73 TypeSymbol c) { 1.74 - while (c.type.tag == TYPEVAR) 1.75 + while (c.type.hasTag(TYPEVAR)) 1.76 c = c.type.getUpperBound().tsym; 1.77 Symbol bestSoFar = varNotFound; 1.78 Symbol sym; 1.79 @@ -888,7 +888,7 @@ 1.80 e = e.next(); 1.81 } 1.82 Type st = types.supertype(c.type); 1.83 - if (st != null && (st.tag == CLASS || st.tag == TYPEVAR)) { 1.84 + if (st != null && (st.hasTag(CLASS) || st.hasTag(TYPEVAR))) { 1.85 sym = findField(env, site, name, st.tsym); 1.86 if (sym.kind < bestSoFar.kind) bestSoFar = sym; 1.87 } 1.88 @@ -1184,7 +1184,7 @@ 1.89 lastFormal2 : formals2.head; 1.90 1.91 //is this a structural actual argument? 1.92 - boolean isStructuralPoly = actual.tag == DEFERRED && 1.93 + boolean isStructuralPoly = actual.hasTag(DEFERRED) && 1.94 (((DeferredType)actual).tree.hasTag(LAMBDA) || 1.95 ((DeferredType)actual).tree.hasTag(REFERENCE)); 1.96 1.97 @@ -1301,7 +1301,7 @@ 1.98 Type rt1 = mt1.getReturnType(); 1.99 Type rt2 = mt2.getReturnType(); 1.100 1.101 - if (mt1.tag == FORALL && mt2.tag == FORALL) { 1.102 + if (mt1.hasTag(FORALL) && mt2.hasTag(FORALL)) { 1.103 //if both are generic methods, adjust return type ahead of subtyping check 1.104 rt1 = types.subst(rt1, mt1.getTypeArguments(), mt2.getTypeArguments()); 1.105 } 1.106 @@ -1448,11 +1448,11 @@ 1.107 } 1.108 1.109 TypeSymbol symbolFor(Type t) { 1.110 - if (t.tag != CLASS && 1.111 - t.tag != TYPEVAR) { 1.112 + if (!t.hasTag(CLASS) && 1.113 + !t.hasTag(TYPEVAR)) { 1.114 return null; 1.115 } 1.116 - while (t.tag == TYPEVAR) 1.117 + while (t.hasTag(TYPEVAR)) 1.118 t = t.getUpperBound(); 1.119 if (seen.contains(t.tsym)) { 1.120 //degenerate case in which we have a circular 1.121 @@ -1610,7 +1610,7 @@ 1.122 e = e.next(); 1.123 } 1.124 Type st = types.supertype(c.type); 1.125 - if (st != null && st.tag == CLASS) { 1.126 + if (st != null && st.hasTag(CLASS)) { 1.127 sym = findMemberType(env, site, name, st.tsym); 1.128 if (sym.kind < bestSoFar.kind) bestSoFar = sym; 1.129 } 1.130 @@ -1660,7 +1660,7 @@ 1.131 e = e.next()) { 1.132 if (e.sym.kind == TYP) { 1.133 if (staticOnly && 1.134 - e.sym.type.tag == TYPEVAR && 1.135 + e.sym.type.hasTag(TYPEVAR) && 1.136 e.sym.owner.kind == TYP) return new StaticError(e.sym); 1.137 return e.sym; 1.138 } 1.139 @@ -1669,8 +1669,8 @@ 1.140 sym = findMemberType(env1, env1.enclClass.sym.type, name, 1.141 env1.enclClass.sym); 1.142 if (staticOnly && sym.kind == TYP && 1.143 - sym.type.tag == CLASS && 1.144 - sym.type.getEnclosingType().tag == CLASS && 1.145 + sym.type.hasTag(CLASS) && 1.146 + sym.type.getEnclosingType().hasTag(CLASS) && 1.147 env1.enclClass.sym.type.isParameterized() && 1.148 sym.type.getEnclosingType().isParameterized()) 1.149 return new StaticError(sym); 1.150 @@ -1906,7 +1906,7 @@ 1.151 //method symbol that can be used for lookups in the speculative cache, 1.152 //causing problems in Attr.checkId() 1.153 for (Type t : argtypes) { 1.154 - if (t.tag == DEFERRED) { 1.155 + if (t.hasTag(DEFERRED)) { 1.156 DeferredType dt = (DeferredType)t; 1.157 dt.speculativeCache.dupAllTo(msym, accessedSym); 1.158 } 1.159 @@ -1955,7 +1955,7 @@ 1.160 } 1.161 1.162 public void printscopes(Type t) { 1.163 - while (t.tag == CLASS) { 1.164 + while (t.hasTag(CLASS)) { 1.165 printscopes(t.tsym.members()); 1.166 t = types.supertype(t); 1.167 } 1.168 @@ -2259,7 +2259,7 @@ 1.169 //- System.out.println(" e " + e.sym); 1.170 if (sym.kind == MTH && 1.171 (sym.flags_field & SYNTHETIC) == 0) { 1.172 - List<Type> oldParams = e.sym.type.tag == FORALL ? 1.173 + List<Type> oldParams = e.sym.type.hasTag(FORALL) ? 1.174 ((ForAll)sym.type).tvars : 1.175 List.<Type>nil(); 1.176 Type constrType = new ForAll(site.tsym.type.getTypeArguments().appendList(oldParams), 1.177 @@ -2565,7 +2565,7 @@ 1.178 findMethod(env, site, name, argtypes, typeargtypes, 1.179 phase.isBoxingRequired(), phase.isVarargsRequired(), syms.operatorNames.contains(name)); 1.180 return sym.kind != MTH || 1.181 - site.getEnclosingType().tag == NONE || 1.182 + site.getEnclosingType().hasTag(NONE) || 1.183 hasEnclosingInstance(env, site) ? 1.184 sym : new InvalidSymbolError(Kinds.MISSING_ENCL, sym, null) { 1.185 @Override 1.186 @@ -2578,7 +2578,7 @@ 1.187 1.188 @Override 1.189 ReferenceKind referenceKind(Symbol sym) { 1.190 - return site.getEnclosingType().tag == NONE ? 1.191 + return site.getEnclosingType().hasTag(NONE) ? 1.192 ReferenceKind.TOPLEVEL : ReferenceKind.IMPLICIT_INNER; 1.193 } 1.194 } 1.195 @@ -2847,7 +2847,7 @@ 1.196 } else { 1.197 ListBuffer<Object> diagArgs = ListBuffer.lb(); 1.198 for (Type t : argtypes) { 1.199 - if (t.tag == DEFERRED) { 1.200 + if (t.hasTag(DEFERRED)) { 1.201 diagArgs.append(((DeferredAttr.DeferredType)t).tree); 1.202 } else { 1.203 diagArgs.append(t); 1.204 @@ -3222,7 +3222,7 @@ 1.205 Name name, 1.206 List<Type> argtypes, 1.207 List<Type> typeargtypes) { 1.208 - if (sym.owner.type.tag == ERROR) 1.209 + if (sym.owner.type.hasTag(ERROR)) 1.210 return null; 1.211 1.212 if (sym.name == names.init && sym.owner != site.tsym) { 1.213 @@ -3267,7 +3267,7 @@ 1.214 Name name, 1.215 List<Type> argtypes, 1.216 List<Type> typeargtypes) { 1.217 - Symbol errSym = ((sym.kind == TYP && sym.type.tag == CLASS) 1.218 + Symbol errSym = ((sym.kind == TYP && sym.type.hasTag(CLASS)) 1.219 ? types.erasure(sym.type).tsym 1.220 : sym); 1.221 return diags.create(dkind, log.currentSource(), pos,