changeset 564:1d3e1ab9bfcc jigsaw-b04

Merge
author jjg
date Thu, 29 Apr 2010 14:36:20 -0700
parents 2e77b8ab836d (current diff) 32675c68a3ca (diff)
children 9fc31b14d7d5 6fcc993f6a1d
files .hgtags src/share/classes/com/sun/tools/javac/code/Source.java src/share/classes/com/sun/tools/javac/code/Symbol.java src/share/classes/com/sun/tools/javac/comp/Attr.java src/share/classes/com/sun/tools/javac/comp/Check.java src/share/classes/com/sun/tools/javac/comp/Resolve.java src/share/classes/com/sun/tools/javac/main/Main.java src/share/classes/com/sun/tools/javac/parser/JavacParser.java src/share/classes/com/sun/tools/javac/resources/compiler.properties src/share/classes/com/sun/tools/javac/tree/TreeInfo.java test/tools/javac/generics/diamond/neg/Neg01.java test/tools/javac/generics/diamond/neg/Neg01.out test/tools/javac/generics/diamond/neg/Neg02.java test/tools/javac/generics/diamond/neg/Neg02.out test/tools/javac/generics/diamond/neg/Neg03.java test/tools/javac/generics/diamond/neg/Neg03.out test/tools/javac/generics/diamond/neg/Neg04.java test/tools/javac/generics/diamond/neg/Neg04.out test/tools/javac/generics/diamond/neg/Neg05.java test/tools/javac/generics/diamond/neg/Neg05.out test/tools/javac/generics/diamond/pos/Pos01.java test/tools/javac/generics/diamond/pos/Pos02.java test/tools/javac/generics/diamond/pos/Pos03.java test/tools/javac/generics/diamond/pos/Pos04.java
diffstat 43 files changed, 1215 insertions(+), 551 deletions(-) [+]
line wrap: on
line diff
--- a/.hgtags	Wed Apr 28 11:44:02 2010 -0700
+++ b/.hgtags	Thu Apr 29 14:36:20 2010 -0700
@@ -61,5 +61,9 @@
 c9f4ae1f1480e89aaf7e72173184089d9cea397a jdk7-b83
 d9cd5b8286e44f3baf90da290cd295433e21c05a jdk7-b84
 136bfc67946219fb02ee223984540a4a9c5b209f jdk7-b85
+ef07347428f2198ae6b8144ac0b9086bbe39fd16 jdk7-b86
+409db93d19c002333980df5b797c6b965150c7a0 jdk7-b87
+f9b5d4867a26f8c4b90ad37fe2c345b721e93d6b jdk7-b88
+6cea9a143208bc1185ced046942c0f4e45dbeba5 jdk7-b89
 51b53bc20417668e7e9a013238d3079f3df1800f jigsaw-b01
 e2879c758bac08ca28218f781b8baccb8e07256f jigsaw-b03
--- a/src/share/bin/launcher.sh-template	Wed Apr 28 11:44:02 2010 -0700
+++ b/src/share/bin/launcher.sh-template	Thu Apr 29 14:36:20 2010 -0700
@@ -66,4 +66,5 @@
 done
 unset DUALCASE
 
-eval "#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} -jar "${mydir}"/../lib/#PROGRAM#.jar ${toolOpts}
+IFS=$nl
+"#TARGET_JAVA#" "${bcp:+-Xbootclasspath/p:"$bcp"}" ${ea} ${javaOpts} -jar "${mydir}"/../lib/#PROGRAM#.jar ${toolOpts}
--- a/src/share/classes/com/sun/tools/javac/code/Symbol.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/code/Symbol.java	Thu Apr 29 14:36:20 2010 -0700
@@ -229,6 +229,13 @@
             (owner.kind == TYP && owner.isLocal());
     }
 
+    /** Has this symbol an empty name? This includes anonymous
+     *  inner classses.
+     */
+    public boolean isAnonymous() {
+        return name.isEmpty();
+    }
+
     /** Is this symbol a constructor?
      */
     public boolean isConstructor() {
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Thu Apr 29 14:36:20 2010 -0700
@@ -72,6 +72,7 @@
     final Log log;
     final Symtab syms;
     final Resolve rs;
+    final Infer infer;
     final Check chk;
     final MemberEnter memberEnter;
     final TreeMaker make;
@@ -100,6 +101,7 @@
         memberEnter = MemberEnter.instance(context);
         make = TreeMaker.instance(context);
         enter = Enter.instance(context);
+        infer = Infer.instance(context);
         cfolder = ConstFold.instance(context);
         target = Target.instance(context);
         types = Types.instance(context);
@@ -207,21 +209,6 @@
         return owntype;
     }
 
