src/share/classes/com/sun/tools/javac/code/Types.java

changeset 1338
ad2ca2a4ab5e
parent 1313
873ddd9f4900
child 1347
1408af4cd8b0
     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Tue Sep 25 11:55:34 2012 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Tue Sep 25 11:56:46 2012 +0100
     1.3 @@ -34,6 +34,7 @@
     1.4  import com.sun.tools.javac.jvm.ClassReader;
     1.5  import com.sun.tools.javac.code.Attribute.RetentionPolicy;
     1.6  import com.sun.tools.javac.code.Lint.LintCategory;
     1.7 +import com.sun.tools.javac.code.Type.UndetVar.InferenceBound;
     1.8  import com.sun.tools.javac.comp.Check;
     1.9  
    1.10  import static com.sun.tools.javac.code.Scope.*;
    1.11 @@ -510,7 +511,7 @@
    1.12                      return false;
    1.13                  }
    1.14  
    1.15 -                t.hibounds = t.hibounds.prepend(s);
    1.16 +                t.addBound(InferenceBound.UPPER, s, Types.this);
    1.17                  return true;
    1.18              }
    1.19  
    1.20 @@ -578,7 +579,7 @@
    1.21                  undet.qtype == s ||
    1.22                  s.tag == ERROR ||
    1.23                  s.tag == BOT) return true;
    1.24 -            undet.lobounds = undet.lobounds.prepend(s);
    1.25 +            undet.addBound(InferenceBound.LOWER, s, this);
    1.26              return true;
    1.27          }
    1.28          default:
    1.29 @@ -723,7 +724,7 @@
    1.30                  if (t == s || t.qtype == s || s.tag == ERROR || s.tag == UNKNOWN)
    1.31                      return true;
    1.32  
    1.33 -                t.eq = t.eq.prepend(s);
    1.34 +                t.addBound(InferenceBound.EQ, s, Types.this);
    1.35  
    1.36                  return true;
    1.37              }
    1.38 @@ -735,19 +736,6 @@
    1.39          };
    1.40      // </editor-fold>
    1.41  
    1.42 -    // <editor-fold defaultstate="collapsed" desc="fromUnknownFun">
    1.43 -    /**
    1.44 -     * A mapping that turns all unknown types in this type to fresh
    1.45 -     * unknown variables.
    1.46 -     */
    1.47 -    public Mapping fromUnknownFun = new Mapping("fromUnknownFun") {
    1.48 -            public Type apply(Type t) {
    1.49 -                if (t.tag == UNKNOWN) return new UndetVar(t);
    1.50 -                else return t.map(this);
    1.51 -            }
    1.52 -        };
    1.53 -    // </editor-fold>
    1.54 -
    1.55      // <editor-fold defaultstate="collapsed" desc="Contains Type">
    1.56      public boolean containedBy(Type t, Type s) {
    1.57          switch (t.tag) {
    1.58 @@ -759,12 +747,12 @@
    1.59                      case UNBOUND: //similar to ? extends Object
    1.60                      case EXTENDS: {
    1.61                          Type bound = upperBound(s);
    1.62 -                        undetvar.hibounds = undetvar.hibounds.prepend(bound);
    1.63 +                        undetvar.addBound(InferenceBound.UPPER, bound, this);
    1.64                          break;
    1.65                      }
    1.66                      case SUPER: {
    1.67                          Type bound = lowerBound(s);
    1.68 -                        undetvar.lobounds = undetvar.lobounds.prepend(bound);
    1.69 +                        undetvar.addBound(InferenceBound.LOWER, bound, this);
    1.70                          break;
    1.71                      }
    1.72                  }

mercurial