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

changeset 1374
c002fdee76fd
parent 1358
fc123bdeddb8
child 1380
a65971893c50
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Tue Oct 23 13:58:56 2012 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/TransTypes.java	Thu Oct 25 11:09:36 2012 -0700
     1.3 @@ -37,7 +37,9 @@
     1.4  
     1.5  import static com.sun.tools.javac.code.Flags.*;
     1.6  import static com.sun.tools.javac.code.Kinds.*;
     1.7 -import static com.sun.tools.javac.code.TypeTags.*;
     1.8 +import static com.sun.tools.javac.code.TypeTag.CLASS;
     1.9 +import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
    1.10 +import static com.sun.tools.javac.code.TypeTag.VOID;
    1.11  
    1.12  /** This pass translates Generic Java to conventional Java.
    1.13   *
    1.14 @@ -155,7 +157,7 @@
    1.15       */
    1.16      JCExpression retype(JCExpression tree, Type erasedType, Type target) {
    1.17  //      System.err.println("retype " + tree + " to " + erasedType);//DEBUG
    1.18 -        if (erasedType.tag > lastBaseTag) {
    1.19 +        if (!erasedType.isPrimitive()) {
    1.20              if (target != null && target.isPrimitive())
    1.21                  target = erasure(tree.type);
    1.22              tree.type = erasedType;
    1.23 @@ -245,7 +247,7 @@
    1.24                             make.Select(receiver, impl).setType(calltype),
    1.25                             translateArgs(make.Idents(md.params), origErasure.getParameterTypes(), null))
    1.26                  .setType(calltype);
    1.27 -            JCStatement stat = (origErasure.getReturnType().tag == VOID)
    1.28 +            JCStatement stat = (origErasure.getReturnType().hasTag(VOID))
    1.29                  ? make.Exec(call)
    1.30                  : make.Return(coerce(call, bridgeType.getReturnType()));
    1.31              md.body = make.Block(0, List.of(stat));
    1.32 @@ -400,7 +402,7 @@
    1.33       */
    1.34      void addBridges(DiagnosticPosition pos, ClassSymbol origin, ListBuffer<JCTree> bridges) {
    1.35          Type st = types.supertype(origin.type);
    1.36 -        while (st.tag == CLASS) {
    1.37 +        while (st.hasTag(CLASS)) {
    1.38  //          if (isSpecialization(st))
    1.39              addBridges(pos, st.tsym, origin, bridges);
    1.40              st = types.supertype(st);
    1.41 @@ -701,7 +703,7 @@
    1.42          Type et = tree.sym.erasure(types);
    1.43  
    1.44          // Map type variables to their bounds.
    1.45 -        if (tree.sym.kind == TYP && tree.sym.type.tag == TYPEVAR) {
    1.46 +        if (tree.sym.kind == TYP && tree.sym.type.hasTag(TYPEVAR)) {
    1.47              result = make.at(tree.pos).Type(et);
    1.48          } else
    1.49          // Map constants expressions to themselves.
    1.50 @@ -720,7 +722,7 @@
    1.51  
    1.52      public void visitSelect(JCFieldAccess tree) {
    1.53          Type t = tree.selected.type;
    1.54 -        while (t.tag == TYPEVAR)
    1.55 +        while (t.hasTag(TYPEVAR))
    1.56              t = t.getUpperBound();
    1.57          if (t.isCompound()) {
    1.58              if ((tree.sym.flags() & IPROXY) != 0) {
    1.59 @@ -844,7 +846,7 @@
    1.60                         translateArgs(make.Idents(md.params),
    1.61                                       implErasure.getParameterTypes(), null))
    1.62              .setType(calltype);
    1.63 -        JCStatement stat = (member.getReturnType().tag == VOID)
    1.64 +        JCStatement stat = (member.getReturnType().hasTag(VOID))
    1.65              ? make.Exec(call)
    1.66              : make.Return(coerce(call, member.erasure(types).getReturnType()));
    1.67          md.body = make.Block(0, List.of(stat));
    1.68 @@ -862,7 +864,7 @@
    1.69          Type st = types.supertype(c.type);
    1.70  
    1.71          // process superclass before derived
    1.72 -        if (st.tag == CLASS)
    1.73 +        if (st.hasTag(CLASS))
    1.74              translateClass((ClassSymbol)st.tsym);
    1.75  
    1.76          Env<AttrContext> myEnv = enter.typeEnvs.remove(c);

mercurial