-    Type checkReturn(JCTree tree, Type owntype, int ownkind, int pkind, Type pt) {
-        if (owntype.tag != ERROR && pt.tag != METHOD && pt.tag != FORALL) {
-            if ((ownkind & ~pkind) == 0) {
-                owntype = chk.checkReturnType(tree.pos(), owntype, pt);
-            } else {
-                log.error(tree.pos(), "unexpected.type",
-                          kindNames(pkind),
-                          kindName(ownkind));
-                owntype = types.createErrorType(owntype);
-            }
-        }
-        tree.type = owntype;
-        return owntype;
-    }
-
     /** Is given blank final variable assignable, i.e. in a scope where it
      *  may be assigned to even though it is final?
      *  @param v      The blank final variable.
@@ -554,6 +541,7 @@
     }
 
     /** Attribute type reference in an `extends' or `implements' clause.
+     *  Supertypes of anonymous inner classes are usually already attributed.
      *
      *  @param tree              The tree making up the type reference.
      *  @param env               The environment current at the reference.
@@ -565,7 +553,9 @@
                     boolean classExpected,
                     boolean interfaceExpected,
                     boolean checkExtensible) {
-        Type t = attribType(tree, env);
+        Type t = tree.type != null ?
+            tree.type :
+            attribType(tree, env);
         return checkBase(t, tree, env, classExpected, interfaceExpected, checkExtensible);
     }
     Type checkBase(Type t,
@@ -1405,7 +1395,7 @@
 
             // Check that value of resulting type is admissible in the
             // current context.  Also, capture the return type
-            result = checkReturn(tree, capture(restype), VAL, pkind, pt);
+            result = check(tree, capture(restype), VAL, pkind, pt);
         }
         chk.validate(tree.typeargs, localEnv);
     }
@@ -1475,14 +1465,17 @@
                               ((JCTypeApply) clazz).arguments);
             else
                 clazz = clazzid1;
-//          System.out.println(clazz + " generated.");//DEBUG
         }
 
         // Attribute clazz expression and store
         // symbol + type back into the attributed tree.
         Type clazztype = attribType(clazz, env);
+        Pair<Scope,Scope> mapping = getSyntheticScopeMapping((ClassType)clazztype);
+        if (!TreeInfo.isDiamond(tree)) {
+            clazztype = chk.checkClassType(
+                tree.clazz.pos(), clazztype, true);
+        }
         chk.validate(clazz, localEnv);
-        clazztype = chk.checkNewClassType(clazz.pos(), clazztype, true, pt);
         if (tree.encl != null) {
             // We have to work in this case to store
             // symbol + type back into the attributed tree.
@@ -1506,6 +1499,11 @@
         List<Type> argtypes = attribArgs(tree.args, localEnv);
         List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv);
 
+        if (TreeInfo.isDiamond(tree)) {
+            clazztype = attribDiamond(localEnv, tree, clazztype, mapping, argtypes, typeargtypes, true);
+            clazz.type = clazztype;
+        }
+
         // If we have made no mistakes in the class type...
         if (clazztype.tag == CLASS) {
             // Enums may not be instantiated except implicitly
@@ -1543,12 +1541,12 @@
                 tree.constructor = rs.resolveConstructor(
                     tree.pos(), localEnv, clazztype, argtypes, typeargtypes);
                 tree.constructorType = checkMethod(clazztype,
-                                            tree.constructor,
-                                            localEnv,
-                                            tree.args,
-                                            argtypes,
-                                            typeargtypes,
-                                            localEnv.info.varArgs);
+                                                tree.constructor,
+                                                localEnv,
+                                                tree.args,
+                                                argtypes,
+                                                typeargtypes,
+                                                localEnv.info.varArgs);
                 if (localEnv.info.varArgs)
                     assert tree.constructorType.isErroneous() || tree.varargsElement != null;
             }
@@ -1587,9 +1585,7 @@
                 //       ...
                 //     }
                 if (Resolve.isStatic(env)) cdef.mods.flags |= STATIC;
-                clazz = TreeInfo.isDiamond(tree) ?
-                    make.Type(clazztype)
-                    : clazz;
+
                 if (clazztype.tsym.isInterface()) {
                     cdef.implementing = List.of(clazz);
                 } else {
@@ -1635,6 +1631,136 @@
         chk.validate(tree.typeargs, localEnv);
     }
 
+    Type attribDiamond(Env<AttrContext> env,
+                        JCNewClass tree,
+                        Type clazztype,
+                        Pair<Scope, Scope> mapping,
+                        List<Type> argtypes,
+                        List<Type> typeargtypes,
+                        boolean reportErrors) {
+        if (clazztype.isErroneous()) {
+            //if the type of the instance creation expression is erroneous
+            //return the erroneous type itself
+            return clazztype;
+        }
+        else if (clazztype.isInterface()) {
+            //if the type of the instance creation expression is an interface
+            //skip the method resolution step (JLS 15.12.2.7). The type to be
+            //inferred is of the kind <X1,X2, ... Xn>C<X1,X2, ... Xn>
+            clazztype = new ForAll(clazztype.tsym.type.allparams(),
+                    clazztype.tsym.type);
+        } else {
+            //if the type of the instance creation expression is a class type
+            //apply method resolution inference (JLS 15.12.2.7). The return type
+            //of the resolved constructor will be a partially instantiated type
+            ((ClassSymbol) clazztype.tsym).members_field = mapping.snd;
+            Symbol constructor;
+            try {
+                constructor = rs.resolveDiamond(tree.pos(),
+                        env,
+                        clazztype.tsym.type,
+                        argtypes,
+                        typeargtypes, reportErrors);
+            } finally {
+                ((ClassSymbol) clazztype.tsym).members_field = mapping.fst;
+            }
+            if (constructor.kind == MTH) {
+                ClassType ct = new ClassType(clazztype.getEnclosingType(),
+                        clazztype.tsym.type.getTypeArguments(),
+                        clazztype.tsym);
+                clazztype = checkMethod(ct,
+                        constructor,
+                        env,
+                        tree.args,
+                        argtypes,
+                        typeargtypes,
+                        env.info.varArgs).getReturnType();
+            } else {
+                clazztype = syms.errType;
+            }
+        }
+        if (clazztype.tag == FORALL && !pt.isErroneous()) {
+            //if the resolved constructor's return type has some uninferred
+            //type-variables, infer them using the expected type and declared
+            //bounds (JLS 15.12.2.8).
+            try {
+                clazztype = infer.instantiateExpr((ForAll) clazztype,
+                        pt.tag == NONE ? syms.objectType : pt,
+                        Warner.noWarnings);
+            } catch (Infer.InferenceException ex) {
+                //an error occurred while inferring uninstantiated type-variables
+                //we need to optionally report an error
+                if (reportErrors) {
+                    log.error(tree.clazz.pos(),
+                            "cant.apply.diamond.1",
+                            diags.fragment("diamond", clazztype.tsym),
+                            ex.diagnostic);
+                }
+            }
+        }
+        if (reportErrors) {
+            clazztype = chk.checkClassType(tree.clazz.pos(),
+                    clazztype,
+                    true);
+            if (clazztype.tag == CLASS) {
+                List<Type> invalidDiamondArgs = chk.checkDiamond((ClassType)clazztype);
+                if (!clazztype.isErroneous() && invalidDiamondArgs.nonEmpty()) {
+                    //one or more types inferred in the previous steps is either a
+                    //captured type or an intersection type --- we need to report an error.
+                    String subkey = invalidDiamondArgs.size() > 1 ?
+                        "diamond.invalid.args" :
+                        "diamond.invalid.arg";
+                    //The error message is of the kind:
+                    //
+                    //cannot infer type arguments for {clazztype}<>;
+                    //reason: {subkey}
+                    //
+                    //where subkey is a fragment of the kind:
+                    //
+                    //type argument(s) {invalidDiamondArgs} inferred for {clazztype}<> is not allowed in this context
+                    log.error(tree.clazz.pos(),
+                                "cant.apply.diamond.1",
+                                diags.fragment("diamond", clazztype.tsym),
+                                diags.fragment(subkey,
+                                               invalidDiamondArgs,
+                                               diags.fragment("diamond", clazztype.tsym)));
+                }
+            }
+        }
+        return clazztype;
+    }
+
+    /** Creates a synthetic scope containing fake generic constructors.
+     *  Assuming that the original scope contains a constructor of the kind:
+     *  Foo(X x, Y y), where X,Y are class type-variables declared in Foo,
+     *  the synthetic scope is added a generic constructor of the kind:
+     *  <X,Y>Foo<X,Y>(X x, Y y). This is crucial in order to enable diamond
+     *  inference. The inferred return type of the synthetic constructor IS
+     *  the inferred type for the diamond operator.
+     */
+    private Pair<Scope, Scope> getSyntheticScopeMapping(ClassType ctype) {
+        Pair<Scope, Scope> mapping =
+                new Pair<Scope, Scope>(ctype.tsym.members(), new Scope(ctype.tsym));
+        List<Type> typevars = ctype.tsym.type.getTypeArguments();
+        for (Scope.Entry e = mapping.fst.lookup(names.init);
+                e.scope != null;
+                e = e.next()) {
+            MethodSymbol newConstr = (MethodSymbol) e.sym.clone(ctype.tsym);
+            newConstr.name = names.init;
+            List<Type> oldTypeargs = List.nil();
+            if (newConstr.type.tag == FORALL) {
+                oldTypeargs = ((ForAll) newConstr.type).tvars;
+            }
+            newConstr.type = new MethodType(newConstr.type.getParameterTypes(),
+                    new ClassType(ctype.getEnclosingType(), ctype.tsym.type.getTypeArguments(), ctype.tsym),
+                    newConstr.type.getThrownTypes(),
+                    syms.methodClass);
+            newConstr.type = new ForAll(typevars.prependList(oldTypeargs), newConstr.type);
+            mapping.snd.enter(newConstr);
+        }
+        return mapping;
+    }
+
     /** Make an attributed null check tree.
      */
     public JCExpression makeNullCheck(JCExpression arg) {
@@ -2500,12 +2626,10 @@
             }
             if (useVarargs) {
                 JCTree tree = env.tree;
-                Type argtype = owntype.getParameterTypes().last();
-                if (!types.isReifiable(argtype))
-                    chk.warnUnchecked(env.tree.pos(),
-                                      "unchecked.generic.array.creation",
-                                      argtype);
-                Type elemtype = types.elemtype(argtype);
+                if (owntype.getReturnType().tag != FORALL || warned) {
+                    chk.checkVararg(env.tree.pos(), owntype.getParameterTypes());
+                }
+                Type elemtype = types.elemtype(owntype.getParameterTypes().last());
                 switch (tree.getTag()) {
                 case JCTree.APPLY:
                     ((JCMethodInvocation) tree).varargsElement = elemtype;
@@ -2576,7 +2700,7 @@
         if (clazztype.tag == CLASS) {
             List<Type> formals = clazztype.tsym.type.getTypeArguments();
 
-            if (actuals.length() == formals.length() || actuals.isEmpty()) {
+            if (actuals.length() == formals.length() || actuals.length() == 0) {
                 List<Type> a = actuals;
                 List<Type> f = formals;
                 while (a.nonEmpty()) {
@@ -2602,18 +2726,7 @@
                         clazzOuter = site;
                     }
                 }
-                if (actuals.nonEmpty()) {
-                    owntype = new ClassType(clazzOuter, actuals, clazztype.tsym);
-                }
-                else if (TreeInfo.isDiamond(tree)) {
-                    //a type apply with no explicit type arguments - diamond operator
-                    //the result type is a forall F where F's tvars are the type-variables
-                    //that will be inferred when F is checked against the expected type
-                    List<Type> ftvars = clazztype.tsym.type.getTypeArguments();
-                    List<Type> new_tvars = types.newInstances(ftvars);
-                    clazztype = new ClassType(clazzOuter, new_tvars, clazztype.tsym);
-                    owntype = new ForAll(new_tvars, clazztype);
-                }
+                owntype = new ClassType(clazzOuter, actuals, clazztype.tsym);
             } else {
                 if (formals.length() != 0) {
                     log.error(tree.pos(), "wrong.number.type.args",
@@ -2875,9 +2988,12 @@
 
         // Validate type parameters, supertype and interfaces.
         attribBounds(tree.typarams);
-        chk.validate(tree.typarams, env);
-        chk.validate(tree.extending, env);
-        chk.validate(tree.implementing, env);
+        if (!c.isAnonymous()) {
+            //already checked if anonymous
+            chk.validate(tree.typarams, env);
+            chk.validate(tree.extending, env);
+            chk.validate(tree.implementing, env);
+        }
 
         // Module modifier may not be used in unnamed module
         chk.checkModuleModifier(tree.pos(), c);
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Thu Apr 29 14:36:20 2010 -0700
@@ -376,6 +376,8 @@
     Type checkType(DiagnosticPosition pos, Type found, Type req) {
         if (req.tag == ERROR)
             return req;
+        if (found.tag == FORALL)
+            return instantiatePoly(pos, (ForAll)found, req, convertWarner(pos, found, req));
         if (req.tag == NONE)
             return found;
         if (types.isAssignable(found, req, convertWarner(pos, found, req)))
@@ -393,33 +395,6 @@
         return typeError(pos, diags.fragment("incompatible.types"), found, req);
     }
 
-    Type checkReturnType(DiagnosticPosition pos, Type found, Type req) {
-        if (found.tag == FORALL) {
-            try {
-                return instantiatePoly(pos, (ForAll) found, req, convertWarner(pos, found, req));
-            } catch (Infer.NoInstanceException ex) {
-                if (ex.isAmbiguous) {
-                    JCDiagnostic d = ex.getDiagnostic();
-                    log.error(pos,
-                            "undetermined.type" + (d != null ? ".1" : ""),
-                            found, d);
-                    return types.createErrorType(req);
-                } else {
-                    JCDiagnostic d = ex.getDiagnostic();
-                    return typeError(pos,
-                            diags.fragment("incompatible.types" + (d != null ? ".1" : ""), d),
-                            found, req);
-                }
-            } catch (Infer.InvalidInstanceException ex) {
-                JCDiagnostic d = ex.getDiagnostic();
-                log.error(pos, "invalid.inferred.types", ((ForAll)found).tvars, d);
-                return types.createErrorType(req);
-            }
-        } else {
-            return checkType(pos, found, req);
-        }
-    }
-
     /** Instantiate polymorphic type to some prototype, unless
      *  prototype is `anyPoly' in which case polymorphic type
      *  is returned unchanged.
@@ -433,9 +408,28 @@
         } else if (pt.tag == ERROR) {
             return pt;
         } else {
-            return infer.instantiateExpr(t, pt, warn);
+            try {
+                return infer.instantiateExpr(t, pt, warn);
+            } catch (Infer.NoInstanceException ex) {
+                if (ex.isAmbiguous) {
+                    JCDiagnostic d = ex.getDiagnostic();
+                    log.error(pos,
+                              "undetermined.type" + (d!=null ? ".1" : ""),
+                              t, d);
+                    return types.createErrorType(pt);
+                } else {
+                    JCDiagnostic d = ex.getDiagnostic();
+                    return typeError(pos,
+                                     diags.fragment("incompatible.types" + (d!=null ? ".1" : ""), d),
+                                     t, pt);
+                }
+            } catch (Infer.InvalidInstanceException ex) {
+                JCDiagnostic d = ex.getDiagnostic();
+                log.error(pos, "invalid.inferred.types", t.tvars, d);
+                return types.createErrorType(pt);
+            }
         }
-     }
+    }
 
     /** Check that a given type can be cast to a given target type.
      *  Return the result of the cast.
@@ -558,29 +552,6 @@
         return t;
     }
 
-    /** Check that type is a valid type for a new expression. If the type contains
-     * some uninferred type variables, instantiate them exploiting the expected
-     * type.
-     *
-     *  @param pos           Position to be used for error reporting.
-     *  @param t             The type to be checked.
-     *  @param noBounds    True if type bounds are illegal here.
-     *  @param pt          Expected type (used with diamond operator)
-     */
-    Type checkNewClassType(DiagnosticPosition pos, Type t, boolean noBounds, Type pt) {
-        if (t.tag == FORALL) {
-            try {
-                t = instantiatePoly(pos, (ForAll)t, pt, Warner.noWarnings);
-            }
-            catch (Infer.NoInstanceException ex) {
-                JCDiagnostic d = ex.getDiagnostic();
-                log.error(pos, "cant.apply.diamond", t.getTypeArguments(), d);
-                return types.createErrorType(pt);
-            }
-        }
-        return checkClassType(pos, t, noBounds);
-    }
-
     /** Check that type is a reifiable class, interface or array type.
      *  @param pos           Position to be used for error reporting.
      *  @param t             The type to be checked.
@@ -670,6 +641,56 @@
             return true;
     }
 
+    /** Check that the type inferred using the diamond operator does not contain
+     *  non-denotable types such as captured types or intersection types.
+     *  @param t the type inferred using the diamond operator
+     */
+    List<Type> checkDiamond(ClassType t) {
+        DiamondTypeChecker dtc = new DiamondTypeChecker();
+        ListBuffer<Type> buf = ListBuffer.lb();
+        for (Type arg : t.getTypeArguments()) {
+            if (!dtc.visit(arg, null)) {
+                buf.append(arg);
+            }
+        }
+        return buf.toList();
+    }
+
+    static class DiamondTypeChecker extends Types.SimpleVisitor<Boolean, Void> {
+        public Boolean visitType(Type t, Void s) {
+            return true;
+        }
+        @Override
+        public Boolean visitClassType(ClassType t, Void s) {
+            if (t.isCompound()) {
+                return false;
+            }
+            for (Type targ : t.getTypeArguments()) {
+                if (!visit(targ, s)) {
+                    return false;
+                }
+            }
+            return true;
+        }
+        @Override
+        public Boolean visitCapturedType(CapturedType t, Void s) {
+            return false;
+        }
+    }
+
+    /**
+     * Check that vararg method call is sound
+     * @param pos Position to be used for error reporting.
+     * @param argtypes Actual arguments supplied to vararg method.
+     */
+    void checkVararg(DiagnosticPosition pos, List<Type> argtypes) {
+        Type argtype = argtypes.last();
+        if (!types.isReifiable(argtype))
+            warnUnchecked(pos,
+                              "unchecked.generic.array.creation",
+                              argtype);
+    }
+
     /** Check that given modifiers are legal for given symbol and
      *  return modifiers together with any implicit modifiers for that symbol.
      *  Warning: we can't use flags() here since this method
@@ -964,8 +985,7 @@
                 }
 
                 checkCapture(tree);
-            }
-            if (tree.type.tag == CLASS || tree.type.tag == FORALL) {
+
                 // Check that this type is either fully parameterized, or
                 // not parameterized at all.
                 if (tree.type.getEnclosingType().isRaw())
--- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Thu Apr 29 14:36:20 2010 -0700
@@ -287,7 +287,8 @@
     /** Instantiate method type `mt' by finding instantiations of
      *  `tvars' so that method can be applied to `argtypes'.
      */
-    public Type instantiateMethod(List<Type> tvars,
+    public Type instantiateMethod(final Env<AttrContext> env,
+                                  List<Type> tvars,
                                   MethodType mt,
                                   final List<Type> argtypes,
                                   final boolean allowBoxing,
@@ -416,6 +417,9 @@
                     // check that inferred bounds conform to their bounds
                     checkWithinBounds(all_tvars,
                            types.subst(inferredTypes, tvars, inferred), warn);
+                    if (useVarargs) {
+                        chk.checkVararg(env.tree.pos(), formals);
+                    }
                     return super.inst(inferred, types);
             }};
             return mt2;
--- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java	Thu Apr 29 14:36:20 2010 -0700
@@ -360,7 +360,8 @@
 
         if (instNeeded)
             return
-            infer.instantiateMethod(tvars,
+            infer.instantiateMethod(env,
+                                    tvars,
                                     (MethodType)mt,
                                     argtypes,
                                     allowBoxing,
@@ -803,6 +804,8 @@
                                            operator);
                 }
             }
+            if (name == names.init)
+                break;
             //- System.out.println(" - " + bestSoFar);
             if (abstractok) {
                 Symbol concrete = methodNotFound;
@@ -1424,6 +1427,48 @@
         return sym;
     }
 
+    /** Resolve constructor using diamond inference.
+     *  @param pos       The position to use for error reporting.
+     *  @param env       The environment current at the constructor invocation.
+     *  @param site      The type of class for which a constructor is searched.
+     *                   The scope of this class has been touched in attribution.
+     *  @param argtypes  The types of the constructor invocation's value
+     *                   arguments.
+     *  @param typeargtypes  The types of the constructor invocation's type
+     *                   arguments.
+     */
+    Symbol resolveDiamond(DiagnosticPosition pos,
+                              Env<AttrContext> env,
+                              Type site,
+                              List<Type> argtypes,
+                              List<Type> typeargtypes, boolean reportErrors) {
+        Symbol sym = methodNotFound;
+        JCDiagnostic explanation = null;
+        List<MethodResolutionPhase> steps = methodResolutionSteps;
+        while (steps.nonEmpty() &&
+               steps.head.isApplicable(boxingEnabled, varargsEnabled) &&
+               sym.kind >= ERRONEOUS) {
+            sym = resolveConstructor(pos, env, site, argtypes, typeargtypes,
+                    steps.head.isBoxingRequired(),
+                    env.info.varArgs = steps.head.isVarargsRequired());
+            methodResolutionCache.put(steps.head, sym);
+            if (sym.kind == WRONG_MTH &&
+                    ((InapplicableSymbolError)sym).explanation != null) {
+                //if the symbol is an inapplicable method symbol, then the
+                //explanation contains the reason for which inference failed
+                explanation = ((InapplicableSymbolError)sym).explanation;
+            }
+            steps = steps.tail;
+        }
+        if (sym.kind >= AMBIGUOUS && reportErrors) {
+            String key = explanation == null ?
+                "cant.apply.diamond" :
+                "cant.apply.diamond.1";
+            log.error(pos, key, diags.fragment("diamond", site.tsym), explanation);
+        }
+        return sym;
+    }
+
     /** Resolve constructor.
      *  @param pos       The position to use for error reporting.
      *  @param env       The environment current at the constructor invocation.
--- a/src/share/classes/com/sun/tools/javac/main/Main.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/main/Main.java	Thu Apr 29 14:36:20 2010 -0700
@@ -28,6 +28,9 @@
 import java.io.File;
 import java.io.IOException;
 import java.io.PrintWriter;
+import java.net.URL;
+import java.security.DigestInputStream;
+import java.security.MessageDigest;
 import java.util.MissingResourceException;
 
 import com.sun.tools.javac.code.Source;
@@ -282,6 +285,15 @@
         if (target.hasInvokedynamic()) {
             options.put("invokedynamic",  "invokedynamic");
         }
+
+        // handle this here so it works even if no other options given
+        String showClass = options.get("showClass");
+        if (showClass != null) {
+            if (showClass.equals("showClass")) // no value given for option
+                showClass = "com.sun.tools.javac.Main";
+            showClass(showClass);
+        }
+
         return filenames.toList();
     }
     // where
@@ -489,6 +501,37 @@
         ex.getCause().printStackTrace();
     }
 
+    /** Display the location and checksum of a class. */
+    void showClass(String className) {
+        out.println("javac: show class: " + className);
+        URL url = getClass().getResource('/' + className.replace('.', '/') + ".class");
+        if (url == null)
+            out.println("  class not found");
+        else {
+            out.println("  " + url);
+            try {
+                final String algorithm = "MD5";
+                byte[] digest;
+                MessageDigest md = MessageDigest.getInstance(algorithm);
+                DigestInputStream in = new DigestInputStream(url.openStream(), md);
+                try {
+                    byte[] buf = new byte[8192];
+                    int n;
+                    do { n = in.read(buf); } while (n > 0);
+                    digest = md.digest();
+                } finally {
+                    in.close();
+                }
+                StringBuilder sb = new StringBuilder();
+                for (byte b: digest)
+                    sb.append(String.format("%02x", b));
+                out.println("  " + algorithm + " checksum: " + sb);
+            } catch (Exception e) {
+                out.println("  cannot compute digest: " + e);
+            }
+        }
+    }
+
     private JavaFileManager fileManager;
 
     /* ************************************************************************
--- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java	Thu Apr 29 14:36:20 2010 -0700
@@ -205,11 +205,11 @@
      *     mode = NOPARAMS    : no parameters allowed for type
      *     mode = TYPEARG     : type argument
      */
-    static final int EXPR = 1;
-    static final int TYPE = 2;
-    static final int NOPARAMS = 4;
-    static final int TYPEARG = 8;
-    static final int DIAMOND = 16;
+    static final int EXPR = 0x1;
+    static final int TYPE = 0x2;
+    static final int NOPARAMS = 0x4;
+    static final int TYPEARG = 0x8;
+    static final int DIAMOND = 0x10;
 
     /** The current mode.
      */
@@ -3401,12 +3401,6 @@
         }
     }
 
-    void checkDiamond() {
-        if (!allowDiamond) {
-            log.error(S.pos(), "diamond.not.supported.in.source", source.name);
-            allowDiamond = true;
-        }
-    }
     void checkGenerics() {
         if (!allowGenerics) {
             log.error(S.pos(), "generics.not.supported.in.source", source.name);
@@ -3443,4 +3437,10 @@
             allowTypeAnnotations = true;
         }
     }
+    void checkDiamond() {
+        if (!allowDiamond) {
+            log.error(S.pos(), "diamond.not.supported.in.source", source.name);
+            allowDiamond = true;
+        }
+    }
 }
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Wed Apr 28 11:44:02 2010 -0700
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Thu Apr 29 14:36:20 2010 -0700
@@ -479,6 +479,11 @@
     type parameters of {0} cannot be determined; {1}
 compiler.err.invalid.inferred.types=\
     invalid inferred types for {0}; {1}
+compiler.err.cant.apply.diamond=\
+    cannot infer type arguments for {0}
+compiler.err.cant.apply.diamond.1=\
+    cannot infer type arguments for {0};\n\
+    reason: {1}
 compiler.err.unreachable.stmt=\
     unreachable statement
 compiler.err.initializer.must.be.able.to.complete.normally=\
@@ -1046,7 +1051,12 @@
     actual arguments do not conform to inferred formal arguments\n\
     required: {0}\n\
     found: {1}
-
+compiler.misc.diamond=\
+    {0}<>
+compiler.misc.diamond.invalid.arg=\
+    type argument {0} inferred for {1} is not allowed in this context
+compiler.misc.diamond.invalid.args=\
+    type arguments {0} inferred for {1} are not allowed in this context
 #####
 
 ## The first argument ({0}) is a "kindname".
@@ -1098,10 +1108,6 @@
     symbol:   {0} <{2}>{1}({3})\n\
     location: {4} {5}
 
-compiler.err.cant.apply.diamond=\
-    diamond operator cannot infer types for {0};\n\
-    reason: {1}
-
 ## The following are all possible string for "kindname".
 ## They should be called whatever the JLS calls them after it been translated
 ## to the appropriate language.
@@ -1185,6 +1191,8 @@
     {0} in {1} implements {2} in {3}
 compiler.misc.varargs.clash.with=\
     {0} in {1} overrides {2} in {3}
+compiler.misc.non.denotable.type=\
+    Non-denotable type {0} not allowed here
 
 ########################################
 # Diagnostics for language feature changes
@@ -1245,10 +1253,6 @@
     enums are not supported in -source {0}\n\
 (use -source 5 or higher to enable enums)
 
-compiler.err.diamond.not.supported.in.source=\
-    diamond operator is not supported in -source {0}\n\
-(use -source 7 or higher to enable diamond operator)
-
 compiler.err.string.switch.not.supported.in.source=\
     strings in switch are not supported in -source {0}\n\
 (use -source 7 or higher to enable strings in switch)
--- a/test/tools/javac/6840059/T6840059.out	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/6840059/T6840059.out	Thu Apr 29 14:36:20 2010 -0700
@@ -1,3 +1,3 @@
-T6840059.java:15:9: compiler.err.cant.resolve.location.args: kindname.constructor, T6840059, , java.lang.String, kindname.class, T6840059
-T6840059.java:15:25: compiler.err.cant.resolve.location.args: kindname.constructor, T6840059, , , kindname.class, T6840059
+T6840059.java:15:9: compiler.err.cant.apply.symbol: kindname.constructor, T6840059, java.lang.Integer, java.lang.String, kindname.class, T6840059, null
+T6840059.java:15:25: compiler.err.cant.apply.symbol: kindname.constructor, T6840059, java.lang.Integer, compiler.misc.no.args, kindname.class, T6840059, null
 2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/T6942649.java	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+
+/*
+ * @test
+ * @bug 6942649
+ * @summary add hidden option to identify location and version of javac classes
+ */
+
+import java.io.*;
+
+public class T6942649 {
+    public static void main(String... args) throws Exception {
+        new T6942649().run();
+    }
+
+    void run() throws Exception {
+        test("-XDshowClass", "com.sun.tools.javac.Main");
+        test("-XDshowClass=com.sun.tools.javac.util.Log", "com.sun.tools.javac.util.Log");
+    }
+
+    void test(String opt, String clazz) throws Exception {
+        System.err.println("test " + opt);
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(new String[] { opt }, pw);
+        pw.close();
+        String out = sw.toString();
+        System.err.println("javac rc=" + rc + "\n" + out);
+        if (!out.contains(clazz))
+            throw new Exception("class name not found in output");
+        int lastDot = clazz.lastIndexOf(".");
+        if (!out.contains(clazz.substring(lastDot + 1) + ".class"))
+            throw new Exception("location of class not found in output");
+        if (!out.contains("MD5 checksum: "))
+            throw new Exception("checksum not found in output");
+    }
+}
--- a/test/tools/javac/generics/diamond/neg/Neg01.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg01.java	Thu Apr 29 14:36:20 2010 -0700
@@ -1,10 +1,10 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6840638
+ * @bug 6939620
  *
- * @summary  Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond')
+ * @summary  Switch to 'complex' diamond inference scheme
  * @author mcimadamore
- * @compile/fail/ref=Neg01.out Neg01.java -source 1.7 -XDrawDiagnostics
+ * @compile/fail/ref=Neg01.out Neg01.java -XDrawDiagnostics
  *
  */
 
@@ -15,24 +15,24 @@
     <Z> Neg01(X x, Z z) {}
 
     void test() {
-        Neg01<String> n1 = new Neg01<>(""); //new Foo<Integer> created
-        Neg01<? extends String> n2 = new Neg01<>(""); //new Foo<Integer> created
-        Neg01<?> n3 = new Neg01<>(""); //new Foo<Object> created
-        Neg01<? super String> n4 = new Neg01<>(""); //new Foo<Object> created
+        Neg01<String> n1 = new Neg01<>("");
+        Neg01<? extends String> n2 = new Neg01<>("");
+        Neg01<?> n3 = new Neg01<>("");
+        Neg01<? super String> n4 = new Neg01<>("");
 
-        Neg01<String> n5 = new Neg01<>(""){}; //new Foo<Integer> created
-        Neg01<? extends String> n6 = new Neg01<>(""){}; //new Foo<Integer> created
-        Neg01<?> n7 = new Neg01<>(""){}; //new Foo<Object> created
-        Neg01<? super String> n8 = new Neg01<>(""){}; //new Foo<Object> created
+        Neg01<String> n5 = new Neg01<>(""){};
+        Neg01<? extends String> n6 = new Neg01<>(""){};
+        Neg01<?> n7 = new Neg01<>(""){};
+        Neg01<? super String> n8 = new Neg01<>(""){};
 
-        Neg01<String> n9 = new Neg01<>("", ""); //new Foo<Integer> created
-        Neg01<? extends String> n10 = new Neg01<>("", ""); //new Foo<Integer> created
-        Neg01<?> n11 = new Neg01<>("", ""); //new Foo<Object> created
-        Foo<? super String> n12 = new Neg01<>("", ""); //new Foo<Object> created
+        Neg01<String> n9 = new Neg01<>("", "");
+        Neg01<? extends String> n10 = new Neg01<>("", "");
+        Neg01<?> n11 = new Neg01<>("", "");
+        Foo<? super String> n12 = new Neg01<>("", "");
 
-        Neg01<String> n13 = new Neg01<>("", ""){}; //new Foo<Integer> created
-        Neg01<? extends String> n14 = new Neg01<>("", ""){}; //new Foo<Integer> created
-        Neg01<?> n15 = new Neg01<>("", ""){}; //new Foo<Object> created
-        Neg01<? super String> n16 = new Neg01<>("", ""){}; //new Foo<Object> created
+        Neg01<String> n13 = new Neg01<>("", ""){};
+        Neg01<? extends String> n14 = new Neg01<>("", ""){};
+        Neg01<?> n15 = new Neg01<>("", ""){};
+        Neg01<? super String> n16 = new Neg01<>("", ""){};
     }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg01.out	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg01.out	Thu Apr 29 14:36:20 2010 -0700
@@ -1,31 +1,29 @@
 Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String
-Neg01.java:18:37: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<java.lang.String>)
+Neg01.java:18:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg01.java:19:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg01.java:20:23: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String, kindname.class, Neg01<java.lang.Number>
+Neg01.java:19:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:20:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String
-Neg01.java:21:45: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<? super java.lang.String>)
+Neg01.java:21:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String
-Neg01.java:23:37: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<java.lang.String>)
+Neg01.java:23:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg01.java:24:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg01.java:25:23: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String, kindname.class, Neg01<java.lang.Number>
-Neg01.java:25:38: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , , kindname.class, Neg01<java.lang.Number>
+Neg01.java:24:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:25:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String
-Neg01.java:26:45: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<? super java.lang.String>)
+Neg01.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String
-Neg01.java:28:37: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<java.lang.String>)
+Neg01.java:28:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg01.java:29:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg01.java:30:24: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String,java.lang.String, kindname.class, Neg01<java.lang.Number>
+Neg01.java:29:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:30:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , kindname.class, Neg01<X>
-Neg01.java:31:35: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String,java.lang.String, kindname.class, Neg01<java.lang.Number>
+Neg01.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String
-Neg01.java:33:38: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<java.lang.String>)
+Neg01.java:33:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg01.java:34:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg01.java:35:24: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String,java.lang.String, kindname.class, Neg01<java.lang.Number>
-Neg01.java:35:43: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , , kindname.class, Neg01<java.lang.Number>
+Neg01.java:34:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:35:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
 Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String
