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

changeset 267
e2722bd43f3a
parent 252
5caa6c45936a
child 299
22872b24d38c
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Apr 16 11:23:02 2009 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon May 04 21:04:04 2009 -0700
     1.3 @@ -207,6 +207,12 @@
     1.4       *  @param found      The type that was found.
     1.5       */
     1.6      Type typeTagError(DiagnosticPosition pos, Object required, Object found) {
     1.7 +        // this error used to be raised by the parser,
     1.8 +        // but has been delayed to this point:
     1.9 +        if (found instanceof Type && ((Type)found).tag == VOID) {
    1.10 +            log.error(pos, "illegal.start.of.type");
    1.11 +            return syms.errType;
    1.12 +        }
    1.13          log.error(pos, "type.found.req", found, required);
    1.14          return types.createErrorType(found instanceof Type ? (Type)found : syms.errType);
    1.15      }
    1.16 @@ -547,6 +553,20 @@
    1.17          }
    1.18      }
    1.19  
    1.20 +    /** Check that each type is a reference type, i.e. a class, interface or array type
    1.21 +     *  or a type variable.
    1.22 +     *  @param trees         Original trees, used for error reporting.
    1.23 +     *  @param types         The types to be checked.
    1.24 +     */
    1.25 +    List<Type> checkRefTypes(List<JCExpression> trees, List<Type> types) {
    1.26 +        List<JCExpression> tl = trees;
    1.27 +        for (List<Type> l = types; l.nonEmpty(); l = l.tail) {
    1.28 +            l.head = checkRefType(tl.head.pos(), l.head);
    1.29 +            tl = tl.tail;
    1.30 +        }
    1.31 +        return types;
    1.32 +    }
    1.33 +
    1.34      /** Check that type is a null or reference type.
    1.35       *  @param pos           Position to be used for error reporting.
    1.36       *  @param t             The type to be checked.

mercurial