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

changeset 110
91eea580fbe9
parent 89
b6d5f53b3b29
child 113
eff38cc97183
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Sep 04 14:56:35 2008 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Tue Sep 09 10:28:21 2008 -0700
     1.3 @@ -192,12 +192,12 @@
     1.4      Type typeError(DiagnosticPosition pos, Object problem, Type found, Type req) {
     1.5          log.error(pos, "prob.found.req",
     1.6                    problem, found, req);
     1.7 -        return syms.errType;
     1.8 +        return types.createErrorType(found);
     1.9      }
    1.10  
    1.11      Type typeError(DiagnosticPosition pos, String problem, Type found, Type req, Object explanation) {
    1.12          log.error(pos, "prob.found.req.1", problem, found, req, explanation);
    1.13 -        return syms.errType;
    1.14 +        return types.createErrorType(found);
    1.15      }
    1.16  
    1.17      /** Report an error that wrong type tag was found.
    1.18 @@ -208,7 +208,7 @@
    1.19       */
    1.20      Type typeTagError(DiagnosticPosition pos, Object required, Object found) {
    1.21          log.error(pos, "type.found.req", found, required);
    1.22 -        return syms.errType;
    1.23 +        return types.createErrorType(found instanceof Type ? (Type)found : syms.errType);
    1.24      }
    1.25  
    1.26      /** Report an error that symbol cannot be referenced before super
    1.27 @@ -348,11 +348,11 @@
    1.28              return typeError(pos, diags.fragment("possible.loss.of.precision"), found, req);
    1.29          if (found.isSuperBound()) {
    1.30              log.error(pos, "assignment.from.super-bound", found);
    1.31 -            return syms.errType;
    1.32 +            return types.createErrorType(found);
    1.33          }
    1.34          if (req.isExtendsBound()) {
    1.35              log.error(pos, "assignment.to.extends-bound", req);
    1.36 -            return syms.errType;
    1.37 +            return types.createErrorType(found);
    1.38          }
    1.39          return typeError(pos, diags.fragment("incompatible.types"), found, req);
    1.40      }
    1.41 @@ -378,7 +378,7 @@
    1.42                      log.error(pos,
    1.43                                "undetermined.type" + (d!=null ? ".1" : ""),
    1.44                                t, d);
    1.45 -                    return syms.errType;
    1.46 +                    return types.createErrorType(pt);
    1.47                  } else {
    1.48                      JCDiagnostic d = ex.getDiagnostic();
    1.49                      return typeError(pos,
    1.50 @@ -469,7 +469,7 @@
    1.51      Type checkNonVoid(DiagnosticPosition pos, Type t) {
    1.52          if (t.tag == VOID) {
    1.53              log.error(pos, "void.not.allowed.here");
    1.54 -            return syms.errType;
    1.55 +            return types.createErrorType(t);
    1.56          } else {
    1.57              return t;
    1.58          }
    1.59 @@ -521,7 +521,7 @@
    1.60                                  t);
    1.61          } else if (!types.isReifiable(t)) {
    1.62              log.error(pos, "illegal.generic.type.for.instof");
    1.63 -            return syms.errType;
    1.64 +            return types.createErrorType(t);
    1.65          } else {
    1.66              return t;
    1.67          }
    1.68 @@ -1542,7 +1542,7 @@
    1.69              return;
    1.70          if (seen.contains(t)) {
    1.71              tv = (TypeVar)t;
    1.72 -            tv.bound = new ErrorType();
    1.73 +            tv.bound = types.createErrorType(t);
    1.74              log.error(pos, "cyclic.inheritance", t);
    1.75          } else if (t.tag == TYPEVAR) {
    1.76              tv = (TypeVar)t;
    1.77 @@ -1597,11 +1597,11 @@
    1.78      private void noteCyclic(DiagnosticPosition pos, ClassSymbol c) {
    1.79          log.error(pos, "cyclic.inheritance", c);
    1.80          for (List<Type> l=types.interfaces(c.type); l.nonEmpty(); l=l.tail)
    1.81 -            l.head = new ErrorType((ClassSymbol)l.head.tsym);
    1.82 +            l.head = types.createErrorType((ClassSymbol)l.head.tsym, Type.noType);
    1.83          Type st = types.supertype(c.type);
    1.84          if (st.tag == CLASS)
    1.85 -            ((ClassType)c.type).supertype_field = new ErrorType((ClassSymbol)st.tsym);
    1.86 -        c.type = new ErrorType(c);
    1.87 +            ((ClassType)c.type).supertype_field = types.createErrorType((ClassSymbol)st.tsym, Type.noType);
    1.88 +        c.type = types.createErrorType(c, c.type);
    1.89          c.flags_field |= ACYCLIC;
    1.90      }
    1.91  

mercurial