-Neg01.java:36:46: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<? super java.lang.String>)
-30 errors
+Neg01.java:36:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+28 errors
--- a/test/tools/javac/generics/diamond/neg/Neg02.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg02.java	Thu Apr 29 14:36:20 2010 -0700
@@ -1,10 +1,10 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6840638
+ * @bug 6939620
  *
- * @summary  Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond')
+ * @summary  Switch to 'complex' diamond inference scheme
  * @author mcimadamore
- * @compile/fail/ref=Neg02.out Neg02.java -source 1.7 -XDrawDiagnostics
+ * @compile/fail/ref=Neg02.out Neg02.java -XDrawDiagnostics
  *
  */
 
@@ -16,46 +16,46 @@
     }
 
     void testSimple() {
-        Foo<String> f1 = new Foo<>(""); //new Foo<Integer> created
-        Foo<? extends String> f2 = new Foo<>(""); //new Foo<Integer> created
-        Foo<?> f3 = new Foo<>(""); //new Foo<Object> created
-        Foo<? super String> f4 = new Foo<>(""); //new Foo<Object> created
+        Foo<String> f1 = new Foo<>("");
+        Foo<? extends String> f2 = new Foo<>("");
+        Foo<?> f3 = new Foo<>("");
+        Foo<? super String> f4 = new Foo<>("");
 
-        Foo<String> f5 = new Foo<>(""){}; //new Foo<Integer> created
-        Foo<? extends String> f6 = new Foo<>(""){}; //new Foo<Integer> created
-        Foo<?> f7 = new Foo<>(""){}; //new Foo<Object> created
-        Foo<? super String> f8 = new Foo<>(""){}; //new Foo<Object> created
+        Foo<String> f5 = new Foo<>(""){};
+        Foo<? extends String> f6 = new Foo<>(""){};
+        Foo<?> f7 = new Foo<>(""){};
+        Foo<? super String> f8 = new Foo<>(""){};
 
-        Foo<String> f9 = new Foo<>("", ""); //new Foo<Integer> created
-        Foo<? extends String> f10 = new Foo<>("", ""); //new Foo<Integer> created
-        Foo<?> f11 = new Foo<>("", ""); //new Foo<Object> created
-        Foo<? super String> f12 = new Foo<>("", ""); //new Foo<Object> created
+        Foo<String> f9 = new Foo<>("", "");
+        Foo<? extends String> f10 = new Foo<>("", "");
+        Foo<?> f11 = new Foo<>("", "");
+        Foo<? super String> f12 = new Foo<>("", "");
 
-        Foo<String> f13 = new Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<? extends String> f14 = new Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<?> f15 = new Foo<>("", ""){}; //new Foo<Object> created
-        Foo<? super String> f16 = new Foo<>("", ""){}; //new Foo<Object> created
+        Foo<String> f13 = new Foo<>("", ""){};
+        Foo<? extends String> f14 = new Foo<>("", ""){};
+        Foo<?> f15 = new Foo<>("", ""){};
+        Foo<? super String> f16 = new Foo<>("", ""){};
     }
 
     void testQualified() {
-        Foo<String> f1 = new Neg02.Foo<>(""); //new Foo<Integer> created
-        Foo<? extends String> f2 = new Neg02.Foo<>(""); //new Foo<Integer> created
-        Foo<?> f3 = new Neg02.Foo<>(""); //new Foo<Object> created
-        Foo<? super String> f4 = new Neg02.Foo<>(""); //new Foo<Object> created
+        Foo<String> f1 = new Neg02.Foo<>("");
+        Foo<? extends String> f2 = new Neg02.Foo<>("");
+        Foo<?> f3 = new Neg02.Foo<>("");
+        Foo<? super String> f4 = new Neg02.Foo<>("");
 
-        Foo<String> f5 = new Neg02.Foo<>(""){}; //new Foo<Integer> created
-        Foo<? extends String> f6 = new Neg02.Foo<>(""){}; //new Foo<Integer> created
-        Foo<?> f7 = new Neg02.Foo<>(""){}; //new Foo<Object> created
-        Foo<? super String> f8 = new Neg02.Foo<>(""){}; //new Foo<Object> created
+        Foo<String> f5 = new Neg02.Foo<>(""){};
+        Foo<? extends String> f6 = new Neg02.Foo<>(""){};
+        Foo<?> f7 = new Neg02.Foo<>(""){};
+        Foo<? super String> f8 = new Neg02.Foo<>(""){};
 
-        Foo<String> f9 = new Neg02.Foo<>("", ""); //new Foo<Integer> created
-        Foo<? extends String> f10 = new Neg02.Foo<>("", ""); //new Foo<Integer> created
-        Foo<?> f11 = new Neg02.Foo<>("", ""); //new Foo<Object> created
-        Foo<? super String> f12 = new Neg02.Foo<>("", ""); //new Foo<Object> created
+        Foo<String> f9 = new Neg02.Foo<>("", "");
+        Foo<? extends String> f10 = new Neg02.Foo<>("", "");
+        Foo<?> f11 = new Neg02.Foo<>("", "");
+        Foo<? super String> f12 = new Neg02.Foo<>("", "");
 
-        Foo<String> f13 = new Neg02.Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<? extends String> f14 = new Neg02.Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<?> f15 = new Neg02.Foo<>("", ""){}; //new Foo<Object> created
-        Foo<? super String> f16 = new Neg02.Foo<>("", ""){}; //new Foo<Object> created
+        Foo<String> f13 = new Neg02.Foo<>("", ""){};
+        Foo<? extends String> f14 = new Neg02.Foo<>("", ""){};
+        Foo<?> f15 = new Neg02.Foo<>("", ""){};
+        Foo<? super String> f16 = new Neg02.Foo<>("", ""){};
     }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg02.out	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg02.out	Thu Apr 29 14:36:20 2010 -0700
