Merge

Mon, 23 Aug 2010 19:14:55 -0700

author
lana
date
Mon, 23 Aug 2010 19:14:55 -0700
changeset 644
0c81bff15ced
parent 627
2c1c657f69a4
parent 643
a626d8c1de6e
child 645
ba774f919ad0

Merge

     1.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java	Thu Aug 19 15:13:23 2010 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Mon Aug 23 19:14:55 2010 -0700
     1.3 @@ -328,6 +328,10 @@
     1.4          return (tsym.flags() & INTERFACE) != 0;
     1.5      }
     1.6  
     1.7 +    public boolean isFinal() {
     1.8 +        return (tsym.flags() & FINAL) != 0;
     1.9 +    }
    1.10 +
    1.11      public boolean isPrimitive() {
    1.12          return tag < VOID;
    1.13      }
    1.14 @@ -347,11 +351,17 @@
    1.15          return false;
    1.16      }
    1.17  
    1.18 -    /** Does this type contain an occurrence of some type in `elems'?
    1.19 +    /** Does this type contain an occurrence of some type in 'ts'?
    1.20       */
    1.21 -    public boolean containsSome(List<Type> ts) {
    1.22 -        for (List<Type> l = ts; l.nonEmpty(); l = l.tail)
    1.23 -            if (this.contains(ts.head)) return true;
    1.24 +    public boolean containsAny(List<Type> ts) {
    1.25 +        for (Type t : ts)
    1.26 +            if (this.contains(t)) return true;
    1.27 +        return false;
    1.28 +    }
    1.29 +
    1.30 +    public static boolean containsAny(List<Type> ts1, List<Type> ts2) {
    1.31 +        for (Type t : ts1)
    1.32 +            if (t.containsAny(ts2)) return true;
    1.33          return false;
    1.34      }
    1.35  
    1.36 @@ -431,6 +441,10 @@
    1.37              this.bound = bound;
    1.38          }
    1.39  
    1.40 +        public boolean contains(Type t) {
    1.41 +            return kind != UNBOUND && type.contains(t);
    1.42 +        }
    1.43 +
    1.44          public boolean isSuperBound() {
    1.45              return kind == SUPER ||
    1.46                  kind == UNBOUND;
    1.47 @@ -681,7 +695,9 @@
    1.48              return
    1.49                  elem == this
    1.50                  || (isParameterized()
    1.51 -                    && (getEnclosingType().contains(elem) || contains(getTypeArguments(), elem)));
    1.52 +                    && (getEnclosingType().contains(elem) || contains(getTypeArguments(), elem)))
    1.53 +                || (isCompound()
    1.54 +                    && (supertype_field.contains(elem) || contains(interfaces_field, elem)));
    1.55          }
    1.56  
    1.57          public void complete() {
     2.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Aug 19 15:13:23 2010 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Mon Aug 23 19:14:55 2010 -0700
     2.3 @@ -960,7 +960,7 @@
     2.4                      return true;
     2.5  
     2.6                  if (s.tag == TYPEVAR) {
     2.7 -                    if (isCastable(s.getUpperBound(), t, Warner.noWarnings)) {
     2.8 +                    if (isCastable(t, s.getUpperBound(), Warner.noWarnings)) {
     2.9                          warnStack.head.warnUnchecked();
    2.10                          return true;
    2.11                      } else {
    2.12 @@ -1030,7 +1030,12 @@
    2.13                                  && !disjointTypes(aHigh.allparams(), lowSub.allparams())
    2.14                                  && !disjointTypes(aLow.allparams(), highSub.allparams())
    2.15                                  && !disjointTypes(aLow.allparams(), lowSub.allparams())) {
    2.16 -                                if (upcast ? giveWarning(a, b) :
    2.17 +                                if (s.isInterface() &&
    2.18 +                                        !t.isInterface() &&
    2.19 +                                        t.isFinal() &&
    2.20 +                                        !isSubtype(t, s)) {
    2.21 +                                    return false;
    2.22 +                                } else if (upcast ? giveWarning(a, b) :
    2.23                                      giveWarning(b, a))
    2.24                                      warnStack.head.warnUnchecked();
    2.25                                  return true;
    2.26 @@ -1230,18 +1235,23 @@
    2.27          if (t == s) return false;
    2.28          if (t.tag == TYPEVAR) {
    2.29              TypeVar tv = (TypeVar) t;
    2.30 -            if (s.tag == TYPEVAR)
    2.31 -                s = s.getUpperBound();
    2.32              return !isCastable(tv.bound,
    2.33 -                               s,
    2.34 +                               relaxBound(s),
    2.35                                 Warner.noWarnings);
    2.36          }
    2.37          if (s.tag != WILDCARD)
    2.38              s = upperBound(s);
    2.39 -        if (s.tag == TYPEVAR)
    2.40 -            s = s.getUpperBound();
    2.41 -
    2.42 -        return !isSubtype(t, s);
    2.43 +
    2.44 +        return !isSubtype(t, relaxBound(s));
    2.45 +    }
    2.46 +
    2.47 +    private Type relaxBound(Type t) {
    2.48 +        if (t.tag == TYPEVAR) {
    2.49 +            while (t.tag == TYPEVAR)
    2.50 +                t = t.getUpperBound();
    2.51 +            t = rewriteQuantifiers(t, true, true);
    2.52 +        }
    2.53 +        return t;
    2.54      }
    2.55      // </editor-fold>
    2.56  
    2.57 @@ -2945,6 +2955,13 @@
    2.58      public Type capture(Type t) {
    2.59          if (t.tag != CLASS)
    2.60              return t;
    2.61 +        if (t.getEnclosingType() != Type.noType) {
    2.62 +            Type capturedEncl = capture(t.getEnclosingType());
    2.63 +            if (capturedEncl != t.getEnclosingType()) {
    2.64 +                Type type1 = memberType(capturedEncl, t.tsym);
    2.65 +                t = subst(type1, t.tsym.type.getTypeArguments(), t.getTypeArguments());
    2.66 +            }
    2.67 +        }
    2.68          ClassType cls = (ClassType)t;
    2.69          if (cls.isRaw() || !cls.isParameterized())
    2.70              return cls;
    2.71 @@ -3273,7 +3290,7 @@
    2.72       * quantifiers) only
    2.73       */
    2.74      private Type rewriteQuantifiers(Type t, boolean high, boolean rewriteTypeVars) {
    2.75 -        return new Rewriter(high, rewriteTypeVars).rewrite(t);
    2.76 +        return new Rewriter(high, rewriteTypeVars).visit(t);
    2.77      }
    2.78  
    2.79      class Rewriter extends UnaryVisitor<Type> {
    2.80 @@ -3286,25 +3303,21 @@
    2.81              this.rewriteTypeVars = rewriteTypeVars;
    2.82          }
    2.83  
    2.84 -        Type rewrite(Type t) {
    2.85 -            ListBuffer<Type> from = new ListBuffer<Type>();
    2.86 -            ListBuffer<Type> to = new ListBuffer<Type>();
    2.87 -            adaptSelf(t, from, to);
    2.88 +        @Override
    2.89 +        public Type visitClassType(ClassType t, Void s) {
    2.90              ListBuffer<Type> rewritten = new ListBuffer<Type>();
    2.91 -            List<Type> formals = from.toList();
    2.92              boolean changed = false;
    2.93 -            for (Type arg : to.toList()) {
    2.94 +            for (Type arg : t.allparams()) {
    2.95                  Type bound = visit(arg);
    2.96                  if (arg != bound) {
    2.97                      changed = true;
    2.98 -                    bound = high ? makeExtendsWildcard(bound, (TypeVar)formals.head)
    2.99 -                              : makeSuperWildcard(bound, (TypeVar)formals.head);
   2.100                  }
   2.101                  rewritten.append(bound);
   2.102 -                formals = formals.tail;
   2.103              }
   2.104              if (changed)
   2.105 -                return subst(t.tsym.type, from.toList(), rewritten.toList());
   2.106 +                return subst(t.tsym.type,
   2.107 +                        t.tsym.type.allparams(),
   2.108 +                        rewritten.toList());
   2.109              else
   2.110                  return t;
   2.111          }
   2.112 @@ -3315,13 +3328,22 @@
   2.113  
   2.114          @Override
   2.115          public Type visitCapturedType(CapturedType t, Void s) {
   2.116 -            return visitWildcardType(t.wildcard, null);
   2.117 +            Type bound = visitWildcardType(t.wildcard, null);
   2.118 +            return (bound.contains(t)) ?
   2.119 +                    (high ? syms.objectType : syms.botType) :
   2.120 +                        bound;
   2.121          }
   2.122  
   2.123          @Override
   2.124          public Type visitTypeVar(TypeVar t, Void s) {
   2.125 -            if (rewriteTypeVars)
   2.126 -                return high ? t.bound : syms.botType;
   2.127 +            if (rewriteTypeVars) {
   2.128 +                Type bound = high ?
   2.129 +                    (t.bound.contains(t) ?
   2.130 +                        syms.objectType :
   2.131 +                        visit(t.bound)) :
   2.132 +                    syms.botType;
   2.133 +                return rewriteAsWildcardType(bound, t);
   2.134 +            }
   2.135              else
   2.136                  return t;
   2.137          }
   2.138 @@ -3331,11 +3353,31 @@
   2.139              Type bound = high ? t.getExtendsBound() :
   2.140                                  t.getSuperBound();
   2.141              if (bound == null)
   2.142 -                bound = high ? syms.objectType : syms.botType;
   2.143 -            return bound;
   2.144 +            bound = high ? syms.objectType : syms.botType;
   2.145 +            return rewriteAsWildcardType(visit(bound), t.bound);
   2.146 +        }
   2.147 +
   2.148 +        private Type rewriteAsWildcardType(Type bound, TypeVar formal) {
   2.149 +            return high ?
   2.150 +                makeExtendsWildcard(B(bound), formal) :
   2.151 +                makeSuperWildcard(B(bound), formal);
   2.152 +        }
   2.153 +
   2.154 +        Type B(Type t) {
   2.155 +            while (t.tag == WILDCARD) {
   2.156 +                WildcardType w = (WildcardType)t;
   2.157 +                t = high ?
   2.158 +                    w.getExtendsBound() :
   2.159 +                    w.getSuperBound();
   2.160 +                if (t == null) {
   2.161 +                    t = high ? syms.objectType : syms.botType;
   2.162 +                }
   2.163 +            }
   2.164 +            return t;
   2.165          }
   2.166      }
   2.167  
   2.168 +
   2.169      /**
   2.170       * Create a wildcard with the given upper (extends) bound; create
   2.171       * an unbounded wildcard if bound is Object.
     3.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Aug 19 15:13:23 2010 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Aug 23 19:14:55 2010 -0700
     3.3 @@ -675,24 +675,34 @@
     3.4  
     3.5              // Check that type parameters are well-formed.
     3.6              chk.validate(tree.typarams, localEnv);
     3.7 -            if ((owner.flags() & ANNOTATION) != 0 &&
     3.8 -                tree.typarams.nonEmpty())
     3.9 -                log.error(tree.typarams.head.pos(),
    3.10 -                          "intf.annotation.members.cant.have.type.params");
    3.11  
    3.12              // Check that result type is well-formed.
    3.13              chk.validate(tree.restype, localEnv);
    3.14 -            if ((owner.flags() & ANNOTATION) != 0)
    3.15 +
    3.16 +            // annotation method checks
    3.17 +            if ((owner.flags() & ANNOTATION) != 0) {
    3.18 +                // annotation method cannot have throws clause
    3.19 +                if (tree.thrown.nonEmpty()) {
    3.20 +                    log.error(tree.thrown.head.pos(),
    3.21 +                            "throws.not.allowed.in.intf.annotation");
    3.22 +                }
    3.23 +                // annotation method cannot declare type-parameters
    3.24 +                if (tree.typarams.nonEmpty()) {
    3.25 +                    log.error(tree.typarams.head.pos(),
    3.26 +                            "intf.annotation.members.cant.have.type.params");
    3.27 +                }
    3.28 +                // validate annotation method's return type (could be an annotation type)
    3.29                  chk.validateAnnotationType(tree.restype);
    3.30 -
    3.31 -            if ((owner.flags() & ANNOTATION) != 0)
    3.32 +                // ensure that annotation method does not clash with members of Object/Annotation
    3.33                  chk.validateAnnotationMethod(tree.pos(), m);
    3.34  
    3.35 -            // Check that all exceptions mentioned in the throws clause extend
    3.36 -            // java.lang.Throwable.
    3.37 -            if ((owner.flags() & ANNOTATION) != 0 && tree.thrown.nonEmpty())
    3.38 -                log.error(tree.thrown.head.pos(),
    3.39 -                          "throws.not.allowed.in.intf.annotation");
    3.40 +                if (tree.defaultValue != null) {
    3.41 +                    // if default value is an annotation, check it is a well-formed
    3.42 +                    // annotation value (e.g. no duplicate values, no missing values, etc.)
    3.43 +                    chk.validateAnnotationTree(tree.defaultValue);
    3.44 +                }
    3.45 +            }
    3.46 +
    3.47              for (List<JCExpression> l = tree.thrown; l.nonEmpty(); l = l.tail)
    3.48                  chk.checkType(l.head.pos(), l.head.type, syms.throwableType);
    3.49  
    3.50 @@ -1546,7 +1556,7 @@
    3.51          List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv);
    3.52  
    3.53          if (TreeInfo.isDiamond(tree)) {
    3.54 -            clazztype = attribDiamond(localEnv, tree, clazztype, mapping, argtypes, typeargtypes, true);
    3.55 +            clazztype = attribDiamond(localEnv, tree, clazztype, mapping, argtypes, typeargtypes);
    3.56              clazz.type = clazztype;
    3.57          }
    3.58  
    3.59 @@ -1586,13 +1596,15 @@
    3.60                  localEnv.info.varArgs = false;
    3.61                  tree.constructor = rs.resolveConstructor(
    3.62                      tree.pos(), localEnv, clazztype, argtypes, typeargtypes);
    3.63 -                tree.constructorType = checkMethod(clazztype,
    3.64 -                                                tree.constructor,
    3.65 -                                                localEnv,
    3.66 -                                                tree.args,
    3.67 -                                                argtypes,
    3.68 -                                                typeargtypes,
    3.69 -                                                localEnv.info.varArgs);
    3.70 +                tree.constructorType = tree.constructor.type.isErroneous() ?
    3.71 +                    syms.errType :
    3.72 +                    checkMethod(clazztype,
    3.73 +                        tree.constructor,
    3.74 +                        localEnv,
    3.75 +                        tree.args,
    3.76 +                        argtypes,
    3.77 +                        typeargtypes,
    3.78 +                        localEnv.info.varArgs);
    3.79                  if (localEnv.info.varArgs)
    3.80                      assert tree.constructorType.isErroneous() || tree.varargsElement != null;
    3.81              }
    3.82 @@ -1682,8 +1694,7 @@
    3.83                          Type clazztype,
    3.84                          Pair<Scope, Scope> mapping,
    3.85                          List<Type> argtypes,
    3.86 -                        List<Type> typeargtypes,
    3.87 -                        boolean reportErrors) {
    3.88 +                        List<Type> typeargtypes) {
    3.89          if (clazztype.isErroneous() || mapping == erroneousMapping) {
    3.90              //if the type of the instance creation expression is erroneous,
    3.91              //or something prevented us to form a valid mapping, return the
    3.92 @@ -1721,7 +1732,7 @@
    3.93                          env,
    3.94                          clazztype.tsym.type,
    3.95                          argtypes,
    3.96 -                        typeargtypes, reportErrors);
    3.97 +                        typeargtypes);
    3.98              } finally {
    3.99                  ((ClassSymbol) clazztype.tsym).members_field = mapping.fst;
   3.100              }
   3.101 @@ -1750,42 +1761,37 @@
   3.102                          Warner.noWarnings);
   3.103              } catch (Infer.InferenceException ex) {
   3.104                  //an error occurred while inferring uninstantiated type-variables
   3.105 -                //we need to optionally report an error
   3.106 -                if (reportErrors) {
   3.107 -                    log.error(tree.clazz.pos(),
   3.108 +                log.error(tree.clazz.pos(),
   3.109 +                        "cant.apply.diamond.1",
   3.110 +                        diags.fragment("diamond", clazztype.tsym),
   3.111 +                        ex.diagnostic);
   3.112 +            }
   3.113 +        }
   3.114 +        clazztype = chk.checkClassType(tree.clazz.pos(),
   3.115 +                clazztype,
   3.116 +                true);
   3.117 +        if (clazztype.tag == CLASS) {
   3.118 +            List<Type> invalidDiamondArgs = chk.checkDiamond((ClassType)clazztype);
   3.119 +            if (!clazztype.isErroneous() && invalidDiamondArgs.nonEmpty()) {
   3.120 +                //one or more types inferred in the previous steps is either a
   3.121 +                //captured type or an intersection type --- we need to report an error.
   3.122 +                String subkey = invalidDiamondArgs.size() > 1 ?
   3.123 +                    "diamond.invalid.args" :
   3.124 +                    "diamond.invalid.arg";
   3.125 +                //The error message is of the kind:
   3.126 +                //
   3.127 +                //cannot infer type arguments for {clazztype}<>;
   3.128 +                //reason: {subkey}
   3.129 +                //
   3.130 +                //where subkey is a fragment of the kind:
   3.131 +                //
   3.132 +                //type argument(s) {invalidDiamondArgs} inferred for {clazztype}<> is not allowed in this context
   3.133 +                log.error(tree.clazz.pos(),
   3.134                              "cant.apply.diamond.1",
   3.135                              diags.fragment("diamond", clazztype.tsym),
   3.136 -                            ex.diagnostic);
   3.137 -                }
   3.138 -            }
   3.139 -        }
   3.140 -        if (reportErrors) {
   3.141 -            clazztype = chk.checkClassType(tree.clazz.pos(),
   3.142 -                    clazztype,
   3.143 -                    true);
   3.144 -            if (clazztype.tag == CLASS) {
   3.145 -                List<Type> invalidDiamondArgs = chk.checkDiamond((ClassType)clazztype);
   3.146 -                if (!clazztype.isErroneous() && invalidDiamondArgs.nonEmpty()) {
   3.147 -                    //one or more types inferred in the previous steps is either a
   3.148 -                    //captured type or an intersection type --- we need to report an error.
   3.149 -                    String subkey = invalidDiamondArgs.size() > 1 ?
   3.150 -                        "diamond.invalid.args" :
   3.151 -                        "diamond.invalid.arg";
   3.152 -                    //The error message is of the kind:
   3.153 -                    //
   3.154 -                    //cannot infer type arguments for {clazztype}<>;
   3.155 -                    //reason: {subkey}
   3.156 -                    //
   3.157 -                    //where subkey is a fragment of the kind:
   3.158 -                    //
   3.159 -                    //type argument(s) {invalidDiamondArgs} inferred for {clazztype}<> is not allowed in this context
   3.160 -                    log.error(tree.clazz.pos(),
   3.161 -                                "cant.apply.diamond.1",
   3.162 -                                diags.fragment("diamond", clazztype.tsym),
   3.163 -                                diags.fragment(subkey,
   3.164 -                                               invalidDiamondArgs,
   3.165 -                                               diags.fragment("diamond", clazztype.tsym)));
   3.166 -                }
   3.167 +                            diags.fragment(subkey,
   3.168 +                                           invalidDiamondArgs,
   3.169 +                                           diags.fragment("diamond", clazztype.tsym)));
   3.170              }
   3.171          }
   3.172          return clazztype;
   3.173 @@ -2002,7 +2008,7 @@
   3.174  
   3.175      public void visitTypeCast(JCTypeCast tree) {
   3.176          Type clazztype = attribType(tree.clazz, env);
   3.177 -        chk.validate(tree.clazz, env);
   3.178 +        chk.validate(tree.clazz, env, false);
   3.179          Type exprtype = attribExpr(tree.expr, env, Infer.anyPoly);
   3.180          Type owntype = chk.checkCastable(tree.expr.pos(), exprtype, clazztype);
   3.181          if (exprtype.constValue() != null)
   3.182 @@ -2015,7 +2021,7 @@
   3.183              tree.expr.pos(), attribExpr(tree.expr, env));
   3.184          Type clazztype = chk.checkReifiableReferenceType(
   3.185              tree.clazz.pos(), attribType(tree.clazz, env));
   3.186 -        chk.validate(tree.clazz, env);
   3.187 +        chk.validate(tree.clazz, env, false);
   3.188          chk.checkCastable(tree.expr.pos(), exprtype, clazztype);
   3.189          result = check(tree, syms.booleanType, VAL, pkind, pt);
   3.190      }
     4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Aug 19 15:13:23 2010 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Aug 23 19:14:55 2010 -0700
     4.3 @@ -25,6 +25,7 @@
     4.4  
     4.5  package com.sun.tools.javac.comp;
     4.6  
     4.7 +import com.sun.source.tree.AssignmentTree;
     4.8  import java.util.*;
     4.9  import java.util.Set;
    4.10  
    4.11 @@ -329,7 +330,7 @@
    4.12              for (Scope.Entry e = s.next.lookup(c.name);
    4.13                   e.scope != null && e.sym.owner == c.owner;
    4.14                   e = e.next()) {
    4.15 -                if (e.sym.kind == TYP &&
    4.16 +                if (e.sym.kind == TYP && e.sym.type.tag != TYPEVAR &&
    4.17                      (e.sym.owner.kind & (VAR | MTH)) != 0 &&
    4.18                      c.name != names.error) {
    4.19                      duplicateError(pos, e.sym);
    4.20 @@ -905,33 +906,15 @@
    4.21       *
    4.22       *  and we can't make sure that the bound is already attributed because
    4.23       *  of possible cycles.
    4.24 -     */
    4.25 -    private Validator validator = new Validator();
    4.26 -
    4.27 -    /** Visitor method: Validate a type expression, if it is not null, catching
    4.28 +     *
    4.29 +     * Visitor method: Validate a type expression, if it is not null, catching
    4.30       *  and reporting any completion failures.
    4.31       */
    4.32      void validate(JCTree tree, Env<AttrContext> env) {
    4.33 -        try {
    4.34 -            if (tree != null) {
    4.35 -                validator.env = env;
    4.36 -                tree.accept(validator);
    4.37 -                checkRaw(tree, env);
    4.38 -            }
    4.39 -        } catch (CompletionFailure ex) {
    4.40 -            completionError(tree.pos(), ex);
    4.41 -        }
    4.42 +        validate(tree, env, true);
    4.43      }
    4.44 -    //where
    4.45 -    void checkRaw(JCTree tree, Env<AttrContext> env) {
    4.46 -        if (lint.isEnabled(Lint.LintCategory.RAW) &&
    4.47 -            tree.type.tag == CLASS &&
    4.48 -            !TreeInfo.isDiamond(tree) &&
    4.49 -            !env.enclClass.name.isEmpty() &&  //anonymous or intersection
    4.50 -            tree.type.isRaw()) {
    4.51 -            log.warning(Lint.LintCategory.RAW,
    4.52 -                    tree.pos(), "raw.class.use", tree.type, tree.type.tsym.type);
    4.53 -        }
    4.54 +    void validate(JCTree tree, Env<AttrContext> env, boolean checkRaw) {
    4.55 +        new Validator(env).validateTree(tree, checkRaw, true);
    4.56      }
    4.57  
    4.58      /** Visitor method: Validate a list of type expressions.
    4.59 @@ -945,9 +928,16 @@
    4.60       */
    4.61      class Validator extends JCTree.Visitor {
    4.62  
    4.63 +        boolean isOuter;
    4.64 +        Env<AttrContext> env;
    4.65 +
    4.66 +        Validator(Env<AttrContext> env) {
    4.67 +            this.env = env;
    4.68 +        }
    4.69 +
    4.70          @Override
    4.71          public void visitTypeArray(JCArrayTypeTree tree) {
    4.72 -            validate(tree.elemtype, env);
    4.73 +            tree.elemtype.accept(this);
    4.74          }
    4.75  
    4.76          @Override
    4.77 @@ -959,10 +949,14 @@
    4.78                  List<Type> forms = tree.type.tsym.type.getTypeArguments();
    4.79                  ListBuffer<Type> tvars_buf = new ListBuffer<Type>();
    4.80  
    4.81 +                boolean is_java_lang_Class = tree.type.tsym.flatName() == names.java_lang_Class;
    4.82 +
    4.83                  // For matching pairs of actual argument types `a' and
    4.84                  // formal type parameters with declared bound `b' ...
    4.85                  while (args.nonEmpty() && forms.nonEmpty()) {
    4.86 -                    validate(args.head, env);
    4.87 +                    validateTree(args.head,
    4.88 +                            !(isOuter && is_java_lang_Class),
    4.89 +                            false);
    4.90  
    4.91                      // exact type arguments needs to know their
    4.92                      // bounds (for upper and lower bound
    4.93 @@ -1014,14 +1008,14 @@
    4.94  
    4.95          @Override
    4.96          public void visitTypeParameter(JCTypeParameter tree) {
    4.97 -            validate(tree.bounds, env);
    4.98 +            validateTrees(tree.bounds, true, isOuter);
    4.99              checkClassBounds(tree.pos(), tree.type);
   4.100          }
   4.101  
   4.102          @Override
   4.103          public void visitWildcard(JCWildcard tree) {
   4.104              if (tree.inner != null)
   4.105 -                validate(tree.inner, env);
   4.106 +                validateTree(tree.inner, true, isOuter);
   4.107          }
   4.108  
   4.109          @Override
   4.110 @@ -1059,7 +1053,34 @@
   4.111          public void visitTree(JCTree tree) {
   4.112          }
   4.113  
   4.114 -        Env<AttrContext> env;
   4.115 +        public void validateTree(JCTree tree, boolean checkRaw, boolean isOuter) {
   4.116 +            try {
   4.117 +                if (tree != null) {
   4.118 +                    this.isOuter = isOuter;
   4.119 +                    tree.accept(this);
   4.120 +                    if (checkRaw)
   4.121 +                        checkRaw(tree, env);
   4.122 +                }
   4.123 +            } catch (CompletionFailure ex) {
   4.124 +                completionError(tree.pos(), ex);
   4.125 +            }
   4.126 +        }
   4.127 +
   4.128 +        public void validateTrees(List<? extends JCTree> trees, boolean checkRaw, boolean isOuter) {
   4.129 +            for (List<? extends JCTree> l = trees; l.nonEmpty(); l = l.tail)
   4.130 +                validateTree(l.head, checkRaw, isOuter);
   4.131 +        }
   4.132 +
   4.133 +        void checkRaw(JCTree tree, Env<AttrContext> env) {
   4.134 +            if (lint.isEnabled(Lint.LintCategory.RAW) &&
   4.135 +                tree.type.tag == CLASS &&
   4.136 +                !TreeInfo.isDiamond(tree) &&
   4.137 +                !env.enclClass.name.isEmpty() &&  //anonymous or intersection
   4.138 +                tree.type.isRaw()) {
   4.139 +                log.warning(Lint.LintCategory.RAW,
   4.140 +                        tree.pos(), "raw.class.use", tree.type, tree.type.tsym.type);
   4.141 +            }
   4.142 +        }
   4.143      }
   4.144  
   4.145  /* *************************************************************************
   4.146 @@ -1929,6 +1950,20 @@
   4.147   * Check annotations
   4.148   **************************************************************************/
   4.149  
   4.150 +    /**
   4.151 +     * Recursively validate annotations values
   4.152 +     */
   4.153 +    void validateAnnotationTree(JCTree tree) {
   4.154 +        class AnnotationValidator extends TreeScanner {
   4.155 +            @Override
   4.156 +            public void visitAnnotation(JCAnnotation tree) {
   4.157 +                super.visitAnnotation(tree);
   4.158 +                validateAnnotation(tree);
   4.159 +            }
   4.160 +        }
   4.161 +        tree.accept(new AnnotationValidator());
   4.162 +    }
   4.163 +
   4.164      /** Annotation types are restricted to primitives, String, an
   4.165       *  enum, an annotation, Class, Class<?>, Class<? extends
   4.166       *  Anything>, arrays of the preceding.
   4.167 @@ -1992,7 +2027,7 @@
   4.168      /** Check an annotation of a symbol.
   4.169       */
   4.170      public void validateAnnotation(JCAnnotation a, Symbol s) {
   4.171 -        validateAnnotation(a);
   4.172 +        validateAnnotationTree(a);
   4.173  
   4.174          if (!annotationApplicable(a, s))
   4.175              log.error(a.pos(), "annotation.type.not.applicable");
   4.176 @@ -2006,7 +2041,7 @@
   4.177      public void validateTypeAnnotation(JCTypeAnnotation a, boolean isTypeParameter) {
   4.178          if (a.type == null)
   4.179              throw new AssertionError("annotation tree hasn't been attributed yet: " + a);
   4.180 -        validateAnnotation(a);
   4.181 +        validateAnnotationTree(a);
   4.182  
   4.183          if (!isTypeAnnotation(a, isTypeParameter))
   4.184              log.error(a.pos(), "annotation.type.not.applicable");
   4.185 @@ -2103,8 +2138,12 @@
   4.186      public void validateAnnotation(JCAnnotation a) {
   4.187          if (a.type.isErroneous()) return;
   4.188  
   4.189 -        // collect an inventory of the members
   4.190 -        Set<MethodSymbol> members = new HashSet<MethodSymbol>();
   4.191 +        // collect an inventory of the members (sorted alphabetically)
   4.192 +        Set<MethodSymbol> members = new TreeSet<MethodSymbol>(new Comparator<Symbol>() {
   4.193 +            public int compare(Symbol t, Symbol t1) {
   4.194 +                return t.name.compareTo(t1.name);
   4.195 +            }
   4.196 +        });
   4.197          for (Scope.Entry e = a.annotationType.type.tsym.members().elems;
   4.198               e != null;
   4.199               e = e.sibling)
   4.200 @@ -2120,15 +2159,21 @@
   4.201              if (!members.remove(m))
   4.202                  log.error(assign.lhs.pos(), "duplicate.annotation.member.value",
   4.203                            m.name, a.type);
   4.204 -            if (assign.rhs.getTag() == ANNOTATION)
   4.205 -                validateAnnotation((JCAnnotation)assign.rhs);
   4.206          }
   4.207  
   4.208          // all the remaining ones better have default values
   4.209 -        for (MethodSymbol m : members)
   4.210 -            if (m.defaultValue == null && !m.type.isErroneous())
   4.211 -                log.error(a.pos(), "annotation.missing.default.value",
   4.212 -                          a.type, m.name);
   4.213 +        ListBuffer<Name> missingDefaults = ListBuffer.lb();
   4.214 +        for (MethodSymbol m : members) {
   4.215 +            if (m.defaultValue == null && !m.type.isErroneous()) {
   4.216 +                missingDefaults.append(m.name);
   4.217 +            }
   4.218 +        }
   4.219 +        if (missingDefaults.nonEmpty()) {
   4.220 +            String key = (missingDefaults.size() > 1)
   4.221 +                    ? "annotation.missing.default.value.1"
   4.222 +                    : "annotation.missing.default.value";
   4.223 +            log.error(a.pos(), key, a.type, missingDefaults);
   4.224 +        }
   4.225  
   4.226          // special case: java.lang.annotation.Target must not have
   4.227          // repeated values in its value member
     5.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Aug 19 15:13:23 2010 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Mon Aug 23 19:14:55 2010 -0700
     5.3 @@ -138,24 +138,73 @@
     5.4      /** A mapping that returns its type argument with every UndetVar replaced
     5.5       *  by its `inst' field. Throws a NoInstanceException
     5.6       *  if this not possible because an `inst' field is null.
     5.7 +     *  Note: mutually referring undertvars will be left uninstantiated
     5.8 +     *  (that is, they will be replaced by the underlying type-variable).
     5.9       */
    5.10 +
    5.11      Mapping getInstFun = new Mapping("getInstFun") {
    5.12              public Type apply(Type t) {
    5.13                  switch (t.tag) {
    5.14 -                case UNKNOWN:
    5.15 -                    throw ambiguousNoInstanceException
    5.16 -                        .setMessage("undetermined.type");
    5.17 -                case UNDETVAR:
    5.18 -                    UndetVar that = (UndetVar) t;
    5.19 -                    if (that.inst == null)
    5.20 +                    case UNKNOWN:
    5.21                          throw ambiguousNoInstanceException
    5.22 -                            .setMessage("type.variable.has.undetermined.type",
    5.23 -                                        that.qtype);
    5.24 -                    return apply(that.inst);
    5.25 -                default:
    5.26 -                    return t.map(this);
    5.27 +                            .setMessage("undetermined.type");
    5.28 +                    case UNDETVAR:
    5.29 +                        UndetVar that = (UndetVar) t;
    5.30 +                        if (that.inst == null)
    5.31 +                            throw ambiguousNoInstanceException
    5.32 +                                .setMessage("type.variable.has.undetermined.type",
    5.33 +                                            that.qtype);
    5.34 +                        return isConstraintCyclic(that) ?
    5.35 +                            that.qtype :
    5.36 +                            apply(that.inst);
    5.37 +                        default:
    5.38 +                            return t.map(this);
    5.39                  }
    5.40              }
    5.41 +
    5.42 +            private boolean isConstraintCyclic(UndetVar uv) {
    5.43 +                Types.UnaryVisitor<Boolean> constraintScanner =
    5.44 +                        new Types.UnaryVisitor<Boolean>() {
    5.45 +
    5.46 +                    List<Type> seen = List.nil();
    5.47 +
    5.48 +                    Boolean visit(List<Type> ts) {
    5.49 +                        for (Type t : ts) {
    5.50 +                            if (visit(t)) return true;
    5.51 +                        }
    5.52 +                        return false;
    5.53 +                    }
    5.54 +
    5.55 +                    public Boolean visitType(Type t, Void ignored) {
    5.56 +                        return false;
    5.57 +                    }
    5.58 +
    5.59 +                    @Override
    5.60 +                    public Boolean visitClassType(ClassType t, Void ignored) {
    5.61 +                        if (t.isCompound()) {
    5.62 +                            return visit(types.supertype(t)) ||
    5.63 +                                    visit(types.interfaces(t));
    5.64 +                        } else {
    5.65 +                            return visit(t.getTypeArguments());
    5.66 +                        }
    5.67 +                    }
    5.68 +                    @Override
    5.69 +                    public Boolean visitWildcardType(WildcardType t, Void ignored) {
    5.70 +                        return visit(t.type);
    5.71 +                    }
    5.72 +
    5.73 +                    @Override
    5.74 +                    public Boolean visitUndetVar(UndetVar t, Void ignored) {
    5.75 +                        if (seen.contains(t)) {
    5.76 +                            return true;
    5.77 +                        } else {
    5.78 +                            seen = seen.prepend(t);
    5.79 +                            return visit(t.inst);
    5.80 +                        }
    5.81 +                    }
    5.82 +                };
    5.83 +                return constraintScanner.visit(uv);
    5.84 +            }
    5.85          };
    5.86  
    5.87  /***************************************************************************
    5.88 @@ -257,10 +306,9 @@
    5.89              TypeVar tv = (TypeVar)uv.qtype;
    5.90              ListBuffer<Type> hibounds = new ListBuffer<Type>();
    5.91              for (Type t : that.getConstraints(tv, ConstraintKind.EXTENDS)) {
    5.92 -                if (!t.containsSome(that.tvars) && t.tag != BOT) {
    5.93 -                    hibounds.append(t);
    5.94 -                }
    5.95 +                hibounds.append(types.subst(t, that.tvars, undetvars));
    5.96              }
    5.97 +
    5.98              List<Type> inst = that.getConstraints(tv, ConstraintKind.EQUAL);
    5.99              if (inst.nonEmpty() && inst.head.tag != BOT) {
   5.100                  uv.inst = inst.head;
   5.101 @@ -279,9 +327,32 @@
   5.102  
   5.103          // check bounds
   5.104          List<Type> targs = Type.map(undetvars, getInstFun);
   5.105 -        targs = types.subst(targs, that.tvars, targs);
   5.106 +        if (Type.containsAny(targs, that.tvars)) {
   5.107 +            //replace uninferred type-vars
   5.108 +            targs = types.subst(targs,
   5.109 +                    that.tvars,
   5.110 +                    instaniateAsUninferredVars(undetvars, that.tvars));
   5.111 +        }
   5.112          return chk.checkType(warn.pos(), that.inst(targs, types), to);
   5.113      }
   5.114 +    //where
   5.115 +    private List<Type> instaniateAsUninferredVars(List<Type> undetvars, List<Type> tvars) {
   5.116 +        ListBuffer<Type> new_targs = ListBuffer.lb();
   5.117 +        //step 1 - create syntethic captured vars
   5.118 +        for (Type t : undetvars) {
   5.119 +            UndetVar uv = (UndetVar)t;
   5.120 +            Type newArg = new CapturedType(t.tsym.name, t.tsym, uv.inst, syms.botType, null);
   5.121 +            new_targs = new_targs.append(newArg);
   5.122 +        }
   5.123 +        //step 2 - replace synthetic vars in their bounds
   5.124 +        for (Type t : new_targs.toList()) {
   5.125 +            CapturedType ct = (CapturedType)t;
   5.126 +            ct.bound = types.subst(ct.bound, tvars, new_targs.toList());
   5.127 +            WildcardType wt = new WildcardType(ct.bound, BoundKind.EXTENDS, syms.boundClass);
   5.128 +            ct.wildcard = wt;
   5.129 +        }
   5.130 +        return new_targs.toList();
   5.131 +    }
   5.132  
   5.133      /** Instantiate method type `mt' by finding instantiations of
   5.134       *  `tvars' so that method can be applied to `argtypes'.
     6.1 --- a/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Thu Aug 19 15:13:23 2010 -0700
     6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/MemberEnter.java	Mon Aug 23 19:14:55 2010 -0700
     6.3 @@ -1079,14 +1079,21 @@
     6.4  
     6.5  
     6.6      private Env<AttrContext> baseEnv(JCClassDecl tree, Env<AttrContext> env) {
     6.7 -        Scope typaramScope = new Scope(tree.sym);
     6.8 +        Scope baseScope = new Scope(tree.sym);
     6.9 +        //import already entered local classes into base scope
    6.10 +        for (Scope.Entry e = env.outer.info.scope.elems ; e != null ; e = e.sibling) {
    6.11 +            if (e.sym.isLocal()) {
    6.12 +                baseScope.enter(e.sym);
    6.13 +            }
    6.14 +        }
    6.15 +        //import current type-parameters into base scope
    6.16          if (tree.typarams != null)
    6.17              for (List<JCTypeParameter> typarams = tree.typarams;
    6.18                   typarams.nonEmpty();
    6.19                   typarams = typarams.tail)
    6.20 -                typaramScope.enter(typarams.head.type.tsym);
    6.21 +                baseScope.enter(typarams.head.type.tsym);
    6.22          Env<AttrContext> outer = env.outer; // the base clause can't see members of this class
    6.23 -        Env<AttrContext> localEnv = outer.dup(tree, outer.info.dup(typaramScope));
    6.24 +        Env<AttrContext> localEnv = outer.dup(tree, outer.info.dup(baseScope));
    6.25          localEnv.baseClause = true;
    6.26          localEnv.outer = outer;
    6.27          localEnv.info.isSelfCall = false;
     7.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Aug 19 15:13:23 2010 -0700
     7.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Mon Aug 23 19:14:55 2010 -0700
     7.3 @@ -40,6 +40,8 @@
     7.4  import static com.sun.tools.javac.code.Flags.*;
     7.5  import static com.sun.tools.javac.code.Kinds.*;
     7.6  import static com.sun.tools.javac.code.TypeTags.*;
     7.7 +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
     7.8 +import com.sun.tools.javac.util.JCDiagnostic.DiagnosticType;
     7.9  import javax.lang.model.element.ElementVisitor;
    7.10  
    7.11  import java.util.Map;
    7.12 @@ -1447,7 +1449,7 @@
    7.13                                Env<AttrContext> env,
    7.14                                Type site,
    7.15                                List<Type> argtypes,
    7.16 -                              List<Type> typeargtypes, boolean reportErrors) {
    7.17 +                              List<Type> typeargtypes) {
    7.18          Symbol sym = methodNotFound;
    7.19          JCDiagnostic explanation = null;
    7.20          List<MethodResolutionPhase> steps = methodResolutionSteps;
    7.21 @@ -1466,11 +1468,20 @@
    7.22              }
    7.23              steps = steps.tail;
    7.24          }
    7.25 -        if (sym.kind >= AMBIGUOUS && reportErrors) {
    7.26 -            String key = explanation == null ?
    7.27 -                "cant.apply.diamond" :
    7.28 -                "cant.apply.diamond.1";
    7.29 -            log.error(pos, key, diags.fragment("diamond", site.tsym), explanation);
    7.30 +        if (sym.kind >= AMBIGUOUS) {
    7.31 +            final JCDiagnostic details = explanation;
    7.32 +            Symbol errSym = new ResolveError(WRONG_MTH, "diamond error") {
    7.33 +                @Override
    7.34 +                JCDiagnostic getDiagnostic(DiagnosticType dkind, DiagnosticPosition pos, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) {
    7.35 +                    String key = details == null ?
    7.36 +                        "cant.apply.diamond" :
    7.37 +                        "cant.apply.diamond.1";
    7.38 +                    return diags.create(dkind, log.currentSource(), pos, key, diags.fragment("diamond", site.tsym), details);
    7.39 +                }
    7.40 +            };
    7.41 +            MethodResolutionPhase errPhase = firstErroneousResolutionPhase();
    7.42 +            sym = access(errSym, pos, site, names.init, true, argtypes, typeargtypes);
    7.43 +            env.info.varArgs = errPhase.isVarargsRequired();
    7.44          }
    7.45          return sym;
    7.46      }
    7.47 @@ -1655,8 +1666,10 @@
    7.48              List<Type> typeargtypes) {
    7.49          JCDiagnostic d = error.getDiagnostic(JCDiagnostic.DiagnosticType.ERROR,
    7.50                  pos, site, name, argtypes, typeargtypes);
    7.51 -        if (d != null)
    7.52 +        if (d != null) {
    7.53 +            d.setFlag(DiagnosticFlag.RESOLVE_ERROR);
    7.54              log.report(d);
    7.55 +        }
    7.56      }
    7.57  
    7.58      private final LocalizedString noArgs = new LocalizedString("compiler.misc.no.args");
     8.1 --- a/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Thu Aug 19 15:13:23 2010 -0700
     8.2 +++ b/src/share/classes/com/sun/tools/javac/jvm/Gen.java	Mon Aug 23 19:14:55 2010 -0700
     8.3 @@ -1455,24 +1455,27 @@
     8.4                        List<Integer> gaps) {
     8.5              if (startpc != endpc) {
     8.6                  List<JCExpression> subClauses = TreeInfo.isMultiCatch(tree) ?
     8.7 -                    ((JCTypeDisjoint)tree.param.vartype).components :
     8.8 -                    List.of(tree.param.vartype);
     8.9 -                for (JCExpression subCatch : subClauses) {
    8.10 -                    int catchType = makeRef(tree.pos(), subCatch.type);
    8.11 -                    List<Integer> lGaps = gaps;
    8.12 -                    while (lGaps.nonEmpty()) {
    8.13 -                        int end = lGaps.head.intValue();
    8.14 +                        ((JCTypeDisjoint)tree.param.vartype).components :
    8.15 +                        List.of(tree.param.vartype);
    8.16 +                while (gaps.nonEmpty()) {
    8.17 +                    for (JCExpression subCatch : subClauses) {
    8.18 +                        int catchType = makeRef(tree.pos(), subCatch.type);
    8.19 +                        int end = gaps.head.intValue();
    8.20                          registerCatch(tree.pos(),
    8.21                                        startpc,  end, code.curPc(),
    8.22                                        catchType);
    8.23 -                        lGaps = lGaps.tail;
    8.24 -                        startpc = lGaps.head.intValue();
    8.25 -                        lGaps = lGaps.tail;
    8.26                      }
    8.27 -                    if (startpc < endpc)
    8.28 +                    gaps = gaps.tail;
    8.29 +                    startpc = gaps.head.intValue();
    8.30 +                    gaps = gaps.tail;
    8.31 +                }
    8.32 +                if (startpc < endpc) {
    8.33 +                    for (JCExpression subCatch : subClauses) {
    8.34 +                        int catchType = makeRef(tree.pos(), subCatch.type);
    8.35                          registerCatch(tree.pos(),
    8.36                                        startpc, endpc, code.curPc(),
    8.37                                        catchType);
    8.38 +                    }
    8.39                  }
    8.40                  VarSymbol exparam = tree.param.sym;
    8.41                  code.statBegin(tree.pos);
     9.1 --- a/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Thu Aug 19 15:13:23 2010 -0700
     9.2 +++ b/src/share/classes/com/sun/tools/javac/main/JavaCompiler.java	Mon Aug 23 19:14:55 2010 -0700
     9.3 @@ -529,7 +529,7 @@
     9.4                  log.error("warnings.and.werror");
     9.5              }
     9.6          }
     9.7 -            return log.nerrors;
     9.8 +        return log.nerrors;
     9.9      }
    9.10  
    9.11      protected final <T> Queue<T> stopIfError(CompileState cs, Queue<T> queue) {
    9.12 @@ -868,7 +868,7 @@
    9.13      /**
    9.14       * Parses a list of files.
    9.15       */
    9.16 -   public List<JCCompilationUnit> parseFiles(List<JavaFileObject> fileObjects) throws IOException {
    9.17 +   public List<JCCompilationUnit> parseFiles(Iterable<JavaFileObject> fileObjects) throws IOException {
    9.18         if (shouldStop(CompileState.PARSE))
    9.19             return List.nil();
    9.20  
    9.21 @@ -981,14 +981,13 @@
    9.22       */
    9.23      public JavaCompiler processAnnotations(List<JCCompilationUnit> roots,
    9.24                                             List<String> classnames)
    9.25 -        throws IOException  { // TODO: see TEMP note in JavacProcessingEnvironment
    9.26 +            throws IOException  { // TODO: see TEMP note in JavacProcessingEnvironment
    9.27          if (shouldStop(CompileState.PROCESS)) {
    9.28 -            // Errors were encountered.  If todo is empty, then the
    9.29 -            // encountered errors were parse errors.  Otherwise, the
    9.30 -            // errors were found during the enter phase which should
    9.31 -            // be ignored when processing annotations.
    9.32 -
    9.33 -            if (todo.isEmpty())
    9.34 +            // Errors were encountered.
    9.35 +            // If log.unrecoverableError is set, the errors were parse errors
    9.36 +            // or other errors during enter which cannot be fixed by running
    9.37 +            // any annotation processors.
    9.38 +            if (log.unrecoverableError)
    9.39                  return this;
    9.40          }
    9.41  
    10.1 --- a/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Thu Aug 19 15:13:23 2010 -0700
    10.2 +++ b/src/share/classes/com/sun/tools/javac/processing/JavacProcessingEnvironment.java	Mon Aug 23 19:14:55 2010 -0700
    10.3 @@ -795,6 +795,13 @@
    10.4          final JavaCompiler compiler;
    10.5          /** The log for the round. */
    10.6          final Log log;
    10.7 +        /** The number of warnings in the previous round. */
    10.8 +        final int priorWarnings;
    10.9 +
   10.10 +        /** The ASTs to be compiled. */
   10.11 +        List<JCCompilationUnit> roots;
   10.12 +        /** The classes to be compiler that have were generated. */
   10.13 +        Map<String, JavaFileObject> genClassFiles;
   10.14  
   10.15          /** The set of annotations to be processed this round. */
   10.16          Set<TypeElement> annotationsPresent;
   10.17 @@ -803,10 +810,12 @@
   10.18          /** The set of package-info files to be processed this round. */
   10.19          List<PackageSymbol> packageInfoFiles;
   10.20  
   10.21 -        /** Create a round. */
   10.22 -        Round(Context context, int number) {
   10.23 +        /** Create a round (common code). */
   10.24 +        private Round(Context context, int number, int priorWarnings) {
   10.25              this.context = context;
   10.26              this.number = number;
   10.27 +            this.priorWarnings = priorWarnings;
   10.28 +
   10.29              compiler = JavaCompiler.instance(context);
   10.30              log = Log.instance(context);
   10.31  
   10.32 @@ -814,15 +823,86 @@
   10.33              JavacProcessingEnvironment.this.context = context;
   10.34  
   10.35              // the following will be populated as needed
   10.36 -            annotationsPresent = new LinkedHashSet<TypeElement>();
   10.37              topLevelClasses  = List.nil();
   10.38              packageInfoFiles = List.nil();
   10.39          }
   10.40  
   10.41 +        /** Create the first round. */
   10.42 +        Round(Context context, List<JCCompilationUnit> roots, List<ClassSymbol> classSymbols) {
   10.43 +            this(context, 1, 0);
   10.44 +            this.roots = roots;
   10.45 +            genClassFiles = new HashMap<String,JavaFileObject>();
   10.46 +
   10.47 +            compiler.todo.clear(); // free the compiler's resources
   10.48 +
   10.49 +            // The reverse() in the following line is to maintain behavioural
   10.50 +            // compatibility with the previous revision of the code. Strictly speaking,
   10.51 +            // it should not be necessary, but a javah golden file test fails without it.
   10.52 +            topLevelClasses =
   10.53 +                getTopLevelClasses(roots).prependList(classSymbols.reverse());
   10.54 +
   10.55 +            packageInfoFiles = getPackageInfoFiles(roots);
   10.56 +
   10.57 +            findAnnotationsPresent();
   10.58 +        }
   10.59 +
   10.60 +        /** Create a new round. */
   10.61 +        private Round(Round prev,
   10.62 +                Set<JavaFileObject> newSourceFiles, Map<String,JavaFileObject> newClassFiles)
   10.63 +                throws IOException {
   10.64 +            this(prev.nextContext(), prev.number+1, prev.compiler.log.nwarnings);
   10.65 +            this.genClassFiles = prev.genClassFiles;
   10.66 +
   10.67 +            updateProcessingState();
   10.68 +
   10.69 +            List<JCCompilationUnit> parsedFiles = compiler.parseFiles(newSourceFiles);
   10.70 +            roots = cleanTrees(prev.roots).appendList(parsedFiles);
   10.71 +
   10.72 +            // Check for errors after parsing
   10.73 +            if (unrecoverableError())
   10.74 +                return;
   10.75 +
   10.76 +            enterClassFiles(genClassFiles);
   10.77 +            List<ClassSymbol> newClasses = enterClassFiles(newClassFiles);
   10.78 +            genClassFiles.putAll(newClassFiles);
   10.79 +            enterTrees(roots);
   10.80 +
   10.81 +            if (unrecoverableError())
   10.82 +                return;
   10.83 +
   10.84 +            topLevelClasses = join(
   10.85 +                    getTopLevelClasses(parsedFiles),
   10.86 +                    getTopLevelClassesFromClasses(newClasses));
   10.87 +
   10.88 +            packageInfoFiles = join(
   10.89 +                    getPackageInfoFiles(parsedFiles),
   10.90 +                    getPackageInfoFilesFromClasses(newClasses));
   10.91 +
   10.92 +            findAnnotationsPresent();
   10.93 +        }
   10.94 +
   10.95          /** Create the next round to be used. */
   10.96 -        Round next() {
   10.97 -            compiler.close(false);
   10.98 -            return new Round(contextForNextRound(), number + 1);
   10.99 +        Round next(Set<JavaFileObject> newSourceFiles, Map<String, JavaFileObject> newClassFiles)
  10.100 +                throws IOException {
  10.101 +            try {
  10.102 +                return new Round(this, newSourceFiles, newClassFiles);
  10.103 +            } finally {
  10.104 +                compiler.close(false);
  10.105 +            }
  10.106 +        }
  10.107 +
  10.108 +        /** Create the compiler to be used for the final compilation. */
  10.109 +        JavaCompiler finalCompiler(boolean errorStatus) {
  10.110 +            try {
  10.111 +                JavaCompiler c = JavaCompiler.instance(nextContext());
  10.112 +                if (errorStatus) {
  10.113 +                    c.log.nwarnings += priorWarnings + compiler.log.nwarnings;
  10.114 +                    c.log.nerrors += compiler.log.nerrors;
  10.115 +                }
  10.116 +                return c;
  10.117 +            } finally {
  10.118 +                compiler.close(false);
  10.119 +            }
  10.120          }
  10.121  
  10.122          /** Return the number of errors found so far in this round.
  10.123 @@ -839,12 +919,16 @@
  10.124  
  10.125          /** Return whether or not an unrecoverable error has occurred. */
  10.126          boolean unrecoverableError() {
  10.127 -            return log.unrecoverableError;
  10.128 +            return log.unrecoverableError
  10.129 +                    || messager.errorRaised()
  10.130 +                    || (werror && log.nwarnings > 0)
  10.131 +                    || (fatalErrors && log.nerrors > 0);
  10.132          }
  10.133  
  10.134          /** Find the set of annotations present in the set of top level
  10.135 -         * classes and package info files to be processed this round. */
  10.136 -        void findAnnotationsPresent(ComputeAnnotationSet annotationComputer) {
  10.137 +         *  classes and package info files to be processed this round. */
  10.138 +        void findAnnotationsPresent() {
  10.139 +            ComputeAnnotationSet annotationComputer = new ComputeAnnotationSet(elementUtils);
  10.140              // Use annotation processing to compute the set of annotations present
  10.141              annotationsPresent = new LinkedHashSet<TypeElement>();
  10.142              for (ClassSymbol classSym : topLevelClasses)
  10.143 @@ -853,26 +937,13 @@
  10.144                  annotationComputer.scan(pkgSym, annotationsPresent);
  10.145          }
  10.146  
  10.147 -        /**
  10.148 -         * Parse the latest set of generated source files created by the filer.
  10.149 -         */
  10.150 -        List<JCCompilationUnit> parseNewSourceFiles()
  10.151 -            throws IOException {
  10.152 -            List<JavaFileObject> fileObjects = List.nil();
  10.153 -            for (JavaFileObject jfo : filer.getGeneratedSourceFileObjects() ) {
  10.154 -                fileObjects = fileObjects.prepend(jfo);
  10.155 -            }
  10.156 -
  10.157 -           return compiler.parseFiles(fileObjects);
  10.158 -        }
  10.159 -
  10.160 -        /** Enter the latest set of generated class files created by the filer. */
  10.161 -        List<ClassSymbol> enterNewClassFiles() {
  10.162 +        /** Enter a set of generated class files. */
  10.163 +        List<ClassSymbol> enterClassFiles(Map<String, JavaFileObject> classFiles) {
  10.164              ClassReader reader = ClassReader.instance(context);
  10.165              Names names = Names.instance(context);
  10.166              List<ClassSymbol> list = List.nil();
  10.167  
  10.168 -            for (Map.Entry<String,JavaFileObject> entry : filer.getGeneratedClasses().entrySet()) {
  10.169 +            for (Map.Entry<String,JavaFileObject> entry : classFiles.entrySet()) {
  10.170                  Name name = names.fromString(entry.getKey());
  10.171                  JavaFileObject file = entry.getValue();
  10.172                  if (file.getKind() != JavaFileObject.Kind.CLASS)
  10.173 @@ -900,11 +971,7 @@
  10.174  
  10.175          /** Run a processing round. */
  10.176          void run(boolean lastRound, boolean errorStatus) {
  10.177 -//            assert lastRound
  10.178 -//                ? (topLevelClasses.size() == 0 && annotationsPresent.size() == 0)
  10.179 -//                : (errorStatus == false);
  10.180 -//
  10.181 -//            printRoundInfo(topLevelClasses, annotationsPresent, lastRound);
  10.182 +            printRoundInfo(lastRound);
  10.183  
  10.184              TaskListener taskListener = context.get(TaskListener.class);
  10.185              if (taskListener != null)
  10.186 @@ -912,7 +979,6 @@
  10.187  
  10.188              try {
  10.189                  if (lastRound) {
  10.190 -                    printRoundInfo(List.<ClassSymbol>nil(), Collections.<TypeElement>emptySet(), lastRound);
  10.191                      filer.setLastRound(true);
  10.192                      Set<Element> emptyRootElements = Collections.emptySet(); // immutable
  10.193                      RoundEnvironment renv = new JavacRoundEnvironment(true,
  10.194 @@ -921,7 +987,6 @@
  10.195                              JavacProcessingEnvironment.this);
  10.196                      discoveredProcs.iterator().runContributingProcs(renv);
  10.197                  } else {
  10.198 -                    printRoundInfo(topLevelClasses, annotationsPresent, lastRound);
  10.199                      discoverAndRunProcs(context, annotationsPresent, topLevelClasses, packageInfoFiles);
  10.200                  }
  10.201              } finally {
  10.202 @@ -931,11 +996,7 @@
  10.203          }
  10.204  
  10.205          /** Update the processing state for the current context. */
  10.206 -        // Question: should this not be part of next()?
  10.207 -        // Note: Calling it from next() breaks some tests. There is an issue
  10.208 -        // whether the annotationComputer is using elementUtils with the
  10.209 -        // correct context.
  10.210 -        void updateProcessingState() {
  10.211 +        private void updateProcessingState() {
  10.212              filer.newRound(context);
  10.213              messager.newRound(context);
  10.214  
  10.215 @@ -944,14 +1005,14 @@
  10.216          }
  10.217  
  10.218          /** Print info about this round. */
  10.219 -        private void printRoundInfo(List<ClassSymbol> topLevelClasses,
  10.220 -                Set<TypeElement> annotationsPresent,
  10.221 -                boolean lastRound) {
  10.222 +        private void printRoundInfo(boolean lastRound) {
  10.223              if (printRounds || verbose) {
  10.224 +                List<ClassSymbol> tlc = lastRound ? List.<ClassSymbol>nil() : topLevelClasses;
  10.225 +                Set<TypeElement> ap = lastRound ? Collections.<TypeElement>emptySet() : annotationsPresent;
  10.226                  log.printNoteLines("x.print.rounds",
  10.227 -                        (!lastRound ? number : number + 1),
  10.228 -                        "{" + topLevelClasses.toString(", ") + "}",
  10.229 -                        annotationsPresent,
  10.230 +                        number,
  10.231 +                        "{" + tlc.toString(", ") + "}",
  10.232 +                        ap,
  10.233                          lastRound);
  10.234              }
  10.235          }
  10.236 @@ -960,7 +1021,7 @@
  10.237           * Important values are propogated from round to round;
  10.238           * other values are implicitly reset.
  10.239           */
  10.240 -        private Context contextForNextRound() {
  10.241 +        private Context nextContext() {
  10.242              Context next = new Context();
  10.243  
  10.244              Options options = Options.instance(context);
  10.245 @@ -1025,138 +1086,90 @@
  10.246                                       Iterable<? extends PackageSymbol> pckSymbols)
  10.247          throws IOException {
  10.248  
  10.249 +        TaskListener taskListener = context.get(TaskListener.class);
  10.250          log = Log.instance(context);
  10.251  
  10.252 -        Round round = new Round(context, 1);
  10.253 -        round.compiler.todo.clear(); // free the compiler's resources
  10.254 -
  10.255 -        // The reverse() in the following line is to maintain behavioural
  10.256 -        // compatibility with the previous revision of the code. Strictly speaking,
  10.257 -        // it should not be necessary, but a javah golden file test fails without it.
  10.258 -        round.topLevelClasses =
  10.259 -                getTopLevelClasses(roots).prependList(classSymbols.reverse());
  10.260 -
  10.261 -        round.packageInfoFiles = getPackageInfoFiles(roots);
  10.262 -
  10.263          Set<PackageSymbol> specifiedPackages = new LinkedHashSet<PackageSymbol>();
  10.264          for (PackageSymbol psym : pckSymbols)
  10.265              specifiedPackages.add(psym);
  10.266          this.specifiedPackages = Collections.unmodifiableSet(specifiedPackages);
  10.267  
  10.268 -        ComputeAnnotationSet annotationComputer = new ComputeAnnotationSet(elementUtils);
  10.269 -        round.findAnnotationsPresent(annotationComputer);
  10.270 +        Round round = new Round(context, roots, classSymbols);
  10.271  
  10.272 -        boolean errorStatus = false;
  10.273 -
  10.274 -        runAround:
  10.275 -        while (true) {
  10.276 -            if ((fatalErrors && round.errorCount() != 0)
  10.277 -                    || (werror && round.warningCount() != 0)) {
  10.278 -                errorStatus = true;
  10.279 -                break runAround;
  10.280 -            }
  10.281 -
  10.282 +        boolean errorStatus;
  10.283 +        boolean moreToDo;
  10.284 +        do {
  10.285 +            // Run processors for round n
  10.286              round.run(false, false);
  10.287  
  10.288 -            /*
  10.289 -             * Processors for round n have run to completion.  Prepare
  10.290 -             * for round (n+1) by checked for errors raised by
  10.291 -             * annotation processors and then checking for syntax
  10.292 -             * errors on any generated source files.
  10.293 -             */
  10.294 -            if (messager.errorRaised()) {
  10.295 +            // Processors for round n have run to completion.
  10.296 +            // Check for errors and whether there is more work to do.
  10.297 +            errorStatus = round.unrecoverableError();
  10.298 +            moreToDo = moreToDo();
  10.299 +
  10.300 +            // Set up next round.
  10.301 +            // Copy mutable collections returned from filer.
  10.302 +            round = round.next(
  10.303 +                    new LinkedHashSet<JavaFileObject>(filer.getGeneratedSourceFileObjects()),
  10.304 +                    new LinkedHashMap<String,JavaFileObject>(filer.getGeneratedClasses()));
  10.305 +
  10.306 +             // Check for errors during setup.
  10.307 +            if (round.unrecoverableError())
  10.308                  errorStatus = true;
  10.309 -                break runAround;
  10.310 -            }
  10.311  
  10.312 -            if (!moreToDo())
  10.313 -                break runAround; // No new files
  10.314 -
  10.315 -            round = round.next();
  10.316 -
  10.317 -            List<JCCompilationUnit> parsedFiles = round.parseNewSourceFiles();
  10.318 -            roots = cleanTrees(roots).appendList(parsedFiles);
  10.319 -
  10.320 -            // Check for errors after parsing
  10.321 -            if (round.unrecoverableError()) {
  10.322 -                errorStatus = true;
  10.323 -                break runAround;
  10.324 -            }
  10.325 -
  10.326 -            List<ClassSymbol> newClasses = round.enterNewClassFiles();
  10.327 -            round.enterTrees(roots);
  10.328 -
  10.329 -            round.topLevelClasses = join(
  10.330 -                    getTopLevelClasses(parsedFiles),
  10.331 -                    getTopLevelClassesFromClasses(newClasses));
  10.332 -
  10.333 -            round.packageInfoFiles = join(
  10.334 -                    getPackageInfoFiles(parsedFiles),
  10.335 -                    getPackageInfoFilesFromClasses(newClasses));
  10.336 -
  10.337 -            round.findAnnotationsPresent(annotationComputer);
  10.338 -            round.updateProcessingState();
  10.339 -        }
  10.340 +        } while (moreToDo && !errorStatus);
  10.341  
  10.342          // run last round
  10.343          round.run(true, errorStatus);
  10.344  
  10.345 -        // Add any sources generated during the last round to the set
  10.346 -        // of files to be compiled.
  10.347 -        if (moreToDo()) {
  10.348 -            List<JCCompilationUnit> parsedFiles = round.parseNewSourceFiles();
  10.349 -            roots = cleanTrees(roots).appendList(parsedFiles);
  10.350 -        }
  10.351 -
  10.352 -        // Set error status for any files compiled and generated in
  10.353 -        // the last round
  10.354 -        if (round.unrecoverableError() || (werror && round.warningCount() != 0))
  10.355 -            errorStatus = true;
  10.356 -
  10.357 -        round = round.next();
  10.358 -
  10.359          filer.warnIfUnclosedFiles();
  10.360          warnIfUnmatchedOptions();
  10.361  
  10.362 -       /*
  10.363 -        * If an annotation processor raises an error in a round,
  10.364 -        * that round runs to completion and one last round occurs.
  10.365 -        * The last round may also occur because no more source or
  10.366 -        * class files have been generated.  Therefore, if an error
  10.367 -        * was raised on either of the last *two* rounds, the compile
  10.368 -        * should exit with a nonzero exit code.  The current value of
  10.369 -        * errorStatus holds whether or not an error was raised on the
  10.370 -        * second to last round; errorRaised() gives the error status
  10.371 -        * of the last round.
  10.372 -        */
  10.373 -        errorStatus = errorStatus || messager.errorRaised();
  10.374 +        /*
  10.375 +         * If an annotation processor raises an error in a round,
  10.376 +         * that round runs to completion and one last round occurs.
  10.377 +         * The last round may also occur because no more source or
  10.378 +         * class files have been generated.  Therefore, if an error
  10.379 +         * was raised on either of the last *two* rounds, the compile
  10.380 +         * should exit with a nonzero exit code.  The current value of
  10.381 +         * errorStatus holds whether or not an error was raised on the
  10.382 +         * second to last round; errorRaised() gives the error status
  10.383 +         * of the last round.
  10.384 +         */
  10.385 +        if (messager.errorRaised()
  10.386 +                || werror && round.warningCount() > 0 && round.errorCount() > 0)
  10.387 +            errorStatus = true;
  10.388 +
  10.389 +        Set<JavaFileObject> newSourceFiles =
  10.390 +                new LinkedHashSet<JavaFileObject>(filer.getGeneratedSourceFileObjects());
  10.391 +        roots = cleanTrees(round.roots);
  10.392 +
  10.393 +        JavaCompiler compiler = round.finalCompiler(errorStatus);
  10.394 +
  10.395 +        if (newSourceFiles.size() > 0)
  10.396 +            roots = roots.appendList(compiler.parseFiles(newSourceFiles));
  10.397 +
  10.398 +        errorStatus = errorStatus || (compiler.errorCount() > 0);
  10.399  
  10.400          // Free resources
  10.401          this.close();
  10.402  
  10.403 -        TaskListener taskListener = this.context.get(TaskListener.class);
  10.404          if (taskListener != null)
  10.405              taskListener.finished(new TaskEvent(TaskEvent.Kind.ANNOTATION_PROCESSING));
  10.406  
  10.407 -        JavaCompiler compiler;
  10.408 -
  10.409          if (errorStatus) {
  10.410 -            compiler = round.compiler;
  10.411 -            compiler.log.nwarnings += messager.warningCount();
  10.412 -            compiler.log.nerrors += messager.errorCount();
  10.413              if (compiler.errorCount() == 0)
  10.414                  compiler.log.nerrors++;
  10.415 -        } else if (procOnly && !foundTypeProcessors) {
  10.416 -            compiler = round.compiler;
  10.417 +            return compiler;
  10.418 +        }
  10.419 +
  10.420 +        if (procOnly && !foundTypeProcessors) {
  10.421              compiler.todo.clear();
  10.422 -        } else { // Final compilation
  10.423 -            round = round.next();
  10.424 -            round.updateProcessingState();
  10.425 -            compiler = round.compiler;
  10.426 +        } else {
  10.427              if (procOnly && foundTypeProcessors)
  10.428                  compiler.shouldStopPolicy = CompileState.FLOW;
  10.429  
  10.430 -            compiler.enterTrees(cleanTrees(roots));
  10.431 +            compiler.enterTrees(roots);
  10.432          }
  10.433  
  10.434          return compiler;
  10.435 @@ -1185,7 +1198,9 @@
  10.436          for (JCCompilationUnit unit : units) {
  10.437              for (JCTree node : unit.defs) {
  10.438                  if (node.getTag() == JCTree.CLASSDEF) {
  10.439 -                    classes = classes.prepend(((JCClassDecl) node).sym);
  10.440 +                    ClassSymbol sym = ((JCClassDecl) node).sym;
  10.441 +                    assert sym != null;
  10.442 +                    classes = classes.prepend(sym);
  10.443                  }
  10.444              }
  10.445          }
    11.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Aug 19 15:13:23 2010 -0700
    11.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Aug 23 19:14:55 2010 -0700
    11.3 @@ -42,7 +42,9 @@
    11.4  compiler.err.already.defined.this.unit=\
    11.5      {0} is already defined in this compilation unit
    11.6  compiler.err.annotation.missing.default.value=\
    11.7 -    annotation {0} is missing {1}
    11.8 +    annotation {0} is missing value for the attribute {1}
    11.9 +compiler.err.annotation.missing.default.value.1=\
   11.10 +    annotation {0} is missing values for attributes {1}
   11.11  compiler.err.annotation.not.valid.for.type=\
   11.12      annotation not valid for a value of type {0}
   11.13  compiler.err.annotation.type.not.applicable=\
    12.1 --- a/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Thu Aug 19 15:13:23 2010 -0700
    12.2 +++ b/src/share/classes/com/sun/tools/javac/util/JCDiagnostic.java	Mon Aug 23 19:14:55 2010 -0700
    12.3 @@ -25,8 +25,10 @@
    12.4  
    12.5  package com.sun.tools.javac.util;
    12.6  
    12.7 +import java.util.EnumSet;
    12.8  import java.util.Locale;
    12.9  import java.util.Map;
   12.10 +import java.util.Set;
   12.11  
   12.12  import javax.tools.Diagnostic;
   12.13  import javax.tools.JavaFileObject;
   12.14 @@ -83,7 +85,7 @@
   12.15           */
   12.16          public JCDiagnostic error(
   12.17                  DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
   12.18 -            return create(ERROR, null, true, source, pos, key, args);
   12.19 +            return create(ERROR, null, EnumSet.of(DiagnosticFlag.MANDATORY), source, pos, key, args);
   12.20          }
   12.21  
   12.22          /**
   12.23 @@ -96,7 +98,7 @@
   12.24           */
   12.25          public JCDiagnostic mandatoryWarning(
   12.26                  DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
   12.27 -            return create(WARNING, null, true, source, pos, key, args);
   12.28 +            return create(WARNING, null, EnumSet.of(DiagnosticFlag.MANDATORY), source, pos, key, args);
   12.29          }
   12.30  
   12.31          /**
   12.32 @@ -111,7 +113,7 @@
   12.33          public JCDiagnostic mandatoryWarning(
   12.34                  LintCategory lc,
   12.35                  DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
   12.36 -            return create(WARNING, lc, true, source, pos, key, args);
   12.37 +            return create(WARNING, lc, EnumSet.of(DiagnosticFlag.MANDATORY), source, pos, key, args);
   12.38          }
   12.39  
   12.40          /**
   12.41 @@ -123,7 +125,7 @@
   12.42           */
   12.43          public JCDiagnostic warning(
   12.44                   LintCategory lc, String key, Object... args) {
   12.45 -            return create(WARNING, lc, false, null, null, key, args);
   12.46 +            return create(WARNING, lc, EnumSet.noneOf(DiagnosticFlag.class), null, null, key, args);
   12.47          }
   12.48  
   12.49          /**
   12.50 @@ -135,7 +137,7 @@
   12.51           */
   12.52          public JCDiagnostic warning(
   12.53                  DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
   12.54 -            return create(WARNING, null, false, source, pos, key, args);
   12.55 +            return create(WARNING, null, EnumSet.noneOf(DiagnosticFlag.class), source, pos, key, args);
   12.56          }
   12.57  
   12.58          /**
   12.59 @@ -149,7 +151,7 @@
   12.60           */
   12.61          public JCDiagnostic warning(
   12.62                   LintCategory lc, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
   12.63 -            return create(WARNING, lc, false, source, pos, key, args);
   12.64 +            return create(WARNING, lc, EnumSet.noneOf(DiagnosticFlag.class), source, pos, key, args);
   12.65          }
   12.66  
   12.67          /**
   12.68 @@ -159,7 +161,7 @@
   12.69           *  @see MandatoryWarningHandler
   12.70           */
   12.71          public JCDiagnostic mandatoryNote(DiagnosticSource source, String key, Object... args) {
   12.72 -            return create(NOTE, null, true, source, null, key, args);
   12.73 +            return create(NOTE, null, EnumSet.of(DiagnosticFlag.MANDATORY), source, null, key, args);
   12.74          }
   12.75  
   12.76          /**
   12.77 @@ -168,7 +170,7 @@
   12.78           *  @param args   Fields of the message.
   12.79           */
   12.80          public JCDiagnostic note(String key, Object... args) {
   12.81 -            return create(NOTE, null, false, null, null, key, args);
   12.82 +            return create(NOTE, null, EnumSet.noneOf(DiagnosticFlag.class), null, null, key, args);
   12.83          }
   12.84  
   12.85          /**
   12.86 @@ -180,7 +182,7 @@
   12.87           */
   12.88          public JCDiagnostic note(
   12.89                  DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
   12.90 -            return create(NOTE, null, false, source, pos, key, args);
   12.91 +            return create(NOTE, null, EnumSet.noneOf(DiagnosticFlag.class), source, pos, key, args);
   12.92          }
   12.93  
   12.94          /**
   12.95 @@ -189,7 +191,7 @@
   12.96           *  @param args   Fields of the message.
   12.97           */
   12.98          public JCDiagnostic fragment(String key, Object... args) {
   12.99 -            return create(FRAGMENT, null, false, null, null, key, args);
  12.100 +            return create(FRAGMENT, null, EnumSet.noneOf(DiagnosticFlag.class), null, null, key, args);
  12.101          }
  12.102  
  12.103          /**
  12.104 @@ -204,7 +206,7 @@
  12.105           */
  12.106          public JCDiagnostic create(
  12.107                  DiagnosticType kind, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
  12.108 -            return create(kind, null, false, source, pos, key, args);
  12.109 +            return create(kind, null, EnumSet.noneOf(DiagnosticFlag.class), source, pos, key, args);
  12.110          }
  12.111  
  12.112          /**
  12.113 @@ -218,8 +220,8 @@
  12.114           *  @param args        Fields of the message.
  12.115           */
  12.116          public JCDiagnostic create(
  12.117 -                DiagnosticType kind, LintCategory lc, boolean isMandatory, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
  12.118 -            return new JCDiagnostic(formatter, kind, lc, isMandatory, source, pos, qualify(kind, key), args);
  12.119 +                DiagnosticType kind, LintCategory lc, Set<DiagnosticFlag> flags, DiagnosticSource source, DiagnosticPosition pos, String key, Object... args) {
  12.120 +            return new JCDiagnostic(formatter, kind, lc, flags, source, pos, qualify(kind, key), args);
  12.121          }
  12.122  
  12.123          protected String qualify(DiagnosticType t, String key) {
  12.124 @@ -240,7 +242,7 @@
  12.125          return new JCDiagnostic(getFragmentFormatter(),
  12.126                                FRAGMENT,
  12.127                                null,
  12.128 -                              false,
  12.129 +                              EnumSet.noneOf(DiagnosticFlag.class),
  12.130                                null,
  12.131                                null,
  12.132                                "compiler." + FRAGMENT.key + "." + key,
  12.133 @@ -327,6 +329,11 @@
  12.134          private final int pos;
  12.135      }
  12.136  
  12.137 +    public enum DiagnosticFlag {
  12.138 +        MANDATORY,
  12.139 +        RESOLVE_ERROR
  12.140 +    }
  12.141 +
  12.142      private final DiagnosticType type;
  12.143      private final DiagnosticSource source;
  12.144      private final DiagnosticPosition position;
  12.145 @@ -334,7 +341,7 @@
  12.146      private final int column;
  12.147      private final String key;
  12.148      protected final Object[] args;
  12.149 -    private final boolean mandatory;
  12.150 +    private final Set<DiagnosticFlag> flags;
  12.151      private final LintCategory lintCategory;
  12.152  
  12.153      /**
  12.154 @@ -350,7 +357,7 @@
  12.155      protected JCDiagnostic(DiagnosticFormatter<JCDiagnostic> formatter,
  12.156                         DiagnosticType dt,
  12.157                         LintCategory lc,
  12.158 -                       boolean mandatory,
  12.159 +                       Set<DiagnosticFlag> flags,
  12.160                         DiagnosticSource source,
  12.161                         DiagnosticPosition pos,
  12.162                         String key,
  12.163 @@ -361,7 +368,7 @@
  12.164          this.defaultFormatter = formatter;
  12.165          this.type = dt;
  12.166          this.lintCategory = lc;
  12.167 -        this.mandatory = mandatory;
  12.168 +        this.flags = flags;
  12.169          this.source = source;
  12.170          this.position = pos;
  12.171          this.key = key;
  12.172 @@ -401,7 +408,7 @@
  12.173       * @return true if this diagnostic is required to be shown.
  12.174       */
  12.175      public boolean isMandatory() {
  12.176 -        return mandatory;
  12.177 +        return flags.contains(DiagnosticFlag.MANDATORY);
  12.178      }
  12.179  
  12.180      /**
  12.181 @@ -520,8 +527,9 @@
  12.182          case NOTE:
  12.183              return Diagnostic.Kind.NOTE;
  12.184          case WARNING:
  12.185 -            return mandatory ? Diagnostic.Kind.MANDATORY_WARNING
  12.186 -                             : Diagnostic.Kind.WARNING;
  12.187 +            return flags.contains(DiagnosticFlag.MANDATORY)
  12.188 +                    ? Diagnostic.Kind.MANDATORY_WARNING
  12.189 +                    : Diagnostic.Kind.WARNING;
  12.190          case ERROR:
  12.191              return Diagnostic.Kind.ERROR;
  12.192          default:
  12.193 @@ -537,6 +545,14 @@
  12.194          return defaultFormatter.formatMessage(this, locale);
  12.195      }
  12.196  
  12.197 +    public void setFlag(DiagnosticFlag flag) {
  12.198 +        flags.add(flag);
  12.199 +    }
  12.200 +
  12.201 +    public boolean isFlagSet(DiagnosticFlag flag) {
  12.202 +        return flags.contains(flag);
  12.203 +    }
  12.204 +
  12.205      public static class MultilineDiagnostic extends JCDiagnostic {
  12.206  
  12.207          private final List<JCDiagnostic> subdiagnostics;
  12.208 @@ -545,7 +561,7 @@
  12.209              super(other.defaultFormatter,
  12.210                    other.getType(),
  12.211                    other.getLintCategory(),
  12.212 -                  other.isMandatory(),
  12.213 +                  other.flags,
  12.214                    other.getDiagnosticSource(),
  12.215                    other.position,
  12.216                    other.getCode(),
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/test/tools/javac/6857948/T6857948.java	Mon Aug 23 19:14:55 2010 -0700
    13.3 @@ -0,0 +1,18 @@
    13.4 +/*
    13.5 + * @test /nodynamiccopyright/
    13.6 + * @bug 6857948
    13.7 + * @summary 6857948: Calling a constructor with a doubly bogus argument causes an internal error
    13.8 + * @author Maurizio Cimadamore
    13.9 + *
   13.10 + * @compile/fail/ref=T6857948.out -XDrawDiagnostics T6857948.java
   13.11 + */
   13.12 +
   13.13 +class Foo {
   13.14 +   Foo(String v) {}
   13.15 +};
   13.16 +
   13.17 +class Test {
   13.18 +   public static void main() {
   13.19 +      Foo f = new Foo("Hello!",nosuchfunction()) {};
   13.20 +   }
   13.21 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/test/tools/javac/6857948/T6857948.out	Mon Aug 23 19:14:55 2010 -0700
    14.3 @@ -0,0 +1,3 @@
    14.4 +T6857948.java:16:32: compiler.err.cant.resolve.location.args: kindname.method, nosuchfunction, , , kindname.class, Test
    14.5 +T6857948.java:16:50: compiler.err.cant.apply.symbol: kindname.constructor, Foo, java.lang.String, compiler.misc.no.args, kindname.class, Foo, null
    14.6 +2 errors
    15.1 --- a/test/tools/javac/Diagnostics/6862608/T6862608a.out	Thu Aug 19 15:13:23 2010 -0700
    15.2 +++ b/test/tools/javac/Diagnostics/6862608/T6862608a.out	Mon Aug 23 19:14:55 2010 -0700
    15.3 @@ -1,3 +1,3 @@
    15.4 -T6862608a.java:19:41: compiler.err.invalid.inferred.types: T, (compiler.misc.inferred.do.not.conform.to.params: java.lang.Iterable<? extends java.util.Comparator<? super java.lang.String>>, java.util.List<java.util.Comparator<?>>)
    15.5 +T6862608a.java:19:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String>
    15.6  - compiler.misc.where.description.typevar: T,{(compiler.misc.where.typevar: T, java.lang.Object, kindname.method, <T>compound(java.lang.Iterable<? extends java.util.Comparator<? super T>>))}
    15.7  1 error
    16.1 --- a/test/tools/javac/T6358024.java	Thu Aug 19 15:13:23 2010 -0700
    16.2 +++ b/test/tools/javac/T6358024.java	Mon Aug 23 19:14:55 2010 -0700
    16.3 @@ -60,7 +60,7 @@
    16.4               new Option[] { new XOption("-XprintRounds"),
    16.5                              new Option("-processorpath", "."),
    16.6                              new Option("-processor", self) },
    16.7 -             11);
    16.8 +             12);
    16.9      }
   16.10  
   16.11      static void test(JavacFileManager fm, JavaFileObject f, Option[] opts, int expect) throws Throwable {
    17.1 --- a/test/tools/javac/T6403466.out	Thu Aug 19 15:13:23 2010 -0700
    17.2 +++ b/test/tools/javac/T6403466.out	Mon Aug 23 19:14:55 2010 -0700
    17.3 @@ -13,6 +13,10 @@
    17.4  Finished TaskEvent[ENTER,T6403466Wrapper.java,null]
    17.5  Started TaskEvent[ANNOTATION_PROCESSING_ROUND,null,null]
    17.6  Finished TaskEvent[ANNOTATION_PROCESSING_ROUND,null,null]
    17.7 +Started TaskEvent[ENTER,T6403466.java,null]
    17.8 +Started TaskEvent[ENTER,T6403466Wrapper.java,null]
    17.9 +Finished TaskEvent[ENTER,T6403466.java,null]
   17.10 +Finished TaskEvent[ENTER,T6403466Wrapper.java,null]
   17.11  Started TaskEvent[ANNOTATION_PROCESSING_ROUND,null,null]
   17.12  Finished TaskEvent[ANNOTATION_PROCESSING_ROUND,null,null]
   17.13  Finished TaskEvent[ANNOTATION_PROCESSING,null,null]
    18.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    18.2 +++ b/test/tools/javac/T6977800.java	Mon Aug 23 19:14:55 2010 -0700
    18.3 @@ -0,0 +1,41 @@
    18.4 +/*
    18.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    18.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    18.7 + *
    18.8 + * This code is free software; you can redistribute it and/or modify it
    18.9 + * under the terms of the GNU General Public License version 2 only, as
   18.10 + * published by the Free Software Foundation.
   18.11 + *
   18.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   18.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   18.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   18.15 + * version 2 for more details (a copy is included in the LICENSE file that
   18.16 + * accompanied this code).
   18.17 + *
   18.18 + * You should have received a copy of the GNU General Public License version
   18.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   18.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   18.21 + *
   18.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   18.23 + * or visit www.oracle.com if you need additional information or have any
   18.24 + * questions.
   18.25 + */
   18.26 +
   18.27 +/*
   18.28 + * @test
   18.29 + * @bug 6977800
   18.30 + * @summary Regression: invalid resolution of supertype for local class
   18.31 + * @compile T6977800.java
   18.32 + */
   18.33 +
   18.34 +class T6977800 {
   18.35 +    public static void test() {
   18.36 +        class A {
   18.37 +            int x = 1;
   18.38 +        }
   18.39 +        class B extends A {}
   18.40 +        System.out.println(new B().x);
   18.41 +    }
   18.42 +
   18.43 +    static class A {}
   18.44 +}
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/test/tools/javac/annotations/6881115/T6881115.java	Mon Aug 23 19:14:55 2010 -0700
    19.3 @@ -0,0 +1,20 @@
    19.4 +/*
    19.5 + * @test /nodynamiccopyright/
    19.6 + * @bug     6881115 6976649
    19.7 + * @summary javac permits nested anno w/o mandatory attrs => IncompleteAnnotationException
    19.8 + * @author  mcimadamore
    19.9 + * @compile/fail/ref=T6881115.out -XDrawDiagnostics T6881115.java
   19.10 + */
   19.11 +
   19.12 +@interface A {
   19.13 +    B b() default @B(b2 = 1, b2 = 2);
   19.14 +    B[] b_arr() default {@B(), @B(b2 = 1, b2 = 2)};
   19.15 +}
   19.16 +@interface B {
   19.17 +    String b1();
   19.18 +    int b2();
   19.19 +}
   19.20 +@A(b = @B(b2 = 1, b2 = 2),
   19.21 +   b_arr = {@B(), @B(b2 = 1, b2 = 2)})
   19.22 +class T6881115<@A(b = @B(b2 = 1, b2 = 2),
   19.23 +                  b_arr = {@B(), @B(b2 = 1, b2 = 2)}) X> {}
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/test/tools/javac/annotations/6881115/T6881115.out	Mon Aug 23 19:14:55 2010 -0700
    20.3 @@ -0,0 +1,16 @@
    20.4 +T6881115.java:10:30: compiler.err.duplicate.annotation.member.value: b2, B
    20.5 +T6881115.java:10:19: compiler.err.annotation.missing.default.value: B, b1
    20.6 +T6881115.java:11:26: compiler.err.annotation.missing.default.value.1: B, b1,b2
    20.7 +T6881115.java:11:43: compiler.err.duplicate.annotation.member.value: b2, B
    20.8 +T6881115.java:11:32: compiler.err.annotation.missing.default.value: B, b1
    20.9 +T6881115.java:17:19: compiler.err.duplicate.annotation.member.value: b2, B
   20.10 +T6881115.java:17:8: compiler.err.annotation.missing.default.value: B, b1
   20.11 +T6881115.java:18:13: compiler.err.annotation.missing.default.value.1: B, b1,b2
   20.12 +T6881115.java:18:30: compiler.err.duplicate.annotation.member.value: b2, B
   20.13 +T6881115.java:18:19: compiler.err.annotation.missing.default.value: B, b1
   20.14 +T6881115.java:19:34: compiler.err.duplicate.annotation.member.value: b2, B
   20.15 +T6881115.java:19:23: compiler.err.annotation.missing.default.value: B, b1
   20.16 +T6881115.java:20:28: compiler.err.annotation.missing.default.value.1: B, b1,b2
   20.17 +T6881115.java:20:45: compiler.err.duplicate.annotation.member.value: b2, B
   20.18 +T6881115.java:20:34: compiler.err.annotation.missing.default.value: B, b1
   20.19 +15 errors
    21.1 --- a/test/tools/javac/annotations/pos/TrailingComma.java	Thu Aug 19 15:13:23 2010 -0700
    21.2 +++ b/test/tools/javac/annotations/pos/TrailingComma.java	Mon Aug 23 19:14:55 2010 -0700
    21.3 @@ -36,7 +36,7 @@
    21.4  }
    21.5  
    21.6  
    21.7 -@TestAnnotation({@SuppressWarnings(),
    21.8 +@TestAnnotation({@SuppressWarnings({}),
    21.9                   @SuppressWarnings({"Beware the ides of March.",}),
   21.10                   @SuppressWarnings({"Look both ways", "Before Crossing",}), })
   21.11  public class TrailingComma {
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/test/tools/javac/cast/6270087/T6270087.java	Mon Aug 23 19:14:55 2010 -0700
    22.3 @@ -0,0 +1,42 @@
    22.4 +/*
    22.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    22.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    22.7 + *
    22.8 + * This code is free software; you can redistribute it and/or modify it
    22.9 + * under the terms of the GNU General Public License version 2 only, as
   22.10 + * published by the Free Software Foundation.
   22.11 + *
   22.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   22.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   22.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   22.15 + * version 2 for more details (a copy is included in the LICENSE file that
   22.16 + * accompanied this code).
   22.17 + *
   22.18 + * You should have received a copy of the GNU General Public License version
   22.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   22.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   22.21 + *
   22.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   22.23 + * or visit www.oracle.com if you need additional information or have any
   22.24 + * questions.
   22.25 + */
   22.26 +
   22.27 +/*
   22.28 + * @test
   22.29 + * @bug     6270087 6932571
   22.30 + * @summary Javac rejects legal cast
   22.31 + * @compile T6270087.java
   22.32 + */
   22.33 +
   22.34 +class T6270087 {
   22.35 +
   22.36 +    static class Foo<X> {}
   22.37 +
   22.38 +    <S extends Comparable<S>> void test1(Comparable<Integer> c) {
   22.39 +        Object o = (Comparable<S>)c;
   22.40 +    }
   22.41 +
   22.42 +   <U extends Throwable, V extends Runnable> void test2(Foo<V> lv) {
   22.43 +        Object o = (Foo<U>) lv;
   22.44 +   }
   22.45 +}
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/test/tools/javac/cast/6270087/T6270087neg.java	Mon Aug 23 19:14:55 2010 -0700
    23.3 @@ -0,0 +1,38 @@
    23.4 +/*
    23.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    23.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    23.7 + *
    23.8 + * This code is free software; you can redistribute it and/or modify it
    23.9 + * under the terms of the GNU General Public License version 2 only, as
   23.10 + * published by the Free Software Foundation.
   23.11 + *
   23.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   23.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   23.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   23.15 + * version 2 for more details (a copy is included in the LICENSE file that
   23.16 + * accompanied this code).
   23.17 + *
   23.18 + * You should have received a copy of the GNU General Public License version
   23.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   23.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   23.21 + *
   23.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   23.23 + * or visit www.oracle.com if you need additional information or have any
   23.24 + * questions.
   23.25 + */
   23.26 +
   23.27 +/*
   23.28 + * @test
   23.29 + * @bug     6270087 6932571
   23.30 + * @summary Javac rejects legal cast
   23.31 + * @compile/fail/ref=T6270087neg.out -XDrawDiagnostics T6270087neg.java
   23.32 + */
   23.33 +
   23.34 +class T6270087neg {
   23.35 +
   23.36 +    static class Foo<X> {}
   23.37 +
   23.38 +   <U extends Integer, V extends String> void test2(Foo<V> lv) {
   23.39 +        Object o = (Foo<U>) lv;
   23.40 +   }
   23.41 +}
    24.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    24.2 +++ b/test/tools/javac/cast/6270087/T6270087neg.out	Mon Aug 23 19:14:55 2010 -0700
    24.3 @@ -0,0 +1,2 @@
    24.4 +T6270087neg.java:36:29: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6270087neg.Foo<V>, T6270087neg.Foo<U>
    24.5 +1 error
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/test/tools/javac/cast/6507317/T6507317.java	Mon Aug 23 19:14:55 2010 -0700
    25.3 @@ -0,0 +1,37 @@
    25.4 +/*
    25.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    25.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    25.7 + *
    25.8 + * This code is free software; you can redistribute it and/or modify it
    25.9 + * under the terms of the GNU General Public License version 2 only, as
   25.10 + * published by the Free Software Foundation.
   25.11 + *
   25.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   25.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   25.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   25.15 + * version 2 for more details (a copy is included in the LICENSE file that
   25.16 + * accompanied this code).
   25.17 + *
   25.18 + * You should have received a copy of the GNU General Public License version
   25.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   25.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   25.21 + *
   25.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   25.23 + * or visit www.oracle.com if you need additional information or have any
   25.24 + * questions.
   25.25 + */
   25.26 +
   25.27 +/*
   25.28 + * @test
   25.29 + * @bug     6507317 6932571
   25.30 + * @summary Problem when casting from parametrized type to concrete class
   25.31 + * @compile T6507317.java
   25.32 + */
   25.33 +
   25.34 +import java.util.Comparator;
   25.35 +
   25.36 +abstract class T6507317<T extends Comparable<T>> implements Comparator<T> {
   25.37 +    void test(T t) {
   25.38 +        String s = (String)t;
   25.39 +    }
   25.40 +}
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/test/tools/javac/cast/6569057/T6569057.java	Mon Aug 23 19:14:55 2010 -0700
    26.3 @@ -0,0 +1,43 @@
    26.4 +/*
    26.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    26.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    26.7 + *
    26.8 + * This code is free software; you can redistribute it and/or modify it
    26.9 + * under the terms of the GNU General Public License version 2 only, as
   26.10 + * published by the Free Software Foundation.
   26.11 + *
   26.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   26.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   26.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   26.15 + * version 2 for more details (a copy is included in the LICENSE file that
   26.16 + * accompanied this code).
   26.17 + *
   26.18 + * You should have received a copy of the GNU General Public License version
   26.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   26.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   26.21 + *
   26.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   26.23 + * or visit www.oracle.com if you need additional information or have any
   26.24 + * questions.
   26.25 + */
   26.26 +
   26.27 +/*
   26.28 + * @test
   26.29 + * @bug     6569057 6932571
   26.30 + * @summary Generics regression on cast
   26.31 + * @compile T6569057.java
   26.32 + */
   26.33 +
   26.34 +class T6569057 {
   26.35 +    static class A<X extends B<?>> {  }
   26.36 +
   26.37 +    static class B<X extends A<?>> {
   26.38 +        D<? extends B<X>> get() { return null; }
   26.39 +    }
   26.40 +
   26.41 +    static class D<Y extends B<?>> {}
   26.42 +
   26.43 +    <E extends B<?>> void test(E x, D<B<A<?>>> d) {
   26.44 +        boolean b = x.get() == d;
   26.45 +    }
   26.46 +}
    27.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.2 +++ b/test/tools/javac/cast/6932571/T6932571a.java	Mon Aug 23 19:14:55 2010 -0700
    27.3 @@ -0,0 +1,43 @@
    27.4 +/*
    27.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    27.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    27.7 + *
    27.8 + * This code is free software; you can redistribute it and/or modify it
    27.9 + * under the terms of the GNU General Public License version 2 only, as
   27.10 + * published by the Free Software Foundation.
   27.11 + *
   27.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   27.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   27.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   27.15 + * version 2 for more details (a copy is included in the LICENSE file that
   27.16 + * accompanied this code).
   27.17 + *
   27.18 + * You should have received a copy of the GNU General Public License version
   27.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   27.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   27.21 + *
   27.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   27.23 + * or visit www.oracle.com if you need additional information or have any
   27.24 + * questions.
   27.25 + */
   27.26 +
   27.27 +/*
   27.28 + * @test
   27.29 + * @bug     6932571
   27.30 + * @summary Compiling Generics causing Inconvertible types
   27.31 + * @compile T6932571a.java
   27.32 + */
   27.33 +
   27.34 +class T6932571a {
   27.35 +    static class A<T extends Comparable<? super T>> {
   27.36 +        public void test(T v) {
   27.37 +            Object obj = (Integer)v;
   27.38 +        }
   27.39 +    }
   27.40 +
   27.41 +    static class B<T extends Comparable<? extends T>> {
   27.42 +        public void test(T v) {
   27.43 +            Object obj = (Integer)v;
   27.44 +        }
   27.45 +    }
   27.46 +}
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/test/tools/javac/cast/6932571/T6932571b.java	Mon Aug 23 19:14:55 2010 -0700
    28.3 @@ -0,0 +1,52 @@
    28.4 +/*
    28.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    28.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    28.7 + *
    28.8 + * This code is free software; you can redistribute it and/or modify it
    28.9 + * under the terms of the GNU General Public License version 2 only, as
   28.10 + * published by the Free Software Foundation.
   28.11 + *
   28.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   28.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   28.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   28.15 + * version 2 for more details (a copy is included in the LICENSE file that
   28.16 + * accompanied this code).
   28.17 + *
   28.18 + * You should have received a copy of the GNU General Public License version
   28.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   28.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   28.21 + *
   28.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   28.23 + * or visit www.oracle.com if you need additional information or have any
   28.24 + * questions.
   28.25 + */
   28.26 +
   28.27 +/*
   28.28 + * @test
   28.29 + * @bug     6932571
   28.30 + * @summary Compiling Generics causing Inconvertible types
   28.31 + * @compile T6932571b.java
   28.32 + */
   28.33 +
   28.34 +class T6932571b {
   28.35 +
   28.36 +    interface A1<T extends B<? super T>> {
   28.37 +        public T getT();
   28.38 +    }
   28.39 +
   28.40 +    interface A2<T extends B<? extends T>> {
   28.41 +        public T getT();
   28.42 +    }
   28.43 +
   28.44 +    class B<T extends B<T>> {}
   28.45 +
   28.46 +    class C extends B<C> {}
   28.47 +
   28.48 +    void test1(A1<?> a) {
   28.49 +        Object o = (C)a.getT();
   28.50 +    }
   28.51 +
   28.52 +    void test2(A2<?> a) {
   28.53 +        Object o = (C)a.getT();
   28.54 +    }
   28.55 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/test/tools/javac/cast/6932571/T6932571neg.java	Mon Aug 23 19:14:55 2010 -0700
    29.3 @@ -0,0 +1,41 @@
    29.4 +/*
    29.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    29.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    29.7 + *
    29.8 + * This code is free software; you can redistribute it and/or modify it
    29.9 + * under the terms of the GNU General Public License version 2 only, as
   29.10 + * published by the Free Software Foundation.
   29.11 + *
   29.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   29.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   29.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   29.15 + * version 2 for more details (a copy is included in the LICENSE file that
   29.16 + * accompanied this code).
   29.17 + *
   29.18 + * You should have received a copy of the GNU General Public License version
   29.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   29.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   29.21 + *
   29.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   29.23 + * or visit www.oracle.com if you need additional information or have any
   29.24 + * questions.
   29.25 + */
   29.26 +
   29.27 +/*
   29.28 + * @test
   29.29 + * @bug     6932571
   29.30 + * @summary Compiling Generics causing Inconvertible types
   29.31 + * @compile/fail/ref=T6932571neg.out -XDrawDiagnostics T6932571neg.java
   29.32 + */
   29.33 +
   29.34 +class T6932571neg {
   29.35 +    interface I<T>{ }
   29.36 +    interface I1 extends I<String> {}
   29.37 +    static class Y implements I<String> {}
   29.38 +    final static class S implements I<String> {}
   29.39 +
   29.40 +    <G extends I<G>> void test() {
   29.41 +        S s = new S();
   29.42 +        G g = (G) s;
   29.43 +    }
   29.44 +}
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/test/tools/javac/cast/6932571/T6932571neg.out	Mon Aug 23 19:14:55 2010 -0700
    30.3 @@ -0,0 +1,2 @@
    30.4 +T6932571neg.java:39:19: compiler.err.prob.found.req: (compiler.misc.inconvertible.types), T6932571neg.S, G
    30.5 +1 error
    31.1 --- a/test/tools/javac/diags/Example.java	Thu Aug 19 15:13:23 2010 -0700
    31.2 +++ b/test/tools/javac/diags/Example.java	Mon Aug 23 19:14:55 2010 -0700
    31.3 @@ -421,7 +421,7 @@
    31.4              if (verbose)
    31.5                  System.err.println("run_simple: " + opts + " " + files);
    31.6  
    31.7 -            List<String> args = new ArrayList<String>(opts);
    31.8 +            List<String> args = new ArrayList<String>();
    31.9  
   31.10              if (keys != null || raw)
   31.11                  args.add("-XDrawDiagnostics");
    32.1 --- a/test/tools/javac/diags/examples.not-yet.txt	Thu Aug 19 15:13:23 2010 -0700
    32.2 +++ b/test/tools/javac/diags/examples.not-yet.txt	Mon Aug 23 19:14:55 2010 -0700
    32.3 @@ -64,6 +64,7 @@
    32.4  compiler.misc.fatal.err.cant.locate.meth                # Resolve, from Lower
    32.5  compiler.misc.file.does.not.contain.package
    32.6  compiler.misc.illegal.start.of.class.file
    32.7 +compiler.misc.inferred.do.not.conform.to.params         # UNUSED (hard to see if very complex inference scenario might require this though, so leaving it in, as per JLS3)
    32.8  compiler.misc.kindname.annotation
    32.9  compiler.misc.kindname.enum
   32.10  compiler.misc.kindname.package
    33.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.2 +++ b/test/tools/javac/diags/examples/AnnotationMissingValues1.java	Mon Aug 23 19:14:55 2010 -0700
    33.3 @@ -0,0 +1,32 @@
    33.4 +/*
    33.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    33.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    33.7 + *
    33.8 + * This code is free software; you can redistribute it and/or modify it
    33.9 + * under the terms of the GNU General Public License version 2 only, as
   33.10 + * published by the Free Software Foundation.
   33.11 + *
   33.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   33.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   33.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   33.15 + * version 2 for more details (a copy is included in the LICENSE file that
   33.16 + * accompanied this code).
   33.17 + *
   33.18 + * You should have received a copy of the GNU General Public License version
   33.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   33.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   33.21 + *
   33.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   33.23 + * or visit www.oracle.com if you need additional information or have any
   33.24 + * questions.
   33.25 + */
   33.26 +
   33.27 +// key: compiler.err.annotation.missing.default.value.1
   33.28 +
   33.29 +@interface Anno {
   33.30 +    String a();
   33.31 +    String b();
   33.32 +}
   33.33 +
   33.34 +@Anno
   33.35 +class AnnotationMissingValue { }
    34.1 --- a/test/tools/javac/diags/examples/InvalidInferredTypes.java	Thu Aug 19 15:13:23 2010 -0700
    34.2 +++ b/test/tools/javac/diags/examples/InvalidInferredTypes.java	Mon Aug 23 19:14:55 2010 -0700
    34.3 @@ -22,17 +22,17 @@
    34.4   */
    34.5  
    34.6  // key: compiler.err.invalid.inferred.types
    34.7 -// key: compiler.misc.inferred.do.not.conform.to.params
    34.8 +// key: compiler.misc.inferred.do.not.conform.to.bounds
    34.9  
   34.10  import java.util.*;
   34.11  
   34.12  class InvalidInferredTypes {
   34.13  
   34.14 -    <T> Comparator<T> compound(Iterable<? extends Comparator<? super T>> it) {
   34.15 +    <T extends List<? super T>> T makeList() {
   34.16          return null;
   34.17      }
   34.18  
   34.19 -    public void test(List<Comparator<?>> x) {
   34.20 -        Comparator<String> c3 = compound(x);
   34.21 +    public void test() {
   34.22 +        List<? super String> l = makeList();
   34.23      }
   34.24  }
    35.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    35.2 +++ b/test/tools/javac/generics/inference/6369605/T6369605a.java	Mon Aug 23 19:14:55 2010 -0700
    35.3 @@ -0,0 +1,50 @@
    35.4 +/*
    35.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    35.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.7 + *
    35.8 + * This code is free software; you can redistribute it and/or modify it
    35.9 + * under the terms of the GNU General Public License version 2 only, as
   35.10 + * published by the Free Software Foundation.
   35.11 + *
   35.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   35.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   35.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   35.15 + * version 2 for more details (a copy is included in the LICENSE file that
   35.16 + * accompanied this code).
   35.17 + *
   35.18 + * You should have received a copy of the GNU General Public License version
   35.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   35.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   35.21 + *
   35.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   35.23 + * or visit www.oracle.com if you need additional information or have any
   35.24 + * questions.
   35.25 + */
   35.26 +
   35.27 +/**
   35.28 + * @test
   35.29 + * @bug 6369605
   35.30 + * @summary Unconstrained type variables fails to include bounds
   35.31 + * @author mcimadamore
   35.32 + * @compile T6369605a.java
   35.33 + */
   35.34 +import java.util.List;
   35.35 +
   35.36 +class T6369605a {
   35.37 +    static <T extends List<T>> T m1() {
   35.38 +        return null;
   35.39 +    }
   35.40 +
   35.41 +    static <T extends List<U>, U extends List<T>> T m2() {
   35.42 +        return null;
   35.43 +    }
   35.44 +
   35.45 +    static <T extends List<U>, U extends List<V>, V extends List<T>> T m3() {
   35.46 +        return null;
   35.47 +    }
   35.48 +
   35.49 +    List<?> l1 = m1();
   35.50 +    List<?> l2 = m2();
   35.51 +    List<?> l3 = m3();
   35.52 +}
   35.53 +
    36.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    36.2 +++ b/test/tools/javac/generics/inference/6369605/T6369605b.java	Mon Aug 23 19:14:55 2010 -0700
    36.3 @@ -0,0 +1,49 @@
    36.4 +/*
    36.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    36.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.7 + *
    36.8 + * This code is free software; you can redistribute it and/or modify it
    36.9 + * under the terms of the GNU General Public License version 2 only, as
   36.10 + * published by the Free Software Foundation.
   36.11 + *
   36.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   36.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   36.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   36.15 + * version 2 for more details (a copy is included in the LICENSE file that
   36.16 + * accompanied this code).
   36.17 + *
   36.18 + * You should have received a copy of the GNU General Public License version
   36.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   36.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   36.21 + *
   36.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   36.23 + * or visit www.oracle.com if you need additional information or have any
   36.24 + * questions.
   36.25 + */
   36.26 +
   36.27 +/**
   36.28 + * @test
   36.29 + * @bug 6369605
   36.30 + * @summary Unconstrained type variables fails to include bounds
   36.31 + * @author mcimadamore
   36.32 + * @compile T6369605b.java
   36.33 + */
   36.34 +import java.util.List;
   36.35 +
   36.36 +class T6369605b {
   36.37 +    static <T extends List<X>, X> List<T> m1() {
   36.38 +        return null;
   36.39 +    }
   36.40 +
   36.41 +    static <T extends List<U>, U extends List<X>, X> List<T> m2() {
   36.42 +        return null;
   36.43 +    }
   36.44 +
   36.45 +    static <T extends List<U>, U extends List<V>, V extends List<X>, X> List<T> m3() {
   36.46 +        return null;
   36.47 +    }
   36.48 +
   36.49 +    List<?> l1 = m1();
   36.50 +    List<?> l2 = m2();
   36.51 +    List<?> l3 = m3();
   36.52 +}
    37.1 --- a/test/tools/javac/generics/inference/6638712/T6638712a.out	Thu Aug 19 15:13:23 2010 -0700
    37.2 +++ b/test/tools/javac/generics/inference/6638712/T6638712a.out	Mon Aug 23 19:14:55 2010 -0700
    37.3 @@ -1,2 +1,2 @@
    37.4 -T6638712a.java:16:41: compiler.err.invalid.inferred.types: T, (compiler.misc.inferred.do.not.conform.to.params: java.lang.Iterable<? extends java.util.Comparator<? super java.lang.String>>, java.util.List<java.util.Comparator<?>>)
    37.5 +T6638712a.java:16:41: compiler.err.prob.found.req: (compiler.misc.incompatible.types.1: (compiler.misc.no.conforming.instance.exists: T, java.util.Comparator<T>, java.util.Comparator<java.lang.String>)), <T>java.util.Comparator<T>, java.util.Comparator<java.lang.String>
    37.6  1 error
    38.1 --- a/test/tools/javac/generics/typevars/5060485/Compatibility.java	Thu Aug 19 15:13:23 2010 -0700
    38.2 +++ b/test/tools/javac/generics/typevars/5060485/Compatibility.java	Mon Aug 23 19:14:55 2010 -0700
    38.3 @@ -26,7 +26,7 @@
    38.4   * @bug     5060485
    38.5   * @summary The scope of a class type parameter is too wide
    38.6   * @author  Peter von der Ah\u00e9
    38.7 - * @compile/fail Compatibility.java
    38.8 + * @compile/fail/ref=Compatibility.out -XDrawDiagnostics Compatibility.java
    38.9   */
   38.10  
   38.11  class NumberList<T extends Number> {}
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/test/tools/javac/generics/typevars/5060485/Compatibility.out	Mon Aug 23 19:14:55 2010 -0700
    39.3 @@ -0,0 +1,2 @@
    39.4 +Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y
    39.5 +1 error
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/test/tools/javac/generics/typevars/5060485/Compatibility02.java	Mon Aug 23 19:14:55 2010 -0700
    40.3 @@ -0,0 +1,39 @@
    40.4 +/*
    40.5 + * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
    40.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    40.7 + *
    40.8 + * This code is free software; you can redistribute it and/or modify it
    40.9 + * under the terms of the GNU General Public License version 2 only, as
   40.10 + * published by the Free Software Foundation.
   40.11 + *
   40.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   40.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   40.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   40.15 + * version 2 for more details (a copy is included in the LICENSE file that
   40.16 + * accompanied this code).
   40.17 + *
   40.18 + * You should have received a copy of the GNU General Public License version
   40.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   40.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   40.21 + *
   40.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   40.23 + * or visit www.oracle.com if you need additional information or have any
   40.24 + * questions.
   40.25 + */
   40.26 +
   40.27 +/*
   40.28 + * @test
   40.29 + * @bug     5060485 6977800
   40.30 + * @summary The scope of a class type parameter is too wide
   40.31 + * @author  Maurizio Cimadamore
   40.32 + * @compile/fail/ref=Compatibility02.out -XDrawDiagnostics Compatibility.java
   40.33 + */
   40.34 +
   40.35 +class NumberList<T extends Number> {}
   40.36 +
   40.37 +class Test {
   40.38 +    <Y extends Number> void m() {
   40.39 +        static class Y {}
   40.40 +        class Y1<S extends NumberList<Y>> {}
   40.41 +    }
   40.42 +}
    41.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.2 +++ b/test/tools/javac/generics/typevars/5060485/Compatibility02.out	Mon Aug 23 19:14:55 2010 -0700
    41.3 @@ -0,0 +1,2 @@
    41.4 +Compatibility.java:36:35: compiler.err.not.within.bounds: Test.Y
    41.5 +1 error
    42.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.2 +++ b/test/tools/javac/generics/wildcards/6886247/T6886247_1.java	Mon Aug 23 19:14:55 2010 -0700
    42.3 @@ -0,0 +1,40 @@
    42.4 +/*
    42.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    42.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    42.7 + *
    42.8 + * This code is free software; you can redistribute it and/or modify it
    42.9 + * under the terms of the GNU General Public License version 2 only, as
   42.10 + * published by the Free Software Foundation.
   42.11 + *
   42.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   42.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   42.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   42.15 + * version 2 for more details (a copy is included in the LICENSE file that
   42.16 + * accompanied this code).
   42.17 + *
   42.18 + * You should have received a copy of the GNU General Public License version
   42.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   42.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   42.21 + *
   42.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   42.23 + * or visit www.oracle.com if you need additional information or have any
   42.24 + * questions.
   42.25 + */
   42.26 +
   42.27 +/*
   42.28 + * @test
   42.29 + * @bug     6886247
   42.30 + * @author Maurizio Cimadamore
   42.31 + * @summary regression: javac crashes with an assertion error in Attr.java
   42.32 + * @compile T6886247_1.java
   42.33 + */
   42.34 +class Outer<E> {
   42.35 +
   42.36 +   public void method(Outer<? extends E>.Inner inner) {
   42.37 +       E entry = inner.getE();
   42.38 +   }
   42.39 +
   42.40 +   class Inner {
   42.41 +       E getE() {return null;}
   42.42 +   }
   42.43 +}
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/test/tools/javac/generics/wildcards/6886247/T6886247_2.java	Mon Aug 23 19:14:55 2010 -0700
    43.3 @@ -0,0 +1,41 @@
    43.4 +/*
    43.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    43.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.7 + *
    43.8 + * This code is free software; you can redistribute it and/or modify it
    43.9 + * under the terms of the GNU General Public License version 2 only, as
   43.10 + * published by the Free Software Foundation.
   43.11 + *
   43.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   43.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   43.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   43.15 + * version 2 for more details (a copy is included in the LICENSE file that
   43.16 + * accompanied this code).
   43.17 + *
   43.18 + * You should have received a copy of the GNU General Public License version
   43.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   43.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   43.21 + *
   43.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   43.23 + * or visit www.oracle.com if you need additional information or have any
   43.24 + * questions.
   43.25 + */
   43.26 +
   43.27 +/*
   43.28 + * @test
   43.29 + * @bug     6886247
   43.30 + * @author Maurizio Cimadamore
   43.31 + * @summary regression: javac crashes with an assertion error in Attr.java
   43.32 + * @compile/fail/ref=T6886247_2.out -XDrawDiagnostics T6886247_2.java
   43.33 + */
   43.34 +
   43.35 +class Outer<E> {
   43.36 +
   43.37 +   public void method(Outer<?>.Inner inner) {
   43.38 +       E entry = inner.getE();
   43.39 +   }
   43.40 +
   43.41 +   class Inner {
   43.42 +       E getE() {return null;}
   43.43 +   }
   43.44 +}
    44.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    44.2 +++ b/test/tools/javac/generics/wildcards/6886247/T6886247_2.out	Mon Aug 23 19:14:55 2010 -0700
    44.3 @@ -0,0 +1,2 @@
    44.4 +T6886247_2.java:35:28: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.type.captureof: 1, ?, E
    44.5 +1 error
    45.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    45.2 +++ b/test/tools/javac/multicatch/T6978574.java	Mon Aug 23 19:14:55 2010 -0700
    45.3 @@ -0,0 +1,54 @@
    45.4 +/*
    45.5 + * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    45.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    45.7 + *
    45.8 + * This code is free software; you can redistribute it and/or modify it
    45.9 + * under the terms of the GNU General Public License version 2 only, as
   45.10 + * published by the Free Software Foundation.
   45.11 + *
   45.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   45.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   45.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   45.15 + * version 2 for more details (a copy is included in the LICENSE file that
   45.16 + * accompanied this code).
   45.17 + *
   45.18 + * You should have received a copy of the GNU General Public License version
   45.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   45.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   45.21 + *
   45.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   45.23 + * or visit www.oracle.com if you need additional information or have any
   45.24 + * questions.
   45.25 + */
   45.26 +
   45.27 +/*
   45.28 + * @test
   45.29 + * @bug 6978574
   45.30 + * @summary  return statement in try block with multi-catch causes ClassFormatError
   45.31 + */
   45.32 +
   45.33 +public class T6978574  {
   45.34 +    static class A extends Exception { }
   45.35 +    static class B extends Exception { }
   45.36 +
   45.37 +    static void foo() throws A { throw new A(); }
   45.38 +    static void bar() throws B { throw new B(); }
   45.39 +
   45.40 +    static void test(boolean b) {
   45.41 +        try {
   45.42 +            if (b) foo(); else bar();
   45.43 +            return; // This should *not* cause ClassFormatError
   45.44 +        } catch (final A | B e ) { caught = true; }
   45.45 +        return;
   45.46 +    }
   45.47 +
   45.48 +    static boolean caught = false;
   45.49 +
   45.50 +    public static void main(String[] args) {
   45.51 +        test(true);
   45.52 +        if (!caught) throw new AssertionError();
   45.53 +        caught = false;
   45.54 +        test(false);
   45.55 +        if (!caught) throw new AssertionError();
   45.56 +    }
   45.57 +}
    46.1 --- a/test/tools/javac/processing/filer/TestLastRound.out	Thu Aug 19 15:13:23 2010 -0700
    46.2 +++ b/test/tools/javac/processing/filer/TestLastRound.out	Mon Aug 23 19:14:55 2010 -0700
    46.3 @@ -1,3 +1,4 @@
    46.4  - compiler.warn.proc.file.create.last.round: LastRound.java
    46.5  - compiler.err.warnings.and.werror
    46.6  1 error
    46.7 +1 warning
    47.1 --- a/test/tools/javac/warnings/6747671/T6747671.java	Thu Aug 19 15:13:23 2010 -0700
    47.2 +++ b/test/tools/javac/warnings/6747671/T6747671.java	Mon Aug 23 19:14:55 2010 -0700
    47.3 @@ -27,8 +27,8 @@
    47.4      A<B>.Z<A<B>> z3;//raw warning (2)
    47.5  
    47.6      void test(Object arg1, B arg2) {//raw warning
    47.7 -        boolean b = arg1 instanceof A;//raw warning
    47.8 -        Object a = (A)arg1;//raw warning
    47.9 +        boolean b = arg1 instanceof A;//ok
   47.10 +        Object a = (A)arg1;//ok
   47.11          A a2 = new A() {};//raw warning (2)
   47.12          a2.new Z() {};//raw warning
   47.13      }
    48.1 --- a/test/tools/javac/warnings/6747671/T6747671.out	Thu Aug 19 15:13:23 2010 -0700
    48.2 +++ b/test/tools/javac/warnings/6747671/T6747671.out	Mon Aug 23 19:14:55 2010 -0700
    48.3 @@ -4,9 +4,7 @@
    48.4  T6747671.java:27:14: compiler.warn.raw.class.use: T6747671.B, T6747671.B<X>
    48.5  T6747671.java:27:7: compiler.warn.raw.class.use: T6747671.B, T6747671.B<X>
    48.6  T6747671.java:29:28: compiler.warn.raw.class.use: T6747671.B, T6747671.B<X>
    48.7 -T6747671.java:30:37: compiler.warn.raw.class.use: T6747671.A, T6747671<E>.A<X>
    48.8 -T6747671.java:31:21: compiler.warn.raw.class.use: T6747671.A, T6747671<E>.A<X>
    48.9  T6747671.java:32:9: compiler.warn.raw.class.use: T6747671.A, T6747671<E>.A<X>
   48.10  T6747671.java:32:20: compiler.warn.raw.class.use: T6747671.A, T6747671<E>.A<X>
   48.11  T6747671.java:33:16: compiler.warn.raw.class.use: T6747671.A.Z, T6747671<E>.A<X>.Z<Y>
   48.12 -11 warnings
   48.13 +9 warnings
    49.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    49.2 +++ b/test/tools/javac/warnings/6885255/T6885255.java	Mon Aug 23 19:14:55 2010 -0700
    49.3 @@ -0,0 +1,31 @@
    49.4 +/**
    49.5 + * @test /nodynamiccopyright/
    49.6 + * @bug 6885255
    49.7 + * @summary -Xlint:rawtypes
    49.8 + * @compile/ref=T6885255.out -XDrawDiagnostics -Xlint:rawtypes T6885255.java
    49.9 + */
   49.10 +
   49.11 +class T6885255 {
   49.12 +
   49.13 +    static class Test<X, Y> {}
   49.14 +
   49.15 +    Class<Test> ct; //no warn - outer Class w/ raw param
   49.16 +    Class<Test<Test, Test>> ctt; //warn - outer Class w/o raw param (2)
   49.17 +
   49.18 +    Class<Class<Test>> cct; //warn - outer Class w/o raw param
   49.19 +    Class<Class<Test<Test, Test>>> cctt; //warn - outer Class w/o raw param (2)
   49.20 +
   49.21 +    Object o1 = (Test)null; //no warn - outer raw and cast
   49.22 +    Object o2 = (Test<Test, Test>)null; //warn - inner raw (2)
   49.23 +
   49.24 +    Object o3 = (Class)null; //no warn - outer raw and cast
   49.25 +    Object o4 = (Class<Test>)null; //no warn - outer Class w/ raw param
   49.26 +
   49.27 +    Object o5 = (Class<Test<Test, Test>>)null; //warn - outer Class w/ non raw param (2)
   49.28 +    Object o6 = (Class<Class<Test<Test, Test>>>)null; //warn - outer Class w/ non raw param (2)
   49.29 +
   49.30 +    Object o7 = (Test<Class, Class>)null; //warn - inner raw (2)
   49.31 +    Object o8 = (Test<Class<Test>, Class<Test>>)null; //warn - inner Class (2)
   49.32 +
   49.33 +    boolean b = null instanceof Test; //no warn - raw and instanceof
   49.34 +}
    50.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    50.2 +++ b/test/tools/javac/warnings/6885255/T6885255.out	Mon Aug 23 19:14:55 2010 -0700
    50.3 @@ -0,0 +1,16 @@
    50.4 +T6885255.java:13:16: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
    50.5 +T6885255.java:13:22: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
    50.6 +T6885255.java:15:17: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
    50.7 +T6885255.java:16:22: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
    50.8 +T6885255.java:16:28: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
    50.9 +T6885255.java:19:23: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
   50.10 +T6885255.java:19:29: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
   50.11 +T6885255.java:24:29: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
   50.12 +T6885255.java:24:35: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
   50.13 +T6885255.java:25:35: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
   50.14 +T6885255.java:25:41: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
   50.15 +T6885255.java:27:23: compiler.warn.raw.class.use: java.lang.Class, java.lang.Class<T>
   50.16 +T6885255.java:27:30: compiler.warn.raw.class.use: java.lang.Class, java.lang.Class<T>
   50.17 +T6885255.java:28:29: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
   50.18 +T6885255.java:28:42: compiler.warn.raw.class.use: T6885255.Test, T6885255.Test<X,Y>
   50.19 +15 warnings

mercurial