Merge

Fri, 24 Oct 2008 20:47:47 -0700

author
tbell
date
Fri, 24 Oct 2008 20:47:47 -0700
changeset 163
8d7fa40da0eb
parent 152
3fb51e47622b
parent 162
638d45788c9e
child 164
5ebe90e0afff

Merge

test/tools/javac/generics/wildcards/6651719/T6651719b.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/api/Formattable.java	Thu Oct 23 21:56:41 2008 -0700
     1.2 +++ b/src/share/classes/com/sun/tools/javac/api/Formattable.java	Fri Oct 24 20:47:47 2008 -0700
     1.3 @@ -49,4 +49,23 @@
     1.4       * @return a string representing the object's kind
     1.5       */
     1.6      String getKind();
     1.7 +
     1.8 +    static class LocalizedString implements Formattable {
     1.9 +        String key;
    1.10 +
    1.11 +        public LocalizedString(String key) {
    1.12 +            this.key = key;
    1.13 +        }
    1.14 +
    1.15 +        public String toString(java.util.Locale l, Messages messages) {
    1.16 +            return messages.getLocalizedString(l, key);
    1.17 +        }
    1.18 +        public String getKind() {
    1.19 +            return "LocalizedString";
    1.20 +        }
    1.21 +
    1.22 +        public String toString() {
    1.23 +            return key;
    1.24 +        }
    1.25 +    }
    1.26  }
     2.1 --- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Oct 23 21:56:41 2008 -0700
     2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Fri Oct 24 20:47:47 2008 -0700
     2.3 @@ -361,6 +361,8 @@
     2.4              for (Symbol sup = clazz;
     2.5                   sup != null && sup != this.owner;
     2.6                   sup = types.supertype(sup.type).tsym) {
     2.7 +                while (sup.type.tag == TYPEVAR)
     2.8 +                    sup = sup.type.getUpperBound().tsym;
     2.9                  if (sup.type.isErroneous())
    2.10                      return true; // error recovery
    2.11                  if ((sup.flags() & COMPOUND) != 0)
    2.12 @@ -1183,7 +1185,9 @@
    2.13           *  as possible implementations.
    2.14           */
    2.15          public MethodSymbol implementation(TypeSymbol origin, Types types, boolean checkResult) {
    2.16 -            for (Type t = origin.type; t.tag == CLASS; t = types.supertype(t)) {
    2.17 +            for (Type t = origin.type; t.tag == CLASS || t.tag == TYPEVAR; t = types.supertype(t)) {
    2.18 +                while (t.tag == TYPEVAR)
    2.19 +                    t = t.getUpperBound();
    2.20                  TypeSymbol c = t.tsym;
    2.21                  for (Scope.Entry e = c.members().lookup(name);
    2.22                       e.scope != null;
     3.1 --- a/src/share/classes/com/sun/tools/javac/code/Type.java	Thu Oct 23 21:56:41 2008 -0700
     3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Type.java	Fri Oct 24 20:47:47 2008 -0700
     3.3 @@ -360,17 +360,6 @@
     3.4      public boolean isUnbound() { return false; }
     3.5      public Type withTypeVar(Type t) { return this; }
     3.6  
     3.7 -    public static List<Type> removeBounds(List<Type> ts) {
     3.8 -        ListBuffer<Type> result = new ListBuffer<Type>();
     3.9 -        for(;ts.nonEmpty(); ts = ts.tail) {
    3.10 -            result.append(ts.head.removeBounds());
    3.11 -        }
    3.12 -        return result.toList();
    3.13 -    }
    3.14 -    public Type removeBounds() {
    3.15 -        return this;
    3.16 -    }
    3.17 -
    3.18      /** The underlying method type of this type.
    3.19       */
    3.20      public MethodType asMethodType() { throw new AssertionError(); }
    3.21 @@ -489,10 +478,6 @@
    3.22                  return new WildcardType(t, kind, tsym, bound);
    3.23          }
    3.24  
    3.25 -        public Type removeBounds() {
    3.26 -            return isUnbound() ? this : type;
    3.27 -        }
    3.28 -
    3.29          public Type getExtendsBound() {
    3.30              if (kind == EXTENDS)
    3.31                  return type;
     4.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java	Thu Oct 23 21:56:41 2008 -0700
     4.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java	Fri Oct 24 20:47:47 2008 -0700
     4.3 @@ -709,16 +709,13 @@
     4.4          case UNDETVAR:
     4.5              if (s.tag == WILDCARD) {
     4.6                  UndetVar undetvar = (UndetVar)t;
     4.7 -
     4.8 -                // Because of wildcard capture, s must be on the left
     4.9 -                // hand side of an assignment.  Furthermore, t is an
    4.10 -                // underconstrained type variable, for example, one
    4.11 -                // that is only used in the return type of a method.
    4.12 -                // If the type variable is truly underconstrained, it
    4.13 -                // cannot have any low bounds:
    4.14 -                assert undetvar.lobounds.isEmpty() : undetvar;
    4.15 -
    4.16                  undetvar.inst = glb(upperBound(s), undetvar.inst);
    4.17 +                // We should check instantiated type against any of the
    4.18 +                // undetvar's lower bounds.
    4.19 +                for (Type t2 : undetvar.lobounds) {
    4.20 +                    if (!isSubtype(t2, undetvar.inst))
    4.21 +                        return false;
    4.22 +                }
    4.23                  return true;
    4.24              } else {
    4.25                  return isSameType(t, s);
    4.26 @@ -3367,33 +3364,67 @@
    4.27       * quantifiers) only
    4.28       */
    4.29      private Type rewriteQuantifiers(Type t, boolean high, boolean rewriteTypeVars) {
    4.30 -        ListBuffer<Type> from = new ListBuffer<Type>();
    4.31 -        ListBuffer<Type> to = new ListBuffer<Type>();
    4.32 -        adaptSelf(t, from, to);
    4.33 -        ListBuffer<Type> rewritten = new ListBuffer<Type>();
    4.34 -        List<Type> formals = from.toList();
    4.35 -        boolean changed = false;
    4.36 -        for (Type arg : to.toList()) {
    4.37 -            Type bound;
    4.38 -            if (rewriteTypeVars && arg.tag == TYPEVAR) {
    4.39 -                TypeVar tv = (TypeVar)arg;
    4.40 -                bound = high ? tv.bound : syms.botType;
    4.41 -            } else {
    4.42 -                bound = high ? upperBound(arg) : lowerBound(arg);
    4.43 +        return new Rewriter(high, rewriteTypeVars).rewrite(t);
    4.44 +    }
    4.45 +
    4.46 +    class Rewriter extends UnaryVisitor<Type> {
    4.47 +
    4.48 +        boolean high;
    4.49 +        boolean rewriteTypeVars;
    4.50 +
    4.51 +        Rewriter(boolean high, boolean rewriteTypeVars) {
    4.52 +            this.high = high;
    4.53 +            this.rewriteTypeVars = rewriteTypeVars;
    4.54 +        }
    4.55 +
    4.56 +        Type rewrite(Type t) {
    4.57 +            ListBuffer<Type> from = new ListBuffer<Type>();
    4.58 +            ListBuffer<Type> to = new ListBuffer<Type>();
    4.59 +            adaptSelf(t, from, to);
    4.60 +            ListBuffer<Type> rewritten = new ListBuffer<Type>();
    4.61 +            List<Type> formals = from.toList();
    4.62 +            boolean changed = false;
    4.63 +            for (Type arg : to.toList()) {
    4.64 +                Type bound = visit(arg);
    4.65 +                if (arg != bound) {
    4.66 +                    changed = true;
    4.67 +                    bound = high ? makeExtendsWildcard(bound, (TypeVar)formals.head)
    4.68 +                              : makeSuperWildcard(bound, (TypeVar)formals.head);
    4.69 +                }
    4.70 +                rewritten.append(bound);
    4.71 +                formals = formals.tail;
    4.72              }
    4.73 -            Type newarg = bound;
    4.74 -            if (arg != bound) {
    4.75 -                changed = true;
    4.76 -                newarg = high ? makeExtendsWildcard(bound, (TypeVar)formals.head)
    4.77 -                              : makeSuperWildcard(bound, (TypeVar)formals.head);
    4.78 -            }
    4.79 -            rewritten.append(newarg);
    4.80 -            formals = formals.tail;
    4.81 +            if (changed)
    4.82 +                return subst(t.tsym.type, from.toList(), rewritten.toList());
    4.83 +            else
    4.84 +                return t;
    4.85          }
    4.86 -        if (changed)
    4.87 -            return subst(t.tsym.type, from.toList(), rewritten.toList());
    4.88 -        else
    4.89 -            return t;
    4.90 +
    4.91 +        public Type visitType(Type t, Void s) {
    4.92 +            return high ? upperBound(t) : lowerBound(t);
    4.93 +        }
    4.94 +
    4.95 +        @Override
    4.96 +        public Type visitCapturedType(CapturedType t, Void s) {
    4.97 +            return visitWildcardType(t.wildcard, null);
    4.98 +        }
    4.99 +
   4.100 +        @Override
   4.101 +        public Type visitTypeVar(TypeVar t, Void s) {
   4.102 +            if (rewriteTypeVars)
   4.103 +                return high ? t.bound : syms.botType;
   4.104 +            else
   4.105 +                return t;
   4.106 +        }
   4.107 +
   4.108 +        @Override
   4.109 +        public Type visitWildcardType(WildcardType t, Void s) {
   4.110 +            Type bound = high ? t.getExtendsBound() :
   4.111 +                                t.getSuperBound();
   4.112 +            if (bound == null)
   4.113 +                bound = high ? syms.objectType : syms.botType;
   4.114 +            return bound;
   4.115 +        }
   4.116      }
   4.117  
   4.118      /**
     5.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Oct 23 21:56:41 2008 -0700
     5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Fri Oct 24 20:47:47 2008 -0700
     5.3 @@ -2007,6 +2007,10 @@
     5.4                      log.error(pos, "type.var.cant.be.deref");
     5.5                      return syms.errSymbol;
     5.6                  } else {
     5.7 +                    Symbol sym2 = (sym.flags() & Flags.PRIVATE) != 0 ?
     5.8 +                        rs.new AccessError(env, site, sym) :
     5.9 +                                sym;
    5.10 +                    rs.access(sym2, pos, site, name, true);
    5.11                      return sym;
    5.12                  }
    5.13              case ERROR:
    5.14 @@ -2374,16 +2378,14 @@
    5.15              }
    5.16  
    5.17              if (warned && sym.type.tag == FORALL) {
    5.18 -                String typeargs = "";
    5.19 -                if (typeargtypes != null && typeargtypes.nonEmpty()) {
    5.20 -                    typeargs = "<" + Type.toString(typeargtypes) + ">";
    5.21 -                }
    5.22                  chk.warnUnchecked(env.tree.pos(),
    5.23                                    "unchecked.meth.invocation.applied",
    5.24 -                                  sym,
    5.25 -                                  sym.location(),
    5.26 -                                  typeargs,
    5.27 -                                  Type.toString(argtypes));
    5.28 +                                  kindName(sym),
    5.29 +                                  sym.name,
    5.30 +                                  rs.methodArguments(sym.type.getParameterTypes()),
    5.31 +                                  rs.methodArguments(argtypes),
    5.32 +                                  kindName(sym.location()),
    5.33 +                                  sym.location());
    5.34                  owntype = new MethodType(owntype.getParameterTypes(),
    5.35                                           types.erasure(owntype.getReturnType()),
    5.36                                           owntype.getThrownTypes(),
    5.37 @@ -2516,7 +2518,10 @@
    5.38              // accept class or interface or typevar as first bound.
    5.39              Type b = checkBase(bs.head, tree.bounds.head, env, false, false, false);
    5.40              boundSet.add(types.erasure(b));
    5.41 -            if (b.tag == TYPEVAR) {
    5.42 +            if (b.isErroneous()) {
    5.43 +                a.bound = b;
    5.44 +            }
    5.45 +            else if (b.tag == TYPEVAR) {
    5.46                  // if first bound was a typevar, do not accept further bounds.
    5.47                  if (tree.bounds.tail.nonEmpty()) {
    5.48                      log.error(tree.bounds.tail.head.pos(),
    5.49 @@ -2530,7 +2535,9 @@
    5.50                  for (JCExpression bound : tree.bounds.tail) {
    5.51                      bs = bs.tail;
    5.52                      Type i = checkBase(bs.head, bound, env, false, true, false);
    5.53 -                    if (i.tag == CLASS)
    5.54 +                    if (i.isErroneous())
    5.55 +                        a.bound = i;
    5.56 +                    else if (i.tag == CLASS)
    5.57                          chk.checkNotRepeated(bound.pos(), types.erasure(i), boundSet);
    5.58                  }
    5.59              }
     6.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Oct 23 21:56:41 2008 -0700
     6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Fri Oct 24 20:47:47 2008 -0700
     6.3 @@ -424,43 +424,43 @@
     6.4       *  @param bs            The bound.
     6.5       */
     6.6      private void checkExtends(DiagnosticPosition pos, Type a, TypeVar bs) {
     6.7 -        if (a.tag == TYPEVAR && ((TypeVar)a).isCaptured()) {
     6.8 -            CapturedType ct = (CapturedType)a;
     6.9 -            boolean ok;
    6.10 -            if (ct.bound.isErroneous()) {//capture doesn't exist
    6.11 -                ok = false;
    6.12 +         if (a.isUnbound()) {
    6.13 +             return;
    6.14 +         } else if (a.tag != WILDCARD) {
    6.15 +             a = types.upperBound(a);
    6.16 +             for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) {
    6.17 +                 if (!types.isSubtype(a, l.head)) {
    6.18 +                     log.error(pos, "not.within.bounds", a);
    6.19 +                     return;
    6.20 +                 }
    6.21 +             }
    6.22 +         } else if (a.isExtendsBound()) {
    6.23 +             if (!types.isCastable(bs.getUpperBound(), types.upperBound(a), Warner.noWarnings))
    6.24 +                 log.error(pos, "not.within.bounds", a);
    6.25 +         } else if (a.isSuperBound()) {
    6.26 +             if (types.notSoftSubtype(types.lowerBound(a), bs.getUpperBound()))
    6.27 +                 log.error(pos, "not.within.bounds", a);
    6.28 +         }
    6.29 +     }
    6.30 +
    6.31 +    /** Check that a type is within some bounds.
    6.32 +     *
    6.33 +     *  Used in TypeApply to verify that, e.g., X in V<X> is a valid
    6.34 +     *  type argument.
    6.35 +     *  @param pos           Position to be used for error reporting.
    6.36 +     *  @param a             The type that should be bounded by bs.
    6.37 +     *  @param bs            The bound.
    6.38 +     */
    6.39 +    private void checkCapture(JCTypeApply tree) {
    6.40 +        List<JCExpression> args = tree.getTypeArguments();
    6.41 +        for (Type arg : types.capture(tree.type).getTypeArguments()) {
    6.42 +            if (arg.tag == TYPEVAR && arg.getUpperBound().isErroneous()) {
    6.43 +                log.error(args.head.pos, "not.within.bounds", args.head.type);
    6.44 +                break;
    6.45              }
    6.46 -            else {
    6.47 -                switch (ct.wildcard.kind) {
    6.48 -                    case EXTENDS:
    6.49 -                        ok = types.isCastable(bs.getUpperBound(),
    6.50 -                                types.upperBound(a),
    6.51 -                                Warner.noWarnings);
    6.52 -                        break;
    6.53 -                    case SUPER:
    6.54 -                        ok = !types.notSoftSubtype(types.lowerBound(a),
    6.55 -                                bs.getUpperBound());
    6.56 -                        break;
    6.57 -                    case UNBOUND:
    6.58 -                        ok = true;
    6.59 -                        break;
    6.60 -                    default:
    6.61 -                        throw new AssertionError("Invalid bound kind");
    6.62 -                }
    6.63 -            }
    6.64 -            if (!ok)
    6.65 -                log.error(pos, "not.within.bounds", a);
    6.66 +            args = args.tail;
    6.67          }
    6.68 -        else {
    6.69 -            a = types.upperBound(a);
    6.70 -            for (List<Type> l = types.getBounds(bs); l.nonEmpty(); l = l.tail) {
    6.71 -                if (!types.isSubtype(a, l.head)) {
    6.72 -                    log.error(pos, "not.within.bounds", a);
    6.73 -                    return;
    6.74 -                }
    6.75 -            }
    6.76 -        }
    6.77 -    }
    6.78 +     }
    6.79  
    6.80      /** Check that type is different from 'void'.
    6.81       *  @param pos           Position to be used for error reporting.
    6.82 @@ -802,10 +802,10 @@
    6.83  
    6.84          public void visitTypeApply(JCTypeApply tree) {
    6.85              if (tree.type.tag == CLASS) {
    6.86 -                List<Type> formals = tree.type.tsym.type.getTypeArguments();
    6.87 -                List<Type> actuals = types.capture(tree.type).getTypeArguments();
    6.88 +                List<Type> formals = tree.type.tsym.type.allparams();
    6.89 +                List<Type> actuals = tree.type.allparams();
    6.90                  List<JCExpression> args = tree.arguments;
    6.91 -                List<Type> forms = formals;
    6.92 +                List<Type> forms = tree.type.tsym.type.getTypeArguments();
    6.93                  ListBuffer<TypeVar> tvars_buf = new ListBuffer<TypeVar>();
    6.94  
    6.95                  // For matching pairs of actual argument types `a' and
    6.96 @@ -826,24 +826,28 @@
    6.97                  }
    6.98  
    6.99                  args = tree.arguments;
   6.100 +                List<Type> tvars_cap = types.substBounds(formals,
   6.101 +                                          formals,
   6.102 +                                          types.capture(tree.type).allparams());
   6.103 +                while (args.nonEmpty() && tvars_cap.nonEmpty()) {
   6.104 +                    // Let the actual arguments know their bound
   6.105 +                    args.head.type.withTypeVar((TypeVar)tvars_cap.head);
   6.106 +                    args = args.tail;
   6.107 +                    tvars_cap = tvars_cap.tail;
   6.108 +                }
   6.109 +
   6.110 +                args = tree.arguments;
   6.111                  List<TypeVar> tvars = tvars_buf.toList();
   6.112 +
   6.113                  while (args.nonEmpty() && tvars.nonEmpty()) {
   6.114 -                    // Let the actual arguments know their bound
   6.115 -                    args.head.type.withTypeVar(tvars.head);
   6.116 +                    checkExtends(args.head.pos(),
   6.117 +                                 args.head.type,
   6.118 +                                 tvars.head);
   6.119                      args = args.tail;
   6.120                      tvars = tvars.tail;
   6.121                  }
   6.122  
   6.123 -                args = tree.arguments;
   6.124 -                tvars = tvars_buf.toList();
   6.125 -                while (args.nonEmpty() && tvars.nonEmpty()) {
   6.126 -                    checkExtends(args.head.pos(),
   6.127 -                                 actuals.head,
   6.128 -                                 tvars.head);
   6.129 -                    args = args.tail;
   6.130 -                    tvars = tvars.tail;
   6.131 -                    actuals = actuals.tail;
   6.132 -                }
   6.133 +                checkCapture(tree);
   6.134  
   6.135                  // Check that this type is either fully parameterized, or
   6.136                  // not parameterized at all.
     7.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Oct 23 21:56:41 2008 -0700
     7.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Fri Oct 24 20:47:47 2008 -0700
     7.3 @@ -30,6 +30,8 @@
     7.4  import com.sun.tools.javac.code.*;
     7.5  import com.sun.tools.javac.jvm.*;
     7.6  import com.sun.tools.javac.tree.*;
     7.7 +import com.sun.tools.javac.api.Formattable.LocalizedString;
     7.8 +import static com.sun.tools.javac.comp.Resolve.MethodResolutionPhase.*;
     7.9  
    7.10  import com.sun.tools.javac.code.Type.*;
    7.11  import com.sun.tools.javac.code.Symbol.*;
    7.12 @@ -40,6 +42,9 @@
    7.13  import static com.sun.tools.javac.code.TypeTags.*;
    7.14  import javax.lang.model.element.ElementVisitor;
    7.15  
    7.16 +import java.util.Map;
    7.17 +import java.util.HashMap;
    7.18 +
    7.19  /** Helper class for name resolution, used mostly by the attribution phase.
    7.20   *
    7.21   *  <p><b>This is NOT part of any API supported by Sun Microsystems.  If
    7.22 @@ -554,7 +559,6 @@
    7.23                        boolean useVarargs,
    7.24                        boolean operator) {
    7.25          if (sym.kind == ERR) return bestSoFar;
    7.26 -        if (!sym.isInheritedIn(site.tsym, types)) return bestSoFar;
    7.27          assert sym.kind < AMBIGUOUS;
    7.28          try {
    7.29              if (rawInstantiate(env, site, sym, argtypes, typeargtypes,
    7.30 @@ -651,8 +655,9 @@
    7.31                  // both abstract or both concrete
    7.32                  if (!m1Abstract && !m2Abstract)
    7.33                      return new AmbiguityError(m1, m2);
    7.34 -                // check for same erasure
    7.35 -                if (!types.isSameType(m1.erasure(types), m2.erasure(types)))
    7.36 +                // check that both signatures have the same erasure
    7.37 +                if (!types.isSameTypes(m1.erasure(types).getParameterTypes(),
    7.38 +                                       m2.erasure(types).getParameterTypes()))
    7.39                      return new AmbiguityError(m1, m2);
    7.40                  // both abstract, neither overridden; merge throws clause and result type
    7.41                  Symbol result;
    7.42 @@ -1192,15 +1197,23 @@
    7.43                           Name name,
    7.44                           List<Type> argtypes,
    7.45                           List<Type> typeargtypes) {
    7.46 -        Symbol sym = findFun(env, name, argtypes, typeargtypes, false, env.info.varArgs=false);
    7.47 -        if (varargsEnabled && sym.kind >= WRONG_MTHS) {
    7.48 -            sym = findFun(env, name, argtypes, typeargtypes, true, false);
    7.49 -            if (sym.kind >= WRONG_MTHS)
    7.50 -                sym = findFun(env, name, argtypes, typeargtypes, true, env.info.varArgs=true);
    7.51 +        Symbol sym = methodNotFound;
    7.52 +        List<MethodResolutionPhase> steps = methodResolutionSteps;
    7.53 +        while (steps.nonEmpty() &&
    7.54 +               steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
    7.55 +               sym.kind >= ERRONEOUS) {
    7.56 +            sym = findFun(env, name, argtypes, typeargtypes,
    7.57 +                    steps.head.isBoxingRequired,
    7.58 +                    env.info.varArgs = steps.head.isVarargsRequired);
    7.59 +            methodResolutionCache.put(steps.head, sym);
    7.60 +            steps = steps.tail;
    7.61          }
    7.62 -        if (sym.kind >= AMBIGUOUS) {
    7.63 -            sym = access(
    7.64 -                sym, pos, env.enclClass.sym.type, name, false, argtypes, typeargtypes);
    7.65 +        if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
    7.66 +            MethodResolutionPhase errPhase =
    7.67 +                    firstErroneousResolutionPhase();
    7.68 +            sym = access(methodResolutionCache.get(errPhase),
    7.69 +                    pos, env.enclClass.sym.type, name, false, argtypes, typeargtypes);
    7.70 +            env.info.varArgs = errPhase.isVarargsRequired;
    7.71          }
    7.72          return sym;
    7.73      }
    7.74 @@ -1217,17 +1230,23 @@
    7.75      Symbol resolveQualifiedMethod(DiagnosticPosition pos, Env<AttrContext> env,
    7.76                                    Type site, Name name, List<Type> argtypes,
    7.77                                    List<Type> typeargtypes) {
    7.78 -        Symbol sym = findMethod(env, site, name, argtypes, typeargtypes, false,
    7.79 -                                env.info.varArgs=false, false);
    7.80 -        if (varargsEnabled && sym.kind >= WRONG_MTHS) {
    7.81 -            sym = findMethod(env, site, name, argtypes, typeargtypes, true,
    7.82 -                             false, false);
    7.83 -            if (sym.kind >= WRONG_MTHS)
    7.84 -                sym = findMethod(env, site, name, argtypes, typeargtypes, true,
    7.85 -                                 env.info.varArgs=true, false);
    7.86 +        Symbol sym = methodNotFound;
    7.87 +        List<MethodResolutionPhase> steps = methodResolutionSteps;
    7.88 +        while (steps.nonEmpty() &&
    7.89 +               steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
    7.90 +               sym.kind >= ERRONEOUS) {
    7.91 +            sym = findMethod(env, site, name, argtypes, typeargtypes,
    7.92 +                    steps.head.isBoxingRequired(),
    7.93 +                    env.info.varArgs = steps.head.isVarargsRequired(), false);
    7.94 +            methodResolutionCache.put(steps.head, sym);
    7.95 +            steps = steps.tail;
    7.96          }
    7.97 -        if (sym.kind >= AMBIGUOUS) {
    7.98 -            sym = access(sym, pos, site, name, true, argtypes, typeargtypes);
    7.99 +        if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
   7.100 +            MethodResolutionPhase errPhase =
   7.101 +                    firstErroneousResolutionPhase();
   7.102 +            sym = access(methodResolutionCache.get(errPhase),
   7.103 +                    pos, site, name, true, argtypes, typeargtypes);
   7.104 +            env.info.varArgs = errPhase.isVarargsRequired;
   7.105          }
   7.106          return sym;
   7.107      }
   7.108 @@ -1268,14 +1287,22 @@
   7.109                                Type site,
   7.110                                List<Type> argtypes,
   7.111                                List<Type> typeargtypes) {
   7.112 -        Symbol sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, false, env.info.varArgs=false);
   7.113 -        if (varargsEnabled && sym.kind >= WRONG_MTHS) {
   7.114 -            sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, true, false);
   7.115 -            if (sym.kind >= WRONG_MTHS)
   7.116 -                sym = resolveConstructor(pos, env, site, argtypes, typeargtypes, true, env.info.varArgs=true);
   7.117 +        Symbol sym = methodNotFound;
   7.118 +        List<MethodResolutionPhase> steps = methodResolutionSteps;
   7.119 +        while (steps.nonEmpty() &&
   7.120 +               steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
   7.121 +               sym.kind >= ERRONEOUS) {
   7.122 +            sym = resolveConstructor(pos, env, site, argtypes, typeargtypes,
   7.123 +                    steps.head.isBoxingRequired(),
   7.124 +                    env.info.varArgs = steps.head.isVarargsRequired());
   7.125 +            methodResolutionCache.put(steps.head, sym);
   7.126 +            steps = steps.tail;
   7.127          }
   7.128 -        if (sym.kind >= AMBIGUOUS) {
   7.129 -            sym = access(sym, pos, site, names.init, true, argtypes, typeargtypes);
   7.130 +        if (sym.kind >= AMBIGUOUS) {//if nothing is found return the 'first' error
   7.131 +            MethodResolutionPhase errPhase = firstErroneousResolutionPhase();
   7.132 +            sym = access(methodResolutionCache.get(errPhase),
   7.133 +                    pos, site, names.init, true, argtypes, typeargtypes);
   7.134 +            env.info.varArgs = errPhase.isVarargsRequired();
   7.135          }
   7.136          return sym;
   7.137      }
   7.138 @@ -1452,6 +1479,12 @@
   7.139          error.report(log, tree.pos(), type.getEnclosingType(), null, null, null);
   7.140      }
   7.141  
   7.142 +    private final LocalizedString noArgs = new LocalizedString("compiler.misc.no.args");
   7.143 +
   7.144 +    public Object methodArguments(List<Type> argtypes) {
   7.145 +        return argtypes.isEmpty() ? noArgs : argtypes;
   7.146 +    }
   7.147 +
   7.148      /** Root class for resolve errors.
   7.149       *  Instances of this class indicate "Symbol not found".
   7.150       *  Instances of subclass indicate other errors.
   7.151 @@ -1558,8 +1591,8 @@
   7.152                                "cant.apply.symbol" + (explanation != null ? ".1" : ""),
   7.153                                kindname,
   7.154                                ws.name == names.init ? ws.owner.name : ws.name,
   7.155 -                              ws.type.getParameterTypes(),
   7.156 -                              argtypes,
   7.157 +                              methodArguments(ws.type.getParameterTypes()),
   7.158 +                              methodArguments(argtypes),
   7.159                                kindName(ws.owner),
   7.160                                ws.owner.type,
   7.161                                explanation);
   7.162 @@ -1733,4 +1766,50 @@
   7.163                        pair.sym2.location(site, types));
   7.164          }
   7.165      }
   7.166 +
   7.167 +    enum MethodResolutionPhase {
   7.168 +        BASIC(false, false),
   7.169 +        BOX(true, false),
   7.170 +        VARARITY(true, true);
   7.171 +
   7.172 +        boolean isBoxingRequired;
   7.173 +        boolean isVarargsRequired;
   7.174 +
   7.175 +        MethodResolutionPhase(boolean isBoxingRequired, boolean isVarargsRequired) {
   7.176 +           this.isBoxingRequired = isBoxingRequired;
   7.177 +           this.isVarargsRequired = isVarargsRequired;
   7.178 +        }
   7.179 +
   7.180 +        public boolean isBoxingRequired() {
   7.181 +            return isBoxingRequired;
   7.182 +        }
   7.183 +
   7.184 +        public boolean isVarargsRequired() {
   7.185 +            return isVarargsRequired;
   7.186 +        }
   7.187 +
   7.188 +        public boolean isApplicable(boolean boxingEnabled, boolean varargsEnabled) {
   7.189 +            return (varargsEnabled || !isVarargsRequired) &&
   7.190 +                   (boxingEnabled || !isBoxingRequired);
   7.191 +        }
   7.192 +    }
   7.193 +
   7.194 +    private Map<MethodResolutionPhase, Symbol> methodResolutionCache =
   7.195 +        new HashMap<MethodResolutionPhase, Symbol>(MethodResolutionPhase.values().length);
   7.196 +
   7.197 +    final List<MethodResolutionPhase> methodResolutionSteps = List.of(BASIC, BOX, VARARITY);
   7.198 +
   7.199 +    private MethodResolutionPhase firstErroneousResolutionPhase() {
   7.200 +        MethodResolutionPhase bestSoFar = BASIC;
   7.201 +        Symbol sym = methodNotFound;
   7.202 +        List<MethodResolutionPhase> steps = methodResolutionSteps;
   7.203 +        while (steps.nonEmpty() &&
   7.204 +               steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
   7.205 +               sym.kind >= WRONG_MTHS) {
   7.206 +            sym = methodResolutionCache.get(steps.head);
   7.207 +            bestSoFar = steps.head;
   7.208 +            steps = steps.tail;
   7.209 +        }
   7.210 +        return bestSoFar;
   7.211 +    }
   7.212  }
     8.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Oct 23 21:56:41 2008 -0700
     8.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Fri Oct 24 20:47:47 2008 -0700
     8.3 @@ -745,7 +745,10 @@
     8.4  compiler.warn.unchecked.cast.to.type=\
     8.5      [unchecked] unchecked cast to type {0}
     8.6  compiler.warn.unchecked.meth.invocation.applied=\
     8.7 -    [unchecked] unchecked method invocation: {0} in {1} is applied to {2}({3})
     8.8 +    [unchecked] unchecked method invocation: {0} {1} in {4} {5} is applied to given types\n\
     8.9 +    required: {2}\n\
    8.10 +    found: {3}
    8.11 +
    8.12  compiler.warn.unchecked.generic.array.creation=\
    8.13      [unchecked] unchecked generic array creation of type {0} for varargs parameter
    8.14  
    8.15 @@ -1062,6 +1065,9 @@
    8.16      package
    8.17  #####
    8.18  
    8.19 +compiler.misc.no.args=\
    8.20 +    no arguments
    8.21 +
    8.22  compiler.err.override.static=\
    8.23      {0}; overriding method is static
    8.24  compiler.err.override.meth=\
     9.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     9.2 +++ b/test/tools/javac/6758789/T6758789a.java	Fri Oct 24 20:47:47 2008 -0700
     9.3 @@ -0,0 +1,40 @@
     9.4 +/*
     9.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
     9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.7 + *
     9.8 + * This code is free software; you can redistribute it and/or modify it
     9.9 + * under the terms of the GNU General Public License version 2 only, as
    9.10 + * published by the Free Software Foundation.
    9.11 + *
    9.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    9.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    9.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    9.15 + * version 2 for more details (a copy is included in the LICENSE file that
    9.16 + * accompanied this code).
    9.17 + *
    9.18 + * You should have received a copy of the GNU General Public License version
    9.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    9.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    9.21 + *
    9.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
    9.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
    9.24 + * have any questions.
    9.25 + */
    9.26 +
    9.27 +/*
    9.28 + * @test
    9.29 + * @bug 6758789
    9.30 + * @summary 6758789: Some method resolution diagnostic should be improved
    9.31 + * @author Maurizio Cimadamore
    9.32 + *
    9.33 + * @compile/fail/ref=T6758789a.out -XDrawDiagnostics T6758789a.java
    9.34 + */
    9.35 +
    9.36 +class T6758789a {
    9.37 +    void m1() {}
    9.38 +    void m2(int i) {}
    9.39 +    void test() {
    9.40 +        m1(1);
    9.41 +        m2();
    9.42 +    }
    9.43 +}
    10.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    10.2 +++ b/test/tools/javac/6758789/T6758789a.out	Fri Oct 24 20:47:47 2008 -0700
    10.3 @@ -0,0 +1,3 @@
    10.4 +T6758789a.java:37:9: compiler.err.cant.apply.symbol: kindname.method, m1, compiler.misc.no.args, int, kindname.class, T6758789a, null
    10.5 +T6758789a.java:38:9: compiler.err.cant.apply.symbol: kindname.method, m2, int, compiler.misc.no.args, kindname.class, T6758789a, null
    10.6 +2 errors
    10.7 \ No newline at end of file
    11.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    11.2 +++ b/test/tools/javac/6758789/T6758789b.java	Fri Oct 24 20:47:47 2008 -0700
    11.3 @@ -0,0 +1,41 @@
    11.4 +/*
    11.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    11.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    11.7 + *
    11.8 + * This code is free software; you can redistribute it and/or modify it
    11.9 + * under the terms of the GNU General Public License version 2 only, as
   11.10 + * published by the Free Software Foundation.
   11.11 + *
   11.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   11.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   11.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   11.15 + * version 2 for more details (a copy is included in the LICENSE file that
   11.16 + * accompanied this code).
   11.17 + *
   11.18 + * You should have received a copy of the GNU General Public License version
   11.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   11.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   11.21 + *
   11.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   11.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   11.24 + * have any questions.
   11.25 + */
   11.26 +
   11.27 +/*
   11.28 + * @test
   11.29 + * @bug 6758789
   11.30 + * @summary 6758789: Some method resolution diagnostic should be improved
   11.31 + * @author Maurizio Cimadamore
   11.32 + *
   11.33 + * @compile/fail/ref=T6758789b.out -Werror -XDrawDiagnostics -Xlint:unchecked T6758789b.java
   11.34 + */
   11.35 +
   11.36 +class T6758789a {
   11.37 +    class Foo<T> {}
   11.38 +
   11.39 +    <X> void m(Foo<X> foo) {}
   11.40 +
   11.41 +    void test() {
   11.42 +        m(new Foo());
   11.43 +    }
   11.44 +}
    12.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    12.2 +++ b/test/tools/javac/6758789/T6758789b.out	Fri Oct 24 20:47:47 2008 -0700
    12.3 @@ -0,0 +1,3 @@
    12.4 +T6758789b.java:39:11: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6758789a.Foo, T6758789a.Foo<X>
    12.5 +T6758789b.java:39:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6758789a.Foo<X>, T6758789a.Foo, kindname.class, T6758789a
    12.6 +2 warnings
    13.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    13.2 +++ b/test/tools/javac/cast/6548436/T6548436a.java	Fri Oct 24 20:47:47 2008 -0700
    13.3 @@ -0,0 +1,40 @@
    13.4 +/*
    13.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    13.7 + *
    13.8 + * This code is free software; you can redistribute it and/or modify it
    13.9 + * under the terms of the GNU General Public License version 2 only, as
   13.10 + * published by the Free Software Foundation.
   13.11 + *
   13.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   13.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   13.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   13.15 + * version 2 for more details (a copy is included in the LICENSE file that
   13.16 + * accompanied this code).
   13.17 + *
   13.18 + * You should have received a copy of the GNU General Public License version
   13.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   13.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   13.21 + *
   13.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   13.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   13.24 + * have any questions.
   13.25 + */
   13.26 +
   13.27 +/*
   13.28 + * @test
   13.29 + * @bug 6548436
   13.30 + * @summary Incorrect inconvertible types error
   13.31 + * @author Maurizio Cimadamore
   13.32 + *
   13.33 + * @compile T6548436a.java
   13.34 + */
   13.35 +
   13.36 +public class T6548436a {
   13.37 +
   13.38 +    static class Base<E extends Comparable<E>> {}
   13.39 +
   13.40 +    static void test(Base<?> je) {
   13.41 +        Object o = (Base<Integer>)je;
   13.42 +    }
   13.43 +}
    14.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    14.2 +++ b/test/tools/javac/cast/6548436/T6548436b.java	Fri Oct 24 20:47:47 2008 -0700
    14.3 @@ -0,0 +1,40 @@
    14.4 +/*
    14.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    14.7 + *
    14.8 + * This code is free software; you can redistribute it and/or modify it
    14.9 + * under the terms of the GNU General Public License version 2 only, as
   14.10 + * published by the Free Software Foundation.
   14.11 + *
   14.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   14.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   14.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   14.15 + * version 2 for more details (a copy is included in the LICENSE file that
   14.16 + * accompanied this code).
   14.17 + *
   14.18 + * You should have received a copy of the GNU General Public License version
   14.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   14.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   14.21 + *
   14.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   14.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   14.24 + * have any questions.
   14.25 + */
   14.26 +
   14.27 +/*
   14.28 + * @test
   14.29 + * @bug 6548436
   14.30 + * @summary Incorrect inconvertible types error
   14.31 + * @author Maurizio Cimadamore
   14.32 + *
   14.33 + * @compile T6548436b.java
   14.34 + */
   14.35 +
   14.36 +public class T6548436b {
   14.37 +
   14.38 +    enum E { }
   14.39 +
   14.40 +    static void test(Enum<?> o) {
   14.41 +        Object e = (E)o;
   14.42 +    }
   14.43 +}
    15.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    15.2 +++ b/test/tools/javac/cast/6548436/T6548436c.java	Fri Oct 24 20:47:47 2008 -0700
    15.3 @@ -0,0 +1,42 @@
    15.4 +/*
    15.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    15.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    15.7 + *
    15.8 + * This code is free software; you can redistribute it and/or modify it
    15.9 + * under the terms of the GNU General Public License version 2 only, as
   15.10 + * published by the Free Software Foundation.
   15.11 + *
   15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   15.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   15.15 + * version 2 for more details (a copy is included in the LICENSE file that
   15.16 + * accompanied this code).
   15.17 + *
   15.18 + * You should have received a copy of the GNU General Public License version
   15.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   15.21 + *
   15.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   15.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   15.24 + * have any questions.
   15.25 + */
   15.26 +
   15.27 +/*
   15.28 + * @test
   15.29 + * @bug 6548436
   15.30 + * @summary Incorrect inconvertible types error
   15.31 + * @author Maurizio Cimadamore
   15.32 + *
   15.33 + * @compile T6548436c.java
   15.34 + */
   15.35 +
   15.36 +public class T6548436c {
   15.37 +
   15.38 +    interface A<T extends A<? super T>> { }
   15.39 +
   15.40 +    interface B extends A<B> { }
   15.41 +
   15.42 +    static void test(A<?> a) {
   15.43 +        Object o = (B)a;
   15.44 +    }
   15.45 +}
    16.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    16.2 +++ b/test/tools/javac/cast/6548436/T6548436d.java	Fri Oct 24 20:47:47 2008 -0700
    16.3 @@ -0,0 +1,40 @@
    16.4 +/*
    16.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    16.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    16.7 + *
    16.8 + * This code is free software; you can redistribute it and/or modify it
    16.9 + * under the terms of the GNU General Public License version 2 only, as
   16.10 + * published by the Free Software Foundation.
   16.11 + *
   16.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   16.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   16.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   16.15 + * version 2 for more details (a copy is included in the LICENSE file that
   16.16 + * accompanied this code).
   16.17 + *
   16.18 + * You should have received a copy of the GNU General Public License version
   16.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   16.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   16.21 + *
   16.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   16.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   16.24 + * have any questions.
   16.25 + */
   16.26 +
   16.27 +/*
   16.28 + * @test
   16.29 + * @bug 6548436
   16.30 + * @summary Incorrect inconvertible types error
   16.31 + * @author Maurizio Cimadamore
   16.32 + *
   16.33 + * @compile/fail T6548436d.java
   16.34 + */
   16.35 +
   16.36 +public class T6548436d {
   16.37 +
   16.38 +    static class Base<E extends Comparable<E>> {}
   16.39 +
   16.40 +    static void test(Base<? extends Double> je) {
   16.41 +        Object o = (Base<Integer>)je;
   16.42 +    }
   16.43 +}
   16.44 \ No newline at end of file
    17.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    17.2 +++ b/test/tools/javac/generics/6487370/T6487370.java	Fri Oct 24 20:47:47 2008 -0700
    17.3 @@ -0,0 +1,56 @@
    17.4 +/*
    17.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    17.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    17.7 + *
    17.8 + * This code is free software; you can redistribute it and/or modify it
    17.9 + * under the terms of the GNU General Public License version 2 only, as
   17.10 + * published by the Free Software Foundation.
   17.11 + *
   17.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   17.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   17.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   17.15 + * version 2 for more details (a copy is included in the LICENSE file that
   17.16 + * accompanied this code).
   17.17 + *
   17.18 + * You should have received a copy of the GNU General Public License version
   17.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   17.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   17.21 + *
   17.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   17.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   17.24 + * have any questions.
   17.25 + */
   17.26 +
   17.27 +/*
   17.28 + * @test
   17.29 + * @bug     6487370
   17.30 + * @author Maurizio Cimadamore
   17.31 + * @summary javac incorrectly gives ambiguity warning with override-equivalent abstract inherited methods
   17.32 + */
   17.33 +
   17.34 +public class T6487370 {
   17.35 +
   17.36 +    interface I1 {
   17.37 +        String m(Number n);
   17.38 +    }
   17.39 +
   17.40 +    interface I2 {
   17.41 +        Object m(Number n);
   17.42 +    }
   17.43 +
   17.44 +    static abstract class X implements I1, I2 {
   17.45 +        String test() {
   17.46 +            return m(0.0f);
   17.47 +        }
   17.48 +    }
   17.49 +
   17.50 +    static class W extends X {
   17.51 +        public String m(Number n) {
   17.52 +            return "Hello!";
   17.53 +        }
   17.54 +    }
   17.55 +
   17.56 +    public static void main(String args[]) {
   17.57 +        System.out.println(new W().test());
   17.58 +    }
   17.59 +}
    18.1 --- a/test/tools/javac/generics/6531090/T6531090b.java	Thu Oct 23 21:56:41 2008 -0700
    18.2 +++ b/test/tools/javac/generics/6531090/T6531090b.java	Fri Oct 24 20:47:47 2008 -0700
    18.3 @@ -23,7 +23,7 @@
    18.4  
    18.5  /*
    18.6   * @test
    18.7 - * @bug 6531090
    18.8 + * @bug 6531090 6711619
    18.9   *
   18.10   * @summary Cannot access methods/fields of a captured type belonging to an intersection type
   18.11   * @author Maurizio Cimadamore
   18.12 @@ -32,12 +32,20 @@
   18.13  public class T6531090b {
   18.14  
   18.15      static class A {
   18.16 -        public void a() {}
   18.17 -        public A a;
   18.18 +        public void a1() {}
   18.19 +        protected void a2() {}
   18.20 +        void a3() {}
   18.21 +        public A a1;
   18.22 +        protected A a2;
   18.23 +        A a3;
   18.24      }
   18.25      static class B extends A {
   18.26 -        public void b(){}
   18.27 -        public B b;
   18.28 +        public void b1() {}
   18.29 +        protected void b2() {}
   18.30 +        void b3() {}
   18.31 +        public B b1;
   18.32 +        protected B b2;
   18.33 +        B b3;
   18.34      }
   18.35      static interface I{
   18.36          void i();
   18.37 @@ -65,18 +73,35 @@
   18.38      }
   18.39  
   18.40      static void testMemberMethods(C<? extends A, ? extends I> arg) {
   18.41 -        arg.t.a();
   18.42 -        arg.t.b();
   18.43 +        arg.t.a1();
   18.44 +        arg.t.a2();
   18.45 +        arg.t.a3();
   18.46 +        arg.t.b1();
   18.47 +        arg.t.b2();
   18.48 +        arg.t.b3();
   18.49          arg.t.i1();
   18.50 -        arg.w.a();
   18.51 -        arg.w.b();
   18.52 +        arg.w.a1();
   18.53 +        arg.w.a2();
   18.54 +        arg.w.a3();
   18.55 +        arg.w.b1();
   18.56 +        arg.w.b2();
   18.57 +        arg.w.b3();
   18.58          arg.w.i1();
   18.59      }
   18.60  
   18.61      static void testMemberFields(C<? extends A, ? extends I> arg) {
   18.62 -        A ta = arg.t.a;
   18.63 -        B tb = arg.t.b;
   18.64 -        A wa = arg.w.a;
   18.65 -        B wb = arg.w.b;
   18.66 +        A ta; B tb;
   18.67 +        ta = arg.t.a1;
   18.68 +        ta = arg.t.a2;
   18.69 +        ta = arg.t.a3;
   18.70 +        tb = arg.t.b1;
   18.71 +        tb = arg.t.b2;
   18.72 +        tb = arg.t.b3;
   18.73 +        ta = arg.w.a1;
   18.74 +        ta = arg.w.a2;
   18.75 +        ta = arg.w.a3;
   18.76 +        tb = arg.w.b1;
   18.77 +        tb = arg.w.b2;
   18.78 +        tb = arg.w.b3;
   18.79      }
   18.80  }
    19.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    19.2 +++ b/test/tools/javac/generics/6711619/T6711619a.java	Fri Oct 24 20:47:47 2008 -0700
    19.3 @@ -0,0 +1,74 @@
    19.4 +/*
    19.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    19.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    19.7 + *
    19.8 + * This code is free software; you can redistribute it and/or modify it
    19.9 + * under the terms of the GNU General Public License version 2 only, as
   19.10 + * published by the Free Software Foundation.
   19.11 + *
   19.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   19.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   19.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   19.15 + * version 2 for more details (a copy is included in the LICENSE file that
   19.16 + * accompanied this code).
   19.17 + *
   19.18 + * You should have received a copy of the GNU General Public License version
   19.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   19.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   19.21 + *
   19.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   19.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   19.24 + * have any questions.
   19.25 + */
   19.26 +
   19.27 +/*
   19.28 + * @test
   19.29 + * @bug 6711619
   19.30 + *
   19.31 + * @summary javac doesn't allow access to protected members in intersection types
   19.32 + * @author Maurizio Cimadamore
   19.33 + *
   19.34 + * @compile/fail/ref=T6711619a.out -XDrawDiagnostics T6711619a.java
   19.35 + */
   19.36 +class T6711619a {
   19.37 +
   19.38 +    static class A {
   19.39 +        private void a() {}
   19.40 +        private A a;
   19.41 +    }
   19.42 +    static class B extends A {
   19.43 +        private B b() {}
   19.44 +        private B b;
   19.45 +    }
   19.46 +    static interface I{
   19.47 +        void i();
   19.48 +    }
   19.49 +    static interface I1{
   19.50 +        void i1();
   19.51 +    }
   19.52 +    static class E extends B implements I, I1{
   19.53 +        public void i() {}
   19.54 +        public void i1() {}
   19.55 +    }
   19.56 +    static class C<W extends B & I1, T extends W>{
   19.57 +        T t;
   19.58 +        W w;
   19.59 +        C(W w, T t) {
   19.60 +            this.w = w;
   19.61 +            this.t = t;
   19.62 +        }
   19.63 +    }
   19.64 +
   19.65 +    static void testMemberMethods(C<? extends A, ? extends I> arg) {
   19.66 +        arg.t.a();
   19.67 +        arg.t.b();
   19.68 +    }
   19.69 +
   19.70 +    static void testMemberFields(C<? extends A, ? extends I> arg) {
   19.71 +        A ta; B tb;
   19.72 +        ta = arg.t.a;
   19.73 +        tb = arg.t.b;
   19.74 +        ta = arg.w.a;
   19.75 +        tb = arg.w.b;
   19.76 +    }
   19.77 +}
   19.78 \ No newline at end of file
    20.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    20.2 +++ b/test/tools/javac/generics/6711619/T6711619a.out	Fri Oct 24 20:47:47 2008 -0700
    20.3 @@ -0,0 +1,7 @@
    20.4 +T6711619a.java:63:14: compiler.err.report.access: a(), private, T6711619a.A
    20.5 +T6711619a.java:64:14: compiler.err.report.access: b(), private, T6711619a.B
    20.6 +T6711619a.java:69:19: compiler.err.report.access: a, private, T6711619a.A
    20.7 +T6711619a.java:70:19: compiler.err.report.access: b, private, T6711619a.B
    20.8 +T6711619a.java:71:19: compiler.err.report.access: a, private, T6711619a.A
    20.9 +T6711619a.java:72:19: compiler.err.report.access: b, private, T6711619a.B
   20.10 +6 errors
    21.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    21.2 +++ b/test/tools/javac/generics/6711619/T6711619b.java	Fri Oct 24 20:47:47 2008 -0700
    21.3 @@ -0,0 +1,64 @@
    21.4 +/*
    21.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    21.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    21.7 + *
    21.8 + * This code is free software; you can redistribute it and/or modify it
    21.9 + * under the terms of the GNU General Public License version 2 only, as
   21.10 + * published by the Free Software Foundation.
   21.11 + *
   21.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   21.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   21.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   21.15 + * version 2 for more details (a copy is included in the LICENSE file that
   21.16 + * accompanied this code).
   21.17 + *
   21.18 + * You should have received a copy of the GNU General Public License version
   21.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   21.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   21.21 + *
   21.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   21.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   21.24 + * have any questions.
   21.25 + */
   21.26 +
   21.27 +/*
   21.28 + * @test
   21.29 + * @bug 6711619
   21.30 + *
   21.31 + * @summary javac doesn't allow access to protected members in intersection types
   21.32 + * @author Maurizio Cimadamore
   21.33 + *
   21.34 + * @compile/fail/ref=T6711619b.out -XDrawDiagnostics T6711619b.java
   21.35 + */
   21.36 +
   21.37 +class T6711619b {
   21.38 +    static class X1<E extends X1<E>> {
   21.39 +         private int i;
   21.40 +         E e;
   21.41 +         int f() {
   21.42 +             return e.i;
   21.43 +         }
   21.44 +    }
   21.45 +
   21.46 +    static class X2<E extends X2<E>> {
   21.47 +         static private int i;
   21.48 +         int f() {
   21.49 +             return E.i;
   21.50 +         }
   21.51 +    }
   21.52 +
   21.53 +    static class X3<E extends X3<E> & java.io.Serializable> {
   21.54 +         private int i;
   21.55 +         E e;
   21.56 +         int f() {
   21.57 +             return e.i;
   21.58 +         }
   21.59 +    }
   21.60 +
   21.61 +    static class X4<E extends X4<E> & java.io.Serializable> {
   21.62 +         static private int i;
   21.63 +         int f() {
   21.64 +             return E.i;
   21.65 +         }
   21.66 +    }
   21.67 +}
   21.68 \ No newline at end of file
    22.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    22.2 +++ b/test/tools/javac/generics/6711619/T6711619b.out	Fri Oct 24 20:47:47 2008 -0700
    22.3 @@ -0,0 +1,5 @@
    22.4 +T6711619b.java:39:22: compiler.err.report.access: i, private, T6711619b.X1
    22.5 +T6711619b.java:46:22: compiler.err.report.access: i, private, T6711619b.X2
    22.6 +T6711619b.java:54:22: compiler.err.report.access: i, private, T6711619b.X3
    22.7 +T6711619b.java:61:22: compiler.err.report.access: i, private, T6711619b.X4
    22.8 +4 errors
    23.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    23.2 +++ b/test/tools/javac/generics/T6557954.java	Fri Oct 24 20:47:47 2008 -0700
    23.3 @@ -0,0 +1,36 @@
    23.4 +/*
    23.5 + * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   23.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   23.24 + * have any questions.
   23.25 + */
   23.26 +
   23.27 +/*
   23.28 + * @test
   23.29 + * @bug     6557954
   23.30 + * @summary Inner class type parameters doesn't get substituted when checking type well-formedness
   23.31 + * @author Maurizio Cimadamore
   23.32 + *
   23.33 + * @compile T6557954.java
   23.34 + */
   23.35 +
   23.36 +class T6557954<T> {
   23.37 +    class Foo<U extends T> {}
   23.38 +    T6557954<Number>.Foo<Integer> f;
   23.39 +}
   23.40 \ No newline at end of file
    24.1 --- a/test/tools/javac/generics/inference/6718364/T6718364.out	Thu Oct 23 21:56:41 2008 -0700
    24.2 +++ b/test/tools/javac/generics/inference/6718364/T6718364.out	Fri Oct 24 20:47:47 2008 -0700
    24.3 @@ -1,3 +1,3 @@
    24.4  T6718364.java:36:32: compiler.warn.prob.found.req: (- compiler.misc.unchecked.assign), T6718364.X, T6718364.X<java.lang.Integer>
    24.5 -T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: <T>m(T6718364.X<T>,T), T6718364, , T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X
    24.6 +T6718364.java:36:10: compiler.warn.unchecked.meth.invocation.applied: kindname.method, m, T6718364.X<T>,T, T6718364.X<T6718364.X<java.lang.Integer>>,T6718364.X, kindname.class, T6718364
    24.7  2 warnings
    24.8 \ No newline at end of file
    25.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    25.2 +++ b/test/tools/javac/generics/typevars/6680106/T6680106.java	Fri Oct 24 20:47:47 2008 -0700
    25.3 @@ -0,0 +1,40 @@
    25.4 +/*
    25.5 + * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   25.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   25.24 + * have any questions.
   25.25 + */
   25.26 +
   25.27 +/*
   25.28 + * @test
   25.29 + * @bug     6680106
   25.30 + * @summary StackOverFlowError for Cyclic inheritance in TypeParameters with ArrayType Bounds
   25.31 + * @author  Maurizio Cimadamore
   25.32 + * @compile/fail/ref=T6680106.out -XDrawDiagnostics T6680106.java
   25.33 + */
   25.34 +
   25.35 +class T6680106 {
   25.36 +    class A0 {}
   25.37 +    class A1<T extends T[]> {}
   25.38 +    class A2<T extends S[], S extends T[]> {}
   25.39 +    class A3<T extends S[], S extends U[], U extends T[]> {}
   25.40 +    class A5<T extends A0 & T[]> {}
   25.41 +    class A6<T extends A0 & S[], S extends A0 & T[]> {}
   25.42 +    class A7<T extends A0 & S[], S extends A0 & U[], U extends A0 & T[]> {}
   25.43 +}
    26.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    26.2 +++ b/test/tools/javac/generics/typevars/6680106/T6680106.out	Fri Oct 24 20:47:47 2008 -0700
    26.3 @@ -0,0 +1,13 @@
    26.4 +T6680106.java:34:25: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
    26.5 +T6680106.java:35:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
    26.6 +T6680106.java:35:40: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
    26.7 +T6680106.java:36:25: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
    26.8 +T6680106.java:36:40: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class)
    26.9 +T6680106.java:36:55: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
   26.10 +T6680106.java:37:30: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
   26.11 +T6680106.java:38:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
   26.12 +T6680106.java:38:50: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
   26.13 +T6680106.java:39:30: compiler.err.type.found.req: S[], (- compiler.misc.type.req.class)
   26.14 +T6680106.java:39:50: compiler.err.type.found.req: U[], (- compiler.misc.type.req.class)
   26.15 +T6680106.java:39:70: compiler.err.type.found.req: T[], (- compiler.misc.type.req.class)
   26.16 +12 errors
   26.17 \ No newline at end of file
    27.1 --- a/test/tools/javac/generics/wildcards/6651719/T6651719b.java	Thu Oct 23 21:56:41 2008 -0700
    27.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    27.3 @@ -1,37 +0,0 @@
    27.4 -/*
    27.5 - * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   27.23 - * CA 95054 USA or visit www.sun.com if you need additional information or
   27.24 - * have any questions.
   27.25 - */
   27.26 -
   27.27 -/*
   27.28 - * @test
   27.29 - * @bug     6651719
   27.30 - * @summary Compiler crashes possibly during forward reference of TypeParameter
   27.31 - * @compile T6651719b.java
   27.32 - */
   27.33 -import java.util.*;
   27.34 -
   27.35 -public class T6651719b {
   27.36 -    <T> void m(T t, List<? super List<T>> list) {}
   27.37 -    void test(List<? super List<?>> list) {
   27.38 -        m("", list);
   27.39 -    }
   27.40 -}
    28.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    28.2 +++ b/test/tools/javac/generics/wildcards/6762569/T6762569a.java	Fri Oct 24 20:47:47 2008 -0700
    28.3 @@ -0,0 +1,38 @@
    28.4 +/*
    28.5 + * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   28.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   28.24 + * have any questions.
   28.25 + */
   28.26 +
   28.27 +/*
   28.28 + * @test
   28.29 + * @bug     6762569
   28.30 + * @summary Javac crashes with AssertionError in Types.containedBy
   28.31 + * @compile T6762569a.java
   28.32 + */
   28.33 +import java.util.*;
   28.34 +
   28.35 +class T6762569a {
   28.36 +    <T> void m(T t, List<? super List<T>> list) {}
   28.37 +
   28.38 +    void test(List<? super List<?>> list) {
   28.39 +        m("", list);
   28.40 +    }
   28.41 +}
    29.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    29.2 +++ b/test/tools/javac/generics/wildcards/6762569/T6762569b.java	Fri Oct 24 20:47:47 2008 -0700
    29.3 @@ -0,0 +1,38 @@
    29.4 +/*
    29.5 + * Copyright 2008 Sun Microsystems, Inc.  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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   29.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   29.24 + * have any questions.
   29.25 + */
   29.26 +
   29.27 +/*
   29.28 + * @test
   29.29 + * @bug     6762569
   29.30 + * @summary Javac crashes with AssertionError in Types.containedBy
   29.31 + * @compile/fail T6762569b.java
   29.32 + */
   29.33 +import java.util.*;
   29.34 +
   29.35 +class T6762569b {
   29.36 +    <T> void m(T t, List<? super List<T>> list) {}
   29.37 +
   29.38 +    void test(List<? super List<? extends Number>> list) {
   29.39 +        m("", list);
   29.40 +    }
   29.41 +}
    30.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    30.2 +++ b/test/tools/javac/generics/wildcards/T6732484.java	Fri Oct 24 20:47:47 2008 -0700
    30.3 @@ -0,0 +1,37 @@
    30.4 +/*
    30.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    30.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    30.7 + *
    30.8 + * This code is free software; you can redistribute it and/or modify it
    30.9 + * under the terms of the GNU General Public License version 2 only, as
   30.10 + * published by the Free Software Foundation.
   30.11 + *
   30.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   30.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   30.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   30.15 + * version 2 for more details (a copy is included in the LICENSE file that
   30.16 + * accompanied this code).
   30.17 + *
   30.18 + * You should have received a copy of the GNU General Public License version
   30.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   30.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   30.21 + *
   30.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   30.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   30.24 + * have any questions.
   30.25 + */
   30.26 +
   30.27 +/*
   30.28 + * @test
   30.29 + * @bug 6732484
   30.30 + * @summary Bound error on wildcard code
   30.31 + * @author Maurizio Cimadamore
   30.32 + * @compile T6732484.java
   30.33 + */
   30.34 +
   30.35 +class T6732484 {
   30.36 +    class A<T extends A<T>> {}
   30.37 +    class B extends A<B> {}
   30.38 +
   30.39 +    A<? super B> f;
   30.40 +}
   30.41 \ No newline at end of file
    31.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    31.2 +++ b/test/tools/javac/varargs/T6746184.java	Fri Oct 24 20:47:47 2008 -0700
    31.3 @@ -0,0 +1,39 @@
    31.4 +/*
    31.5 + * Copyright 2008 Sun Microsystems, Inc.  All Rights Reserved.
    31.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    31.7 + *
    31.8 + * This code is free software; you can redistribute it and/or modify it
    31.9 + * under the terms of the GNU General Public License version 2 only, as
   31.10 + * published by the Free Software Foundation.
   31.11 + *
   31.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   31.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   31.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   31.15 + * version 2 for more details (a copy is included in the LICENSE file that
   31.16 + * accompanied this code).
   31.17 + *
   31.18 + * You should have received a copy of the GNU General Public License version
   31.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   31.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   31.21 + *
   31.22 + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
   31.23 + * CA 95054 USA or visit www.sun.com if you need additional information or
   31.24 + * have any questions.
   31.25 + */
   31.26 +
   31.27 +/*
   31.28 + * @test
   31.29 + * @bug     6746184
   31.30 + * @summary javac fails to compile call to public varargs method
   31.31 + */
   31.32 +
   31.33 +public class T6746184 {
   31.34 +    public static void main(String[] args) {
   31.35 +        A.m(new Object());
   31.36 +    }
   31.37 +}
   31.38 +
   31.39 +class A {
   31.40 +    public static void m(final Object... varargs) {}
   31.41 +    private static void m(final Object singleArg) {}
   31.42 +}
   31.43 \ No newline at end of file

mercurial