@@ -1,61 +1,57 @@
 Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String
-Neg02.java:19:33: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>)
+Neg02.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg02.java:20:43: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg02.java:21:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo<java.lang.Number>
+Neg02.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg02.java:22:41: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>)
+Neg02.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String
-Neg02.java:24:33: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>)
+Neg02.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg02.java:25:43: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg02.java:26:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo<java.lang.Number>
-Neg02.java:26:34: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo<java.lang.Number>
+Neg02.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg02.java:27:41: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>)
+Neg02.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String
-Neg02.java:29:33: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>)
+Neg02.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg02.java:30:44: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg02.java:31:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo<java.lang.Number>
+Neg02.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg02.java:32:42: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>)
+Neg02.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String
-Neg02.java:34:34: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>)
+Neg02.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg02.java:35:44: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg02.java:36:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo<java.lang.Number>
-Neg02.java:36:39: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo<java.lang.Number>
+Neg02.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg02.java:37:42: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>)
+Neg02.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String
-Neg02.java:41:39: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>)
+Neg02.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg02.java:42:49: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg02.java:43:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo<java.lang.Number>
+Neg02.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg02.java:44:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>)
+Neg02.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String
-Neg02.java:46:39: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>)
+Neg02.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg02.java:47:49: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg02.java:48:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo<java.lang.Number>
-Neg02.java:48:40: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo<java.lang.Number>
+Neg02.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg02.java:49:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>)
+Neg02.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String
-Neg02.java:51:39: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>)
+Neg02.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg02.java:52:50: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg02.java:53:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo<java.lang.Number>
+Neg02.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg02.java:54:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>)
+Neg02.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String
-Neg02.java:56:40: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>)
+Neg02.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg02.java:57:50: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number)
-Neg02.java:58:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo<java.lang.Number>
-Neg02.java:58:45: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo<java.lang.Number>
+Neg02.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
 Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg02.java:59:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>)
-60 errors
+Neg02.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+56 errors
--- a/test/tools/javac/generics/diamond/neg/Neg03.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg03.java	Thu Apr 29 14:36:20 2010 -0700
@@ -1,10 +1,10 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6840638
+ * @bug 6939620
  *
- * @summary  Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond')
+ * @summary  Switch to 'complex' diamond inference scheme
  * @author mcimadamore
- * @compile/fail/ref=Neg03.out Neg03.java -source 1.7 -XDrawDiagnostics
+ * @compile/fail/ref=Neg03.out Neg03.java -XDrawDiagnostics
  *
  */
 
