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

changeset 1374
c002fdee76fd
parent 1357
c75be5bc5283
child 1415
01c9d4161882
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Oct 23 13:58:56 2012 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Oct 25 11:09:36 2012 -0700
     1.3 @@ -42,7 +42,7 @@
     1.4  import java.util.HashMap;
     1.5  import java.util.Map;
     1.6  
     1.7 -import static com.sun.tools.javac.code.TypeTags.*;
     1.8 +import static com.sun.tools.javac.code.TypeTag.*;
     1.9  
    1.10  /** Helper class for type parameter inference, used by the attribution phase.
    1.11   *
    1.12 @@ -145,7 +145,7 @@
    1.13      private Filter<Type> boundFilter = new Filter<Type>() {
    1.14          @Override
    1.15          public boolean accepts(Type t) {
    1.16 -            return !t.isErroneous() && t.tag != BOT;
    1.17 +            return !t.isErroneous() && !t.hasTag(BOT);
    1.18          }
    1.19      };
    1.20  
    1.21 @@ -163,7 +163,7 @@
    1.22              else {
    1.23                  that.inst = types.lub(lobounds);
    1.24              }
    1.25 -            if (that.inst == null || that.inst.tag == ERROR)
    1.26 +            if (that.inst == null || that.inst.hasTag(ERROR))
    1.27                      throw inferenceException
    1.28                          .setMessage("no.unique.minimal.instance.exists",
    1.29                                      that.qtype, lobounds);
    1.30 @@ -189,13 +189,13 @@
    1.31              Attr.ResultInfo resultInfo,
    1.32              Warner warn) throws InferenceException {
    1.33          Type to = resultInfo.pt;
    1.34 -        if (to.tag == NONE || resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
    1.35 -            to = mtype.getReturnType().tag <= VOID ?
    1.36 +        if (to.hasTag(NONE) || resultInfo.checkContext.inferenceContext().free(resultInfo.pt)) {
    1.37 +            to = mtype.getReturnType().isPrimitiveOrVoid() ?
    1.38                      mtype.getReturnType() : syms.objectType;
    1.39          }
    1.40          Type qtype1 = inferenceContext.asFree(mtype.getReturnType(), types);
    1.41          if (!types.isSubtype(qtype1,
    1.42 -                qtype1.tag == UNDETVAR ? types.boxedTypeOrType(to) : to)) {
    1.43 +                qtype1.hasTag(UNDETVAR) ? types.boxedTypeOrType(to) : to)) {
    1.44              throw inferenceException
    1.45                      .setMessage("infer.no.conforming.instance.exists",
    1.46                      inferenceContext.restvars(), mtype.getReturnType(), to);
    1.47 @@ -515,7 +515,7 @@
    1.48              //for remaining uninferred type-vars in the functional interface type,
    1.49              //simply replace the wildcards with its bound
    1.50              for (Type t : formalInterface.getTypeArguments()) {
    1.51 -                if (actualTypeargs.head.tag == WILDCARD) {
    1.52 +                if (actualTypeargs.head.hasTag(WILDCARD)) {
    1.53                      WildcardType wt = (WildcardType)actualTypeargs.head;
    1.54                      typeargs.append(wt.type);
    1.55                  } else {
    1.56 @@ -592,7 +592,7 @@
    1.57  
    1.58              public Type apply(Type t) {
    1.59                  t = types.erasure(super.apply(t));
    1.60 -                if (t.tag == BOT)
    1.61 +                if (t.hasTag(BOT))
    1.62                      // nulls type as the marker type Null (which has no instances)
    1.63                      // infer as java.lang.Void for now
    1.64                      t = types.boxedClass(syms.voidType).type;
    1.65 @@ -614,7 +614,7 @@
    1.66          }
    1.67  
    1.68          public Type apply(Type t) {
    1.69 -            if (t.tag == TYPEVAR) return new UndetVar((TypeVar)t, types, includeBounds);
    1.70 +            if (t.hasTag(TYPEVAR)) return new UndetVar((TypeVar)t, types, includeBounds);
    1.71              else return t.map(this);
    1.72          }
    1.73      };

mercurial