@@ -16,68 +16,68 @@
     }
 
     void testSimple() {
-        Foo<String> f1 = new Foo<>(""); //new Foo<Integer> created
-        Foo<? extends String> f2 = new Foo<>(""); //new Foo<Integer> created
-        Foo<?> f3 = new Foo<>(""); //new Foo<Object> created
-        Foo<? super String> f4 = new Foo<>(""); //new Foo<Object> created
+        Foo<String> f1 = new Foo<>("");
+        Foo<? extends String> f2 = new Foo<>("");
+        Foo<?> f3 = new Foo<>("");
+        Foo<? super String> f4 = new Foo<>("");
 
-        Foo<String> f5 = new Foo<>(""){}; //new Foo<Integer> created
-        Foo<? extends String> f6 = new Foo<>(""){}; //new Foo<Integer> created
-        Foo<?> f7 = new Foo<>(""){}; //new Foo<Object> created
-        Foo<? super String> f8 = new Foo<>(""){}; //new Foo<Object> created
+        Foo<String> f5 = new Foo<>(""){};
+        Foo<? extends String> f6 = new Foo<>(""){};
+        Foo<?> f7 = new Foo<>(""){};
+        Foo<? super String> f8 = new Foo<>(""){};
 
-        Foo<String> f9 = new Foo<>("", ""); //new Foo<Integer> created
-        Foo<? extends String> f10 = new Foo<>("", ""); //new Foo<Integer> created
-        Foo<?> f11 = new Foo<>("", ""); //new Foo<Object> created
-        Foo<? super String> f12 = new Foo<>("", ""); //new Foo<Object> created
+        Foo<String> f9 = new Foo<>("", "");
+        Foo<? extends String> f10 = new Foo<>("", "");
+        Foo<?> f11 = new Foo<>("", "");
+        Foo<? super String> f12 = new Foo<>("", "");
 
-        Foo<String> f13 = new Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<? extends String> f14 = new Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<?> f15 = new Foo<>("", ""){}; //new Foo<Object> created
-        Foo<? super String> f16 = new Foo<>("", ""){}; //new Foo<Object> created
+        Foo<String> f13 = new Foo<>("", ""){};
+        Foo<? extends String> f14 = new Foo<>("", ""){};
+        Foo<?> f15 = new Foo<>("", ""){};
+        Foo<? super String> f16 = new Foo<>("", ""){};
     }
 
     void testQualified_1() {
-        Foo<String> f1 = new Neg03<U>.Foo<>(""); //new Foo<Integer> created
-        Foo<? extends String> f2 = new Neg03<U>.Foo<>(""); //new Foo<Integer> created
-        Foo<?> f3 = new Neg03<U>.Foo<>(""); //new Foo<Object> created
-        Foo<? super String> f4 = new Neg03<U>.Foo<>(""); //new Foo<Object> created
+        Foo<String> f1 = new Neg03<U>.Foo<>("");
+        Foo<? extends String> f2 = new Neg03<U>.Foo<>("");
+        Foo<?> f3 = new Neg03<U>.Foo<>("");
+        Foo<? super String> f4 = new Neg03<U>.Foo<>("");
 
-        Foo<String> f5 = new Neg03<U>.Foo<>(""){}; //new Foo<Integer> created
-        Foo<? extends String> f6 = new Neg03<U>.Foo<>(""){}; //new Foo<Integer> created
-        Foo<?> f7 = new Neg03<U>.Foo<>(""){}; //new Foo<Object> created
-        Foo<? super String> f8 = new Neg03<U>.Foo<>(""){}; //new Foo<Object> created
+        Foo<String> f5 = new Neg03<U>.Foo<>(""){};
+        Foo<? extends String> f6 = new Neg03<U>.Foo<>(""){};
+        Foo<?> f7 = new Neg03<U>.Foo<>(""){};
+        Foo<? super String> f8 = new Neg03<U>.Foo<>(""){};
 
-        Foo<String> f9 = new Neg03<U>.Foo<>("", ""); //new Foo<Integer> created
-        Foo<? extends String> f10 = new Neg03<U>.Foo<>("", ""); //new Foo<Integer> created
-        Foo<?> f11 = new Neg03<U>.Foo<>("", ""); //new Foo<Object> created
-        Foo<? super String> f12 = new Neg03<U>.Foo<>("", ""); //new Foo<Object> created
+        Foo<String> f9 = new Neg03<U>.Foo<>("", "");
+        Foo<? extends String> f10 = new Neg03<U>.Foo<>("", "");
+        Foo<?> f11 = new Neg03<U>.Foo<>("", "");
+        Foo<? super String> f12 = new Neg03<U>.Foo<>("", "");
 
-        Foo<String> f13 = new Neg03<U>.Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<? extends String> f14 = new Neg03<U>.Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<?> f15 = new Neg03<U>.Foo<>("", ""){}; //new Foo<Object> created
-        Foo<? super String> f16 = new Neg03<U>.Foo<>("", ""){}; //new Foo<Object> created
+        Foo<String> f13 = new Neg03<U>.Foo<>("", ""){};
+        Foo<? extends String> f14 = new Neg03<U>.Foo<>("", ""){};
+        Foo<?> f15 = new Neg03<U>.Foo<>("", ""){};
+        Foo<? super String> f16 = new Neg03<U>.Foo<>("", ""){};
     }
 
     void testQualified_2(Neg03<U> n) {
-        Foo<String> f1 = n.new Foo<>(""); //new Foo<Integer> created
-        Foo<? extends String> f2 = n.new Foo<>(""); //new Foo<Integer> created
-        Foo<?> f3 = n.new Foo<>(""); //new Foo<Integer> created
-        Foo<? super String> f4 = n.new Foo<>(""); //new Foo<Integer> created
+        Foo<String> f1 = n.new Foo<>("");
+        Foo<? extends String> f2 = n.new Foo<>("");
+        Foo<?> f3 = n.new Foo<>("");
+        Foo<? super String> f4 = n.new Foo<>("");
 
-        Foo<String> f5 = n.new Foo<>(""){}; //new Foo<Integer> created
-        Foo<? extends String> f6 = n.new Foo<>(""){}; //new Foo<Integer> created
-        Foo<?> f7 = n.new Foo<>(""){}; //new Foo<Integer> created
-        Foo<? super String> f8 = n.new Foo<>(""){}; //new Foo<Integer> created
+        Foo<String> f5 = n.new Foo<>(""){};
+        Foo<? extends String> f6 = n.new Foo<>(""){};
+        Foo<?> f7 = n.new Foo<>(""){};
+        Foo<? super String> f8 = n.new Foo<>(""){};
 
-        Foo<String> f9 = n.new Foo<>("", ""); //new Foo<Integer> created
-        Foo<? extends String> f10 = n.new Foo<>("", ""); //new Foo<Integer> created
-        Foo<?> f11 = n.new Foo<>("", ""); //new Foo<Integer> created
-        Foo<? super String> f12 = n.new Foo<>("", ""); //new Foo<Integer> created
+        Foo<String> f9 = n.new Foo<>("", "");
+        Foo<? extends String> f10 = n.new Foo<>("", "");
+        Foo<?> f11 = n.new Foo<>("", "");
+        Foo<? super String> f12 = n.new Foo<>("", "");
 
-        Foo<String> f13 = n.new Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<? extends String> f14 = n.new Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<?> f15 = n.new Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<? super String> f16 = n.new Foo<>("", ""){}; //new Foo<Integer> created
+        Foo<String> f13 = n.new Foo<>("", ""){};
+        Foo<? extends String> f14 = n.new Foo<>("", ""){};
+        Foo<?> f15 = n.new Foo<>("", ""){};
+        Foo<? super String> f16 = n.new Foo<>("", ""){};
     }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg03.out	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg03.out	Thu Apr 29 14:36:20 2010 -0700
@@ -1,91 +1,85 @@
 Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:19:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:20:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:21:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:22:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:24:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:25:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:26:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
-Neg03.java:26:34: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:27:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:29:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:30:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:31:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:32:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:34:34: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:35:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:36:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
-Neg03.java:36:39: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:37:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:41:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:42:52: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:43:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:44:50: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:46:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:47:52: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:48:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
-Neg03.java:48:43: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:49:50: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:51:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:52:53: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:53:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:54:51: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:56:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:57:53: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:58:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
-Neg03.java:58:48: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:59:51: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:63:28: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:63:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:64:38: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:65:23: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:64:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:65:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:66:36: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:66:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:68:28: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:68:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:69:38: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:70:23: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
-Neg03.java:70:36: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:69:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:70:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:71:36: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:71:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:73:28: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:73:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:74:39: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:75:24: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:74:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:75:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:76:37: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
+Neg03.java:76:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String
-Neg03.java:78:29: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>)
+Neg03.java:78:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg03.java:79:39: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg03.java:80:24: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number>
-Neg03.java:80:41: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number>
+Neg03.java:79:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:80:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
 Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg03.java:81:37: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>)
-90 errors
+Neg03.java:81:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+84 errors
--- a/test/tools/javac/generics/diamond/neg/Neg04.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg04.java	Thu Apr 29 14:36:20 2010 -0700
@@ -1,10 +1,10 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6840638
+ * @bug 6939620
  *
- * @summary  Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond')
+ * @summary  Switch to 'complex' diamond inference scheme
  * @author mcimadamore
- * @compile/fail/ref=Neg04.out Neg04.java -source 1.7 -XDrawDiagnostics
+ * @compile/fail/ref=Neg04.out Neg04.java -XDrawDiagnostics
  *
  */
 
@@ -15,24 +15,24 @@
             Foo(V x) {}
             <Z> Foo(V x, Z z) {}
         }
-        Foo<String> n1 = new Foo<>(""); //new Foo<Integer> created
-        Foo<? extends String> n2 = new Foo<>(""); //new Foo<Integer> created
-        Foo<?> n3 = new Foo<>(""); //new Foo<Object> created
-        Foo<? super String> n4 = new Foo<>(""); //new Foo<Object> created
+        Foo<String> n1 = new Foo<>("");
+        Foo<? extends String> n2 = new Foo<>("");
+        Foo<?> n3 = new Foo<>("");
+        Foo<? super String> n4 = new Foo<>("");
 
-        Foo<String> n5 = new Foo<>(""){}; //new Foo<Integer> created
-        Foo<? extends String> n6 = new Foo<>(""){}; //new Foo<Integer> created
-        Foo<?> n7 = new Foo<>(""){}; //new Foo<Object> created
-        Foo<? super String> n8 = new Foo<>(""){}; //new Foo<Object> created
+        Foo<String> n5 = new Foo<>(""){};
+        Foo<? extends String> n6 = new Foo<>(""){};
+        Foo<?> n7 = new Foo<>(""){};
+        Foo<? super String> n8 = new Foo<>(""){};
 
-        Foo<String> n9 = new Foo<>("", ""); //new Foo<Integer> created
-        Foo<? extends String> n10 = new Foo<>("", ""); //new Foo<Integer> created
-        Foo<?> n11 = new Foo<>("", ""); //new Foo<Object> created
-        Foo<? super String> n12 = new Foo<>("", ""); //new Foo<Object> created
+        Foo<String> n9 = new Foo<>("", "");
+        Foo<? extends String> n10 = new Foo<>("", "");
+        Foo<?> n11 = new Foo<>("", "");
+        Foo<? super String> n12 = new Foo<>("", "");
 
-        Foo<String> n13 = new Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<? extends String> n14 = new Foo<>("", ""){}; //new Foo<Integer> created
-        Foo<?> n15 = new Foo<>("", ""){}; //new Foo<Object> created
-        Foo<? super String> n16 = new Foo<>("", ""){}; //new Foo<Object> created
+        Foo<String> n13 = new Foo<>("", ""){};
+        Foo<? extends String> n14 = new Foo<>("", ""){};
+        Foo<?> n15 = new Foo<>("", ""){};
+        Foo<? super String> n16 = new Foo<>("", ""){};
     }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg04.out	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg04.out	Thu Apr 29 14:36:20 2010 -0700
@@ -1,31 +1,29 @@
 Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String
-Neg04.java:18:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<java.lang.String>)
+Neg04.java:18:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg04.java:19:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg04.java:20:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Foo<java.lang.Number>
+Neg04.java:19:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:20:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg04.java:21:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<? super java.lang.String>)
+Neg04.java:21:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String
-Neg04.java:23:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<java.lang.String>)
+Neg04.java:23:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg04.java:24:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg04.java:25:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Foo<java.lang.Number>
-Neg04.java:25:34: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Foo<java.lang.Number>
+Neg04.java:24:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:25:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg04.java:26:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<? super java.lang.String>)
+Neg04.java:26:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String
-Neg04.java:28:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<java.lang.String>)
+Neg04.java:28:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg04.java:29:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg04.java:30:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Foo<java.lang.Number>
+Neg04.java:29:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:30:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg04.java:31:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<? super java.lang.String>)
+Neg04.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String
-Neg04.java:33:34: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<java.lang.String>)
+Neg04.java:33:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String
-Neg04.java:34:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number)
-Neg04.java:35:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Foo<java.lang.Number>
-Neg04.java:35:39: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Foo<java.lang.Number>
+Neg04.java:34:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:35:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
 Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String
-Neg04.java:36:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<? super java.lang.String>)
-30 errors
+Neg04.java:36:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+28 errors
--- a/test/tools/javac/generics/diamond/neg/Neg05.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg05.java	Thu Apr 29 14:36:20 2010 -0700
@@ -1,10 +1,10 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6840638
+ * @bug 6939620
  *
- * @summary  Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond')
+ * @summary  Switch to 'complex' diamond inference scheme
  * @author mcimadamore
- * @compile/fail/ref=Neg05.out Neg05.java -source 1.7 -XDrawDiagnostics
+ * @compile/fail/ref=Neg05.out Neg05.java -XDrawDiagnostics
  *
  */
 
@@ -16,46 +16,46 @@
     }
 
     void testRare_1() {
-        Neg05<?>.Foo<String> f1 = new Neg05.Foo<>(""); //new Foo<Integer> created
-        Neg05<?>.Foo<? extends String> f2 = new Neg05.Foo<>(""); //new Foo<Integer> created
-        Neg05<?>.Foo<?> f3 = new Neg05.Foo<>(""); //new Foo<Object> created
-        Neg05<?>.Foo<? super String> f4 = new Neg05.Foo<>(""); //new Foo<Object> created
+        Neg05<?>.Foo<String> f1 = new Neg05.Foo<>("");
+        Neg05<?>.Foo<? extends String> f2 = new Neg05.Foo<>("");
+        Neg05<?>.Foo<?> f3 = new Neg05.Foo<>("");
+        Neg05<?>.Foo<? super String> f4 = new Neg05.Foo<>("");
 
-        Neg05<?>.Foo<String> f5 = new Neg05.Foo<>(""){}; //new Foo<Integer> created
-        Neg05<?>.Foo<? extends String> f6 = new Neg05.Foo<>(""){}; //new Foo<Integer> created
-        Neg05<?>.Foo<?> f7 = new Neg05.Foo<>(""){}; //new Foo<Object> created
-        Neg05<?>.Foo<? super String> f8 = new Neg05.Foo<>(""){}; //new Foo<Object> created
+        Neg05<?>.Foo<String> f5 = new Neg05.Foo<>(""){};
+        Neg05<?>.Foo<? extends String> f6 = new Neg05.Foo<>(""){};
+        Neg05<?>.Foo<?> f7 = new Neg05.Foo<>(""){};
+        Neg05<?>.Foo<? super String> f8 = new Neg05.Foo<>(""){};
 
-        Neg05<?>.Foo<String> f9 = new Neg05.Foo<>("", ""); //new Foo<Integer> created
-        Neg05<?>.Foo<? extends String> f10 = new Neg05.Foo<>("", ""); //new Foo<Integer> created
-        Neg05<?>.Foo<?> f11 = new Neg05.Foo<>("", ""); //new Foo<Object> created
-        Neg05<?>.Foo<? super String> f12 = new Neg05.Foo<>("", ""); //new Foo<Object> created
+        Neg05<?>.Foo<String> f9 = new Neg05.Foo<>("", "");
+        Neg05<?>.Foo<? extends String> f10 = new Neg05.Foo<>("", "");
+        Neg05<?>.Foo<?> f11 = new Neg05.Foo<>("", "");
+        Neg05<?>.Foo<? super String> f12 = new Neg05.Foo<>("", "");
 
-        Neg05<?>.Foo<String> f13 = new Neg05.Foo<>("", ""){}; //new Foo<Integer> created
-        Neg05<?>.Foo<? extends String> f14 = new Neg05.Foo<>("", ""){}; //new Foo<Integer> created
-        Neg05<?>.Foo<?> f15 = new Neg05.Foo<>("", ""){}; //new Foo<Object> created
-        Neg05<?>.Foo<? super String> f16 = new Neg05.Foo<>("", ""){}; //new Foo<Object> created
+        Neg05<?>.Foo<String> f13 = new Neg05.Foo<>("", ""){};
+        Neg05<?>.Foo<? extends String> f14 = new Neg05.Foo<>("", ""){};
+        Neg05<?>.Foo<?> f15 = new Neg05.Foo<>("", ""){};
+        Neg05<?>.Foo<? super String> f16 = new Neg05.Foo<>("", ""){};
     }
 
     void testRare_2(Neg05 n) {
-        Neg05<?>.Foo<String> f1 = n.new Foo<>(""); //new Foo<Integer> created
-        Neg05<?>.Foo<? extends String> f2 = n.new Foo<>(""); //new Foo<Integer> created
-        Neg05<?>.Foo<?> f3 = n.new Foo<>(""); //new Foo<Integer> created
-        Neg05<?>.Foo<? super String> f4 = n.new Foo<>(""); //new Foo<Integer> created
+        Neg05<?>.Foo<String> f1 = n.new Foo<>("");
+        Neg05<?>.Foo<? extends String> f2 = n.new Foo<>("");
+        Neg05<?>.Foo<?> f3 = n.new Foo<>("");
+        Neg05<?>.Foo<? super String> f4 = n.new Foo<>("");
 
-        Neg05<?>.Foo<String> f5 = n.new Foo<>(""){}; //new Foo<Integer> created
-        Neg05<?>.Foo<? extends String> f6 = n.new Foo<>(""){}; //new Foo<Integer> created
-        Neg05<?>.Foo<?> f7 = n.new Foo<>(""){}; //new Foo<Integer> created
-        Neg05<?>.Foo<? super String> f8 = n.new Foo<>(""){}; //new Foo<Integer> created
+        Neg05<?>.Foo<String> f5 = n.new Foo<>(""){};
+        Neg05<?>.Foo<? extends String> f6 = n.new Foo<>(""){};
+        Neg05<?>.Foo<?> f7 = n.new Foo<>(""){};
+        Neg05<?>.Foo<? super String> f8 = n.new Foo<>(""){};
 
-        Neg05<?>.Foo<String> f9 = n.new Foo<>("", ""); //new Foo<Integer> created
-        Neg05<?>.Foo<? extends String> f10 = n.new Foo<>("", ""); //new Foo<Integer> created
-        Neg05<?>.Foo<?> f11 = n.new Foo<>("", ""); //new Foo<Integer> created
-        Neg05<?>.Foo<? super String> f12 = n.new Foo<>("", ""); //new Foo<Integer> created
+        Neg05<?>.Foo<String> f9 = n.new Foo<>("", "");
+        Neg05<?>.Foo<? extends String> f10 = n.new Foo<>("", "");
+        Neg05<?>.Foo<?> f11 = n.new Foo<>("", "");
+        Neg05<?>.Foo<? super String> f12 = n.new Foo<>("", "");
 
-        Neg05<?>.Foo<String> f13 = n.new Foo<>("", ""){}; //new Foo<Integer> created
-        Neg05<?>.Foo<? extends String> f14 = n.new Foo<>("", ""){}; //new Foo<Integer> created
-        Neg05<?>.Foo<?> f15 = n.new Foo<>("", ""){}; //new Foo<Integer> created
-        Neg05<?>.Foo<? super String> f16 = n.new Foo<>("", ""){}; //new Foo<Integer> created
+        Neg05<?>.Foo<String> f13 = n.new Foo<>("", ""){};
+        Neg05<?>.Foo<? extends String> f14 = n.new Foo<>("", ""){};
+        Neg05<?>.Foo<?> f15 = n.new Foo<>("", ""){};
+        Neg05<?>.Foo<? super String> f16 = n.new Foo<>("", ""){};
     }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg05.out	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/neg/Neg05.out	Thu Apr 29 14:36:20 2010 -0700
@@ -1,19 +1,35 @@
 Neg05.java:19:48: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:19:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
 Neg05.java:20:58: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:20:45: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
 Neg05.java:21:43: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:21:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
 Neg05.java:22:56: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:22:43: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
 Neg05.java:24:48: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:24:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.anonymous.class: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
 Neg05.java:25:58: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:25:45: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.anonymous.class: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
 Neg05.java:26:43: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:26:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.anonymous.class: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
 Neg05.java:27:56: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:27:43: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.anonymous.class: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
 Neg05.java:29:48: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:29:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
 Neg05.java:30:59: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:30:46: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
 Neg05.java:31:44: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:31:31: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
 Neg05.java:32:57: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:32:44: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
 Neg05.java:34:49: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:34:36: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.anonymous.class: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
 Neg05.java:35:59: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:35:46: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.anonymous.class: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
 Neg05.java:36:44: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:36:31: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.anonymous.class: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
 Neg05.java:37:57: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:37:44: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.anonymous.class: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
 Neg05.java:41:37: compiler.err.improperly.formed.type.inner.raw.param
 Neg05.java:42:47: compiler.err.improperly.formed.type.inner.raw.param
 Neg05.java:43:32: compiler.err.improperly.formed.type.inner.raw.param
@@ -30,4 +46,4 @@
 Neg05.java:57:48: compiler.err.improperly.formed.type.inner.raw.param
 Neg05.java:58:33: compiler.err.improperly.formed.type.inner.raw.param
 Neg05.java:59:46: compiler.err.improperly.formed.type.inner.raw.param
-32 errors
+48 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg06.java	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,21 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6939620
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
+ * @author mcimadamore
+ * @compile/fail/ref=Neg06.out Neg06.java -XDrawDiagnostics
+ *
+ */
+
+class Neg06 {
+   interface ISuperFoo<X> {}
+   interface IFoo<X extends Number> extends ISuperFoo<X> {}
+
+   static class CSuperFoo<X> {}
+   static class CFoo<X extends Number> extends CSuperFoo<X> {}
+
+   ISuperFoo<String> isf = new IFoo<>() {};
+   CSuperFoo<String> csf1 = new CFoo<>();
+   CSuperFoo<String> csf2 = new CFoo<>() {};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg06.out	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,4 @@
+Neg06.java:18:36: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.IFoo), (compiler.misc.no.conforming.instance.exists: X, Neg06.IFoo<X>, Neg06.ISuperFoo<java.lang.String>)
+Neg06.java:19:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>)
+Neg06.java:20:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>)
+3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg07.java	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,19 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6939620
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
+ * @author mcimadamore
+ * @compile/fail/ref=Neg07.out Neg07.java -XDrawDiagnostics
+ *
+ */
+
+class Neg07 {
+   static class SuperFoo<X> {}
+   static class Foo<X extends Number> extends SuperFoo<X> {
+       Foo(X x) {}
+   }
+
+   SuperFoo<String> sf1 = new Foo<>("");
+   SuperFoo<String> sf2 = new Foo<>("") {};
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg07.out	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,3 @@
+Neg07.java:17:27: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg07.Foo), (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.String, java.lang.Number)
+Neg07.java:18:27: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg07.Foo), (compiler.misc.inferred.do.not.conform.to.bounds: java.lang.String, java.lang.Number)
+2 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg08.java	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,30 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6939620 6894753
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
+ * @author mcimadamore
+ * @compile/fail/ref=Neg08.out Neg08.java -XDrawDiagnostics
+ *
+ */
+
+class Neg08 {
+    static class Foo<X> {
+        Foo(X x) {  }
+    }
+
+    static class DoubleFoo<X,Y> {
+        DoubleFoo(X x,Y y) {  }
+    }
+
+    static class TripleFoo<X,Y,Z> {
+        TripleFoo(X x,Y y,Z z) {  }
+    }
+
+    Foo<? extends Integer> fi = new Foo<>(1);
+    Foo<?> fw = new Foo<>(fi);
+    Foo<? extends Double> fd = new Foo<>(3.0);
+    DoubleFoo<?,?> dw = new DoubleFoo<>(fi,fd);
+    Foo<String> fs = new Foo<>("one");
+    TripleFoo<?,?,?> tw = new TripleFoo<>(fi,fd,fs);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg08.out	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,4 @@
+Neg08.java:25:24: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg08.Foo), (compiler.misc.diamond.invalid.arg: Neg08.Foo<compiler.misc.type.captureof: 1, ? extends java.lang.Integer>, (compiler.misc.diamond: Neg08.Foo))
+Neg08.java:27:38: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg08.DoubleFoo), (compiler.misc.diamond.invalid.args: Neg08.Foo<compiler.misc.type.captureof: 1, ? extends java.lang.Integer>,Neg08.Foo<compiler.misc.type.captureof: 2, ? extends java.lang.Double>, (compiler.misc.diamond: Neg08.DoubleFoo))
+Neg08.java:29:40: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg08.TripleFoo), (compiler.misc.diamond.invalid.args: Neg08.Foo<compiler.misc.type.captureof: 1, ? extends java.lang.Integer>,Neg08.Foo<compiler.misc.type.captureof: 2, ? extends java.lang.Double>, (compiler.misc.diamond: Neg08.TripleFoo))
+3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg09.java	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,22 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6939620 6894753
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
+ * @author mcimadamore
+ * @compile/fail/ref=Neg09.out Neg09.java -XDrawDiagnostics
+ *
+ */
+
+class Neg09 {
+    static class Foo<X extends Number & Comparable<Number>> {}
+    static class DoubleFoo<X extends Number & Comparable<Number>,
+                           Y extends Number & Comparable<Number>> {}
+    static class TripleFoo<X extends Number & Comparable<Number>,
+                           Y extends Number & Comparable<Number>,
+                           Z> {}
+
+    Foo<?> fw = new Foo<>();
+    DoubleFoo<?,?> dw = new DoubleFoo<>();
+    TripleFoo<?,?,?> tw = new TripleFoo<>();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg09.out	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,4 @@
+Neg09.java:19:24: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg09.Foo), (compiler.misc.diamond.invalid.arg: java.lang.Number&java.lang.Comparable<java.lang.Number>, (compiler.misc.diamond: Neg09.Foo))
+Neg09.java:20:38: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg09.DoubleFoo), (compiler.misc.diamond.invalid.args: java.lang.Number&java.lang.Comparable<java.lang.Number>,java.lang.Number&java.lang.Comparable<java.lang.Number>, (compiler.misc.diamond: Neg09.DoubleFoo))
+Neg09.java:21:40: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg09.TripleFoo), (compiler.misc.diamond.invalid.args: java.lang.Number&java.lang.Comparable<java.lang.Number>,java.lang.Number&java.lang.Comparable<java.lang.Number>, (compiler.misc.diamond: Neg09.TripleFoo))
+3 errors
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg10.java	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6939620
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
+ * @author mcimadamore
+ * @compile/fail/ref=Neg10.out Neg10.java -XDrawDiagnostics
+ *
+ */
+
+class Neg10 {
+    static class Foo<X> {
+        Foo(X x) {}
+    }
+
+    Foo<Number> fw = new Foo<>(1);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg10.out	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,2 @@
+Neg10.java:16:22: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg10.Foo<java.lang.Integer>, Neg10.Foo<java.lang.Number>
+1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg11.java	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,18 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 6939620
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
+ * @author mcimadamore
+ * @compile/fail/ref=Neg11.out Neg11.java -XDrawDiagnostics
+ *
+ */
+
+class Neg11 {
+
+    void test() {
+        class Foo<X extends Number> { }
+        Foo<?> f1 = new UndeclaredName<>(); //this is deliberate: aim is to test erroneous path
+        Foo<?> f2 = new UndeclaredName<>() {}; //this is deliberate: aim is to test erroneous path
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg11.out	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,3 @@
+Neg11.java:15:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , kindname.class, Neg11
+Neg11.java:16:25: compiler.err.cant.resolve.location: kindname.class, UndeclaredName, , , kindname.class, Neg11
+2 errors
--- a/test/tools/javac/generics/diamond/pos/Pos01.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/pos/Pos01.java	Thu Apr 29 14:36:20 2010 -0700
@@ -1,10 +1,33 @@
 /*
- * @test /nodynamiccopyright/
- * @bug 6840638
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * @summary  Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond')
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6939620
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
  * @author mcimadamore
- * @compile Pos01.java -source 1.7
+ * @compile Pos01.java
  * @run main Pos01
  *
  */
@@ -16,25 +39,25 @@
     <Z> Pos01(X x, Z z) {}
 
     void test() {
-        Pos01<Integer> p1 = new Pos01<>(1); //new Foo<Integer> created
-        Pos01<? extends Integer> p2 = new Pos01<>(1); //new Foo<Integer> created
-        Pos01<?> p3 = new Pos01<>(1); //new Foo<Object> created
-        Pos01<? super Integer> p4 = new Pos01<>(1); //new Foo<Object> created
+        Pos01<Integer> p1 = new Pos01<>(1);
+        Pos01<? extends Integer> p2 = new Pos01<>(1);
+        Pos01<?> p3 = new Pos01<>(1);
+        Pos01<? super Integer> p4 = new Pos01<>(1);
 
-        Pos01<Integer> p5 = new Pos01<>(1){}; //new Foo<Integer> created
-        Pos01<? extends Integer> p6 = new Pos01<>(1){}; //new Foo<Integer> created
-        Pos01<?> p7 = new Pos01<>(1){}; //new Foo<Object> created
-        Pos01<? super Integer> p8 = new Pos01<>(1){}; //new Foo<Object> created
+        Pos01<Integer> p5 = new Pos01<>(1){};
+        Pos01<? extends Integer> p6 = new Pos01<>(1){};
+        Pos01<?> p7 = new Pos01<>(1){};
+        Pos01<? super Integer> p8 = new Pos01<>(1){};
 
-        Pos01<Integer> p9 = new Pos01<>(1, ""); //new Foo<Integer> created
-        Pos01<? extends Integer> p10 = new Pos01<>(1, ""); //new Foo<Integer> created
-        Pos01<?> p11 = new Pos01<>(1, ""); //new Foo<Object> created
-        Pos01<? super Integer> p12 = new Pos01<>(1, ""); //new Foo<Object> created
+        Pos01<Integer> p9 = new Pos01<>(1, "");
+        Pos01<? extends Integer> p10 = new Pos01<>(1, "");
+        Pos01<?> p11 = new Pos01<>(1, "");
+        Pos01<? super Integer> p12 = new Pos01<>(1, "");
 
-        Pos01<Integer> p13 = new Pos01<>(1, ""){}; //new Foo<Integer> created
-        Pos01<? extends Integer> p14= new Pos01<>(1, ""){}; //new Foo<Integer> created
-        Pos01<?> p15 = new Pos01<>(1, ""){}; //new Foo<Object> created
-        Pos01<? super Integer> p16 = new Pos01<>(1, ""){}; //new Foo<Object> created
+        Pos01<Integer> p13 = new Pos01<>(1, ""){};
+        Pos01<? extends Integer> p14= new Pos01<>(1, ""){};
+        Pos01<?> p15 = new Pos01<>(1, ""){};
+        Pos01<? super Integer> p16 = new Pos01<>(1, ""){};
     }
 
     public static void main(String[] args) {
--- a/test/tools/javac/generics/diamond/pos/Pos02.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/pos/Pos02.java	Thu Apr 29 14:36:20 2010 -0700
@@ -1,10 +1,33 @@
 /*
- * @test /nodynamiccopyright/
- * @bug 6840638
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * @summary  Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond')
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6939620
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
  * @author mcimadamore
- * @compile Pos02.java -source 1.7
+ * @compile Pos02.java
  * @run main Pos02
  */
 
@@ -16,47 +39,47 @@
     }
 
     void testSimple() {
-        Foo<Integer> f1 = new Foo<>(1); //new Foo<Integer> created
-        Foo<? extends Integer> f2 = new Foo<>(1); //new Foo<Integer> created
-        Foo<?> f3 = new Foo<>(1); //new Foo<Object> created
-        Foo<? super Integer> f4 = new Foo<>(1); //new Foo<Object> created
+        Foo<Integer> f1 = new Foo<>(1);
+        Foo<? extends Integer> f2 = new Foo<>(1);
+        Foo<?> f3 = new Foo<>(1);
+        Foo<? super Integer> f4 = new Foo<>(1);
 
-        Foo<Integer> f5 = new Foo<>(1){}; //new Foo<Integer> created
-        Foo<? extends Integer> f6 = new Foo<>(1){}; //new Foo<Integer> created
-        Foo<?> f7 = new Foo<>(1){}; //new Foo<Object> created
-        Foo<? super Integer> f8 = new Foo<>(1){}; //new Foo<Object> created
+        Foo<Integer> f5 = new Foo<>(1){};
+        Foo<? extends Integer> f6 = new Foo<>(1){};
+        Foo<?> f7 = new Foo<>(1){};
+        Foo<? super Integer> f8 = new Foo<>(1){};
 
-        Foo<Integer> f9 = new Foo<>(1, ""); //new Foo<Integer> created
-        Foo<? extends Integer> f10 = new Foo<>(1, ""); //new Foo<Integer> created
-        Foo<?> f11 = new Foo<>(1, ""); //new Foo<Object> created
-        Foo<? super Integer> f12 = new Foo<>(1, ""); //new Foo<Object> created
+        Foo<Integer> f9 = new Foo<>(1, "");
+        Foo<? extends Integer> f10 = new Foo<>(1, "");
+        Foo<?> f11 = new Foo<>(1, "");
+        Foo<? super Integer> f12 = new Foo<>(1, "");
 
-        Foo<Integer> f13 = new Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<? extends Integer> f14 = new Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<?> f15 = new Foo<>(1, ""){}; //new Foo<Object> created
-        Foo<? super Integer> f16 = new Foo<>(1, ""){}; //new Foo<Object> created
+        Foo<Integer> f13 = new Foo<>(1, ""){};
+        Foo<? extends Integer> f14 = new Foo<>(1, ""){};
+        Foo<?> f15 = new Foo<>(1, ""){};
+        Foo<? super Integer> f16 = new Foo<>(1, ""){};
     }
 
     void testQualified() {
-        Foo<Integer> f1 = new Pos02.Foo<>(1); //new Foo<Integer> created
-        Foo<? extends Integer> f2 = new Pos02.Foo<>(1); //new Foo<Integer> created
-        Foo<?> f3 = new Pos02.Foo<>(1); //new Foo<Object> created
-        Foo<? super Integer> f4 = new Pos02.Foo<>(1); //new Foo<Object> created
+        Foo<Integer> f1 = new Pos02.Foo<>(1);
+        Foo<? extends Integer> f2 = new Pos02.Foo<>(1);
+        Foo<?> f3 = new Pos02.Foo<>(1);
+        Foo<? super Integer> f4 = new Pos02.Foo<>(1);
 
-        Foo<Integer> f5 = new Pos02.Foo<>(1){}; //new Foo<Integer> created
-        Foo<? extends Integer> f6 = new Pos02.Foo<>(1){}; //new Foo<Integer> created
-        Foo<?> f7 = new Pos02.Foo<>(1){}; //new Foo<Object> created
-        Foo<? super Integer> f8 = new Pos02.Foo<>(1){}; //new Foo<Object> created
+        Foo<Integer> f5 = new Pos02.Foo<>(1){};
+        Foo<? extends Integer> f6 = new Pos02.Foo<>(1){};
+        Foo<?> f7 = new Pos02.Foo<>(1){};
+        Foo<? super Integer> f8 = new Pos02.Foo<>(1){};
 
-        Foo<Integer> f9 = new Pos02.Foo<>(1, ""); //new Foo<Integer> created
-        Foo<? extends Integer> f10 = new Pos02.Foo<>(1, ""); //new Foo<Integer> created
-        Foo<?> f11 = new Pos02.Foo<>(1, ""); //new Foo<Object> created
-        Foo<? super Integer> f12 = new Pos02.Foo<>(1, ""); //new Foo<Object> created
+        Foo<Integer> f9 = new Pos02.Foo<>(1, "");
+        Foo<? extends Integer> f10 = new Pos02.Foo<>(1, "");
+        Foo<?> f11 = new Pos02.Foo<>(1, "");
+        Foo<? super Integer> f12 = new Pos02.Foo<>(1, "");
 
-        Foo<Integer> f13 = new Pos02.Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<? extends Integer> f14 = new Pos02.Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<?> f15 = new Pos02.Foo<>(1, ""){}; //new Foo<Object> created
-        Foo<? super Integer> f16 = new Pos02.Foo<>(1, ""){}; //new Foo<Object> created
+        Foo<Integer> f13 = new Pos02.Foo<>(1, ""){};
+        Foo<? extends Integer> f14 = new Pos02.Foo<>(1, ""){};
+        Foo<?> f15 = new Pos02.Foo<>(1, ""){};
+        Foo<? super Integer> f16 = new Pos02.Foo<>(1, ""){};
     }
 
     public static void main(String[] args) {
--- a/test/tools/javac/generics/diamond/pos/Pos03.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/pos/Pos03.java	Thu Apr 29 14:36:20 2010 -0700
@@ -1,10 +1,33 @@
 /*
- * @test /nodynamiccopyright/
- * @bug 6840638
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * @summary  Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond')
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6939620
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
  * @author mcimadamore
- * @compile Pos03.java -source 1.7
+ * @compile Pos03.java
  * @run main Pos03
  *
  */
@@ -17,69 +40,69 @@
     }
 
     void testSimple() {
-        Foo<Integer> f1 = new Foo<>(1); //new Foo<Integer> created
-        Foo<? extends Integer> f2 = new Foo<>(1); //new Foo<Integer> created
-        Foo<?> f3 = new Foo<>(1); //new Foo<Object> created
-        Foo<? super Integer> f4 = new Foo<>(1); //new Foo<Object> created
+        Foo<Integer> f1 = new Foo<>(1);
+        Foo<? extends Integer> f2 = new Foo<>(1);
+        Foo<?> f3 = new Foo<>(1);
+        Foo<? super Integer> f4 = new Foo<>(1);
 
-        Foo<Integer> f5 = new Foo<>(1){}; //new Foo<Integer> created
-        Foo<? extends Integer> f6 = new Foo<>(1){}; //new Foo<Integer> created
-        Foo<?> f7 = new Foo<>(1){}; //new Foo<Object> created
-        Foo<? super Integer> f8 = new Foo<>(1){}; //new Foo<Object> created
+        Foo<Integer> f5 = new Foo<>(1){};
+        Foo<? extends Integer> f6 = new Foo<>(1){};
+        Foo<?> f7 = new Foo<>(1){};
+        Foo<? super Integer> f8 = new Foo<>(1){};
 
-        Foo<Integer> f9 = new Foo<>(1, ""); //new Foo<Integer> created
-        Foo<? extends Integer> f10 = new Foo<>(1, ""); //new Foo<Integer> created
-        Foo<?> f11 = new Foo<>(1, ""); //new Foo<Object> created
-        Foo<? super Integer> f12 = new Foo<>(1, ""); //new Foo<Object> created
+        Foo<Integer> f9 = new Foo<>(1, "");
+        Foo<? extends Integer> f10 = new Foo<>(1, "");
+        Foo<?> f11 = new Foo<>(1, "");
+        Foo<? super Integer> f12 = new Foo<>(1, "");
 
-        Foo<Integer> f13 = new Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<? extends Integer> f14 = new Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<?> f15 = new Foo<>(1, ""){}; //new Foo<Object> created
-        Foo<? super Integer> f16 = new Foo<>(1, ""){}; //new Foo<Object> created
+        Foo<Integer> f13 = new Foo<>(1, ""){};
+        Foo<? extends Integer> f14 = new Foo<>(1, ""){};
+        Foo<?> f15 = new Foo<>(1, ""){};
+        Foo<? super Integer> f16 = new Foo<>(1, ""){};
     }
 
     void testQualified_1() {
-        Foo<Integer> f1 = new Pos03<U>.Foo<>(1); //new Foo<Integer> created
-        Foo<? extends Integer> f2 = new Pos03<U>.Foo<>(1); //new Foo<Integer> created
-        Foo<?> f3 = new Pos03<U>.Foo<>(1); //new Foo<Object> created
-        Foo<? super Integer> f4 = new Pos03<U>.Foo<>(1); //new Foo<Object> created
+        Foo<Integer> f1 = new Pos03<U>.Foo<>(1);
+        Foo<? extends Integer> f2 = new Pos03<U>.Foo<>(1);
+        Foo<?> f3 = new Pos03<U>.Foo<>(1);
+        Foo<? super Integer> f4 = new Pos03<U>.Foo<>(1);
 
-        Foo<Integer> f5 = new Pos03<U>.Foo<>(1){}; //new Foo<Integer> created
-        Foo<? extends Integer> f6 = new Pos03<U>.Foo<>(1){}; //new Foo<Integer> created
-        Foo<?> f7 = new Pos03<U>.Foo<>(1){}; //new Foo<Object> created
-        Foo<? super Integer> f8 = new Pos03<U>.Foo<>(1){}; //new Foo<Object> created
+        Foo<Integer> f5 = new Pos03<U>.Foo<>(1){};
+        Foo<? extends Integer> f6 = new Pos03<U>.Foo<>(1){};
+        Foo<?> f7 = new Pos03<U>.Foo<>(1){};
+        Foo<? super Integer> f8 = new Pos03<U>.Foo<>(1){};
 
-        Foo<Integer> f9 = new Pos03<U>.Foo<>(1, ""); //new Foo<Integer> created
-        Foo<? extends Integer> f10 = new Pos03<U>.Foo<>(1, ""); //new Foo<Integer> created
-        Foo<?> f11 = new Pos03<U>.Foo<>(1, ""); //new Foo<Object> created
-        Foo<? super Integer> f12 = new Pos03<U>.Foo<>(1, ""); //new Foo<Object> created
+        Foo<Integer> f9 = new Pos03<U>.Foo<>(1, "");
+        Foo<? extends Integer> f10 = new Pos03<U>.Foo<>(1, "");
+        Foo<?> f11 = new Pos03<U>.Foo<>(1, "");
+        Foo<? super Integer> f12 = new Pos03<U>.Foo<>(1, "");
 
-        Foo<Integer> f13 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<? extends Integer> f14 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<?> f15 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Object> created
-        Foo<? super Integer> f16 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Object> created
+        Foo<Integer> f13 = new Pos03<U>.Foo<>(1, ""){};
+        Foo<? extends Integer> f14 = new Pos03<U>.Foo<>(1, ""){};
+        Foo<?> f15 = new Pos03<U>.Foo<>(1, ""){};
+        Foo<? super Integer> f16 = new Pos03<U>.Foo<>(1, ""){};
     }
 
     void testQualified_2(Pos03<U> p) {
-        Foo<Integer> f1 = p.new Foo<>(1); //new Foo<Integer> created
-        Foo<? extends Integer> f2 = p.new Foo<>(1); //new Foo<Integer> created
-        Foo<?> f3 = p.new Foo<>(1); //new Foo<Object> created
-        Foo<? super Integer> f4 = p.new Foo<>(1); //new Foo<Object> created
+        Foo<Integer> f1 = p.new Foo<>(1);
+        Foo<? extends Integer> f2 = p.new Foo<>(1);
+        Foo<?> f3 = p.new Foo<>(1);
+        Foo<? super Integer> f4 = p.new Foo<>(1);
 
-        Foo<Integer> f5 = p.new Foo<>(1){}; //new Foo<Integer> created
-        Foo<? extends Integer> f6 = p.new Foo<>(1){}; //new Foo<Integer> created
-        Foo<?> f7 = p.new Foo<>(1){}; //new Foo<Object> created
-        Foo<? super Integer> f8 = p.new Foo<>(1){}; //new Foo<Object> created
+        Foo<Integer> f5 = p.new Foo<>(1){};
+        Foo<? extends Integer> f6 = p.new Foo<>(1){};
+        Foo<?> f7 = p.new Foo<>(1){};
+        Foo<? super Integer> f8 = p.new Foo<>(1){};
 
-        Foo<Integer> f9 = p.new Foo<>(1, ""); //new Foo<Integer> created
-        Foo<? extends Integer> f10 = p.new Foo<>(1, ""); //new Foo<Integer> created
-        Foo<?> f11 = p.new Foo<>(1, ""); //new Foo<Object> created
-        Foo<? super Integer> f12 = p.new Foo<>(1, ""); //new Foo<Object> created
+        Foo<Integer> f9 = p.new Foo<>(1, "");
+        Foo<? extends Integer> f10 = p.new Foo<>(1, "");
+        Foo<?> f11 = p.new Foo<>(1, "");
+        Foo<? super Integer> f12 = p.new Foo<>(1, "");
 
-        Foo<Integer> f13 = p.new Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<? extends Integer> f14 = p.new Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<?> f15 = p.new Foo<>(1, ""){}; //new Foo<Object> created
-        Foo<? super Integer> f16 = p.new Foo<>(1, ""){}; //new Foo<Object> created
+        Foo<Integer> f13 = p.new Foo<>(1, ""){};
+        Foo<? extends Integer> f14 = p.new Foo<>(1, ""){};
+        Foo<?> f15 = p.new Foo<>(1, ""){};
+        Foo<? super Integer> f16 = p.new Foo<>(1, ""){};
     }
 
     public static void main(String[] args) {
--- a/test/tools/javac/generics/diamond/pos/Pos04.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/generics/diamond/pos/Pos04.java	Thu Apr 29 14:36:20 2010 -0700
@@ -1,10 +1,33 @@
 /*
- * @test /nodynamiccopyright/
- * @bug 6840638
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
  *
- * @summary  Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond')
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6939620
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
  * @author mcimadamore
- * @compile Pos04.java -source 1.7
+ * @compile Pos04.java
  * @run main Pos04
  *
  */
@@ -16,25 +39,25 @@
             Foo(V x) {}
             <Z> Foo(V x, Z z) {}
         }
-        Foo<Integer> p1 = new Foo<>(1); //new Foo<Integer> created
-        Foo<? extends Integer> p2 = new Foo<>(1); //new Foo<Integer> created
-        Foo<?> p3 = new Foo<>(1); //new Foo<Object> created
-        Foo<? super Integer> p4 = new Foo<>(1); //new Foo<Object> created
+        Foo<Integer> p1 = new Foo<>(1);
+        Foo<? extends Integer> p2 = new Foo<>(1);
+        Foo<?> p3 = new Foo<>(1);
+        Foo<? super Integer> p4 = new Foo<>(1);
 
-        Foo<Integer> p5 = new Foo<>(1){}; //new Foo<Integer> created
-        Foo<? extends Integer> p6 = new Foo<>(1){}; //new Foo<Integer> created
-        Foo<?> p7 = new Foo<>(1){}; //new Foo<Object> created
-        Foo<? super Integer> p8 = new Foo<>(1){}; //new Foo<Object> created
+        Foo<Integer> p5 = new Foo<>(1){};
+        Foo<? extends Integer> p6 = new Foo<>(1){};
+        Foo<?> p7 = new Foo<>(1){};
+        Foo<? super Integer> p8 = new Foo<>(1){};
 
-        Foo<Integer> p9 = new Foo<>(1, ""); //new Foo<Integer> created
-        Foo<? extends Integer> p10 = new Foo<>(1, ""); //new Foo<Integer> created
-        Foo<?> p11 = new Foo<>(1, ""); //new Foo<Object> created
-        Foo<? super Integer> p12 = new Foo<>(1, ""); //new Foo<Object> created
+        Foo<Integer> p9 = new Foo<>(1, "");
+        Foo<? extends Integer> p10 = new Foo<>(1, "");
+        Foo<?> p11 = new Foo<>(1, "");
+        Foo<? super Integer> p12 = new Foo<>(1, "");
 
-        Foo<Integer> p13 = new Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<? extends Integer> p14 = new Foo<>(1, ""){}; //new Foo<Integer> created
-        Foo<?> p15 = new Foo<>(1, ""){}; //new Foo<Object> created
-        Foo<? super Integer> p16 = new Foo<>(1, ""){}; //new Foo<Object> created
+        Foo<Integer> p13 = new Foo<>(1, ""){};
+        Foo<? extends Integer> p14 = new Foo<>(1, ""){};
+        Foo<?> p15 = new Foo<>(1, ""){};
+        Foo<? super Integer> p16 = new Foo<>(1, ""){};
     }
 
     public static void main(String[] args) {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/pos/Pos05.java	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6939620
+ *
+ * @summary  Switch to 'complex' diamond inference scheme
+ * @author mcimadamore
+ * @compile Pos05.java
+ *
+ */
+
+public class Pos05 {
+
+    static class Foo<X> {
+        Foo(X x) {}
+    }
+
+    void m(Foo<Integer> fi) {}
+
+    void test() {
+        m(new Foo<>(1));
+    }
+}
--- a/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java	Thu Apr 29 14:36:20 2010 -0700
@@ -89,7 +89,7 @@
                 // Verify that the annotation information is as
                 // expected.
 
-                Set<String> expectedNames = new HashSet<>(Arrays.asList(annotatedElementInfo.names()));
+                Set<String> expectedNames = new HashSet<String>(Arrays.asList(annotatedElementInfo.names()));
 
                 resultsMeta =
                     roundEnvironment.
--- a/test/tools/javac/processing/model/element/TestAnonClassNames.java	Wed Apr 28 11:44:02 2010 -0700
+++ b/test/tools/javac/processing/model/element/TestAnonClassNames.java	Thu Apr 29 14:36:20 2010 -0700
@@ -113,10 +113,10 @@
      */
     static void testClassName(String className) {
         JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler();
-        List<String> classNames = new ArrayList<>();
+        List<String> classNames = new ArrayList<String>();
         classNames.add(className);
 
-        List<String> options = new ArrayList<>();
+        List<String> options = new ArrayList<String>();
         options.add("-proc:only");
         options.add("-classpath");
         options.add(System.getProperty("test.classes"));
@@ -128,7 +128,7 @@
                                  options,
                                  classNames,
                                  null); // Sources
-        List<Processor> processors = new ArrayList<>();
+        List<Processor> processors = new ArrayList<Processor>();
         processors.add(new ClassNameProber());
         compileTask.setProcessors(processors);
         Boolean goodResult = compileTask.call();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/varargs/6730476/T6730476a.java	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6730476
+ *
+ * @summary invalid "unchecked generic array" warning
+ * @author mcimadamore
+ * @compile T6730476a.java -Xlint -Werror
+ *
+ */
+
+class T6730476a {
+    <T> void f(int i, T ... x) {}
+    void g() {
+      f(1);
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/varargs/6730476/T6730476b.java	Thu Apr 29 14:36:20 2010 -0700
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2010 Sun Microsystems, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/*
+ * @test
+ * @bug 6730476
+ *
+ * @summary invalid "unchecked generic array" warning
+ * @author mcimadamore
+ * @compile T6730476b.java -Xlint -Werror
+ *
+ */
+
+class T6730476b {
+    java.util.List<Integer> ints = java.util.Arrays.asList();
+}