changeset 940:ca32f2986301

7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes Summary: Disallow diamond on anonymous innner class creation expression (as per JSR 334's EDR) Reviewed-by: jjg
author mcimadamore
date Mon, 07 Mar 2011 14:31:50 +0000
parents 74f0c05c51eb
children b1b898c00b71
files 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/resources/compiler.properties test/tools/javac/diags/examples.not-yet.txt test/tools/javac/diags/examples/DiamondAndAnonClass.java test/tools/javac/diags/examples/DiamondInvalidArg.java test/tools/javac/diags/examples/DiamondInvalidArgs.java test/tools/javac/generics/diamond/6996914/T6996914a.java test/tools/javac/generics/diamond/6996914/T6996914b.java test/tools/javac/generics/diamond/T6939780.java test/tools/javac/generics/diamond/T6939780.out 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/neg/Neg06.java test/tools/javac/generics/diamond/neg/Neg06.out test/tools/javac/generics/diamond/neg/Neg07.java test/tools/javac/generics/diamond/neg/Neg07.out test/tools/javac/generics/diamond/neg/Neg08.java test/tools/javac/generics/diamond/neg/Neg08.out test/tools/javac/generics/diamond/neg/Neg09.java test/tools/javac/generics/diamond/neg/Neg09.out test/tools/javac/generics/diamond/neg/Neg10.java test/tools/javac/generics/diamond/neg/Neg11.java test/tools/javac/generics/diamond/neg/Neg12.java test/tools/javac/generics/diamond/neg/Neg12.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 test/tools/javac/generics/diamond/pos/Pos05.java test/tools/javac/generics/diamond/pos/Pos06.java test/tools/javac/generics/diamond/pos/Pos07.java test/tools/javac/multicatch/Neg05.java test/tools/javac/multicatch/Neg05.out test/tools/javac/multicatch/Pos09.java
diffstat 43 files changed, 474 insertions(+), 774 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1581,15 +1581,7 @@
         // symbol + type back into the attributed tree.
         Type clazztype = attribType(clazz, env);
         Pair<Scope,Scope> mapping = getSyntheticScopeMapping(clazztype, cdef != null);
-        if (!TreeInfo.isDiamond(tree)) {
-            clazztype = chk.checkClassType(
-                tree.clazz.pos(), clazztype, true);
-        } else if (!clazztype.isErroneous() &&
-                !clazztype.tsym.type.isParameterized()) {
-            log.error(tree.clazz.pos(),
-                    "cant.apply.diamond.1",
-                    clazztype, diags.fragment("diamond.non.generic", clazztype));
-        }
+        clazztype = chk.checkDiamond(tree, clazztype);
         chk.validate(clazz, localEnv);
         if (tree.encl != null) {
             // We have to work in this case to store
@@ -1614,10 +1606,12 @@
         List<Type> argtypes = attribArgs(tree.args, localEnv);
         List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv);
 
-        if (TreeInfo.isDiamond(tree) && clazztype.tsym.type.isParameterized()) {
+        if (TreeInfo.isDiamond(tree) && !clazztype.isErroneous()) {
             clazztype = attribDiamond(localEnv, tree, clazztype, mapping, argtypes, typeargtypes);
             clazz.type = clazztype;
         } else if (allowDiamondFinder &&
+                tree.def == null &&
+                !clazztype.isErroneous() &&
                 clazztype.getTypeArguments().nonEmpty() &&
                 findDiamonds) {
             boolean prevDeferDiags = log.deferDiagnostics;
@@ -1641,8 +1635,7 @@
             if (inferred != null &&
                     !inferred.isErroneous() &&
                     inferred.tag == CLASS &&
-                    types.isAssignable(inferred, pt.tag == NONE ? clazztype : pt, Warner.noWarnings) &&
-                    chk.checkDiamond((ClassType)inferred).isEmpty()) {
+                    types.isAssignable(inferred, pt.tag == NONE ? clazztype : pt, Warner.noWarnings)) {
                 String key = types.isSameType(clazztype, inferred) ?
                     "diamond.redundant.args" :
                     "diamond.redundant.args.1";
@@ -1857,34 +1850,9 @@
                         ex.diagnostic);
             }
         }
-        clazztype = chk.checkClassType(tree.clazz.pos(),
+        return 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.
--- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Mar 07 14:31:50 2011 +0000
@@ -664,40 +664,25 @@
             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
+    /** Check that usage of diamond operator is correct (i.e. diamond should not
+     * be used with non-generic classes or in anonymous class creation expressions)
      */
-    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;
+    Type checkDiamond(JCNewClass tree, Type t) {
+        if (!TreeInfo.isDiamond(tree) ||
+                t.isErroneous()) {
+            return checkClassType(tree.clazz.pos(), t, true);
+        } else if (tree.def != null) {
+            log.error(tree.clazz.pos(),
+                    "cant.apply.diamond.1",
+                    t, diags.fragment("diamond.and.anon.class", t));
+            return types.createErrorType(t);
+        } else if (!t.tsym.type.isParameterized()) {
+            log.error(tree.clazz.pos(),
+                "cant.apply.diamond.1",
+                t, diags.fragment("diamond.non.generic", t));
+            return types.createErrorType(t);
+        } else {
+            return t;
         }
     }
 
--- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Mar 07 14:11:48 2011 +0000
+++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Mar 07 14:31:50 2011 +0000
@@ -1588,14 +1588,6 @@
 compiler.misc.diamond.non.generic=\
     cannot use ''<>'' with non-generic class {0}
 
-# 0: list of type, 1: message segment
-compiler.misc.diamond.invalid.arg=\
-    type argument {0} inferred for {1} is not allowed in this context
-
-# 0: list of type, 1: message segment
-compiler.misc.diamond.invalid.args=\
-    type arguments {0} inferred for {1} are not allowed in this context
-
 # 0: type, 1: list of type
 compiler.misc.explicit.param.do.not.conform.to.bounds=\
     explicit type argument {0} does not conform to declared bound(s) {1}
@@ -1803,8 +1795,8 @@
 compiler.misc.varargs.clash.with=\
     {0} in {1} overrides {2} in {3}
 
-compiler.misc.non.denotable.type=\
-    Non-denotable type {0} not allowed here
+compiler.misc.diamond.and.anon.class=\
+    cannot use ''<>'' with anonymous inner classes
 
 # 0: symbol kind, 1: symbol, 2: symbol, 3: message segment
 compiler.misc.inapplicable.method=\
--- a/test/tools/javac/diags/examples.not-yet.txt	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/diags/examples.not-yet.txt	Mon Mar 07 14:31:50 2011 +0000
@@ -70,7 +70,6 @@
 compiler.misc.kindname.type.variable
 compiler.misc.kindname.type.variable.bound
 compiler.misc.kindname.value
-compiler.misc.non.denotable.type
 compiler.misc.no.unique.minimal.instance.exists
 compiler.misc.resume.abort                              # prompt for a response
 compiler.misc.source.unavailable                        # DiagnosticSource
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/diags/examples/DiamondAndAnonClass.java	Mon Mar 07 14:31:50 2011 +0000
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// key: compiler.misc.diamond.and.anon.class
+// key: compiler.err.cant.apply.diamond.1
+
+import java.util.*;
+
+class DiamondAndAnonClass {
+    void m() {
+        List<String> list = new ArrayList<>() {};
+    }
+}
--- a/test/tools/javac/diags/examples/DiamondInvalidArg.java	Mon Mar 07 14:11:48 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.misc.diamond.invalid.arg
-// key: compiler.misc.diamond
-// key: compiler.err.cant.apply.diamond.1
-
-class DiamondInvalidArg {
-    static class Foo<X extends Number & Comparable<Number>> { }
-    Foo<?> foo = new Foo<>();
-}
--- a/test/tools/javac/diags/examples/DiamondInvalidArgs.java	Mon Mar 07 14:11:48 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-/*
- * Copyright (c) 2010, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-// key: compiler.misc.diamond.invalid.args
-// key: compiler.misc.diamond
-// key: compiler.err.cant.apply.diamond.1
-
-class DiamondInvalidArgs {
-    static class Foo<X extends Number & Comparable<Number>,
-                           Y extends Number & Comparable<Number>> { }
-    Foo<?,?> foo = new Foo<>();
-}
--- a/test/tools/javac/generics/diamond/6996914/T6996914a.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/6996914/T6996914a.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6996914
+ * @bug 6996914 7020044
  * @summary  Diamond inference: problem when accessing protected constructor
  * @run main T6996914a
  */
@@ -53,17 +53,6 @@
         }
     }
 
-    enum DiamondKind {
-        STANDARD("new Foo<>();"),
-        ANON("new Foo<>() {};");
-
-        String expr;
-
-        DiamondKind(String expr) {
-            this.expr = expr;
-        }
-    }
-
     enum ConstructorKind {
         PACKAGE(""),
         PROTECTED("protected"),
@@ -104,14 +93,14 @@
         final static String sourceStub =
                         "#I\n" +
                         "class Test {\n" +
-                        "  Foo<String> fs = #D\n" +
+                        "  Foo<String> fs = new Foo<>();\n" +
                         "}\n";
 
         String source;
 
-        public ClientClass(PackageKind pk, DiamondKind dk) {
+        public ClientClass(PackageKind pk) {
             super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
-            source = sourceStub.replace("#I", pk.importDecl).replace("#D", dk.expr);
+            source = sourceStub.replace("#I", pk.importDecl);
         }
 
         @Override
@@ -123,22 +112,20 @@
     public static void main(String... args) throws Exception {
         for (PackageKind pk : PackageKind.values()) {
             for (ConstructorKind ck : ConstructorKind.values()) {
-                for (DiamondKind dk : DiamondKind.values()) {
-                    compileAndCheck(pk, ck, dk);
-                }
+                    compileAndCheck(pk, ck);
             }
         }
     }
 
-    static void compileAndCheck(PackageKind pk, ConstructorKind ck, DiamondKind dk) throws Exception {
+    static void compileAndCheck(PackageKind pk, ConstructorKind ck) throws Exception {
         FooClass foo = new FooClass(pk, ck);
-        ClientClass client = new ClientClass(pk, dk);
+        ClientClass client = new ClientClass(pk);
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         ErrorListener el = new ErrorListener();
         JavacTask ct = (JavacTask)tool.getTask(null, null, el,
                 null, null, Arrays.asList(foo, client));
         ct.analyze();
-        if (el.errors > 0 == check(pk, ck, dk)) {
+        if (el.errors > 0 == check(pk, ck)) {
             String msg = el.errors > 0 ?
                 "Error compiling files" :
                 "No error when compiling files";
@@ -146,10 +133,9 @@
         }
     }
 
-    static boolean check(PackageKind pk, ConstructorKind ck, DiamondKind dk) {
+    static boolean check(PackageKind pk, ConstructorKind ck) {
         switch (pk) {
-            case A: return ck == ConstructorKind.PUBLIC ||
-                    (ck  == ConstructorKind.PROTECTED && dk == DiamondKind.ANON);
+            case A: return ck == ConstructorKind.PUBLIC;
             case DEFAULT: return ck != ConstructorKind.PRIVATE;
             default: throw new AssertionError("Unknown package kind");
         }
--- a/test/tools/javac/generics/diamond/6996914/T6996914b.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/6996914/T6996914b.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 6996914
+ * @bug 6996914 7020044
  * @summary  Diamond inference: problem when accessing protected constructor
  * @compile T6996914b.java
  */
@@ -35,5 +35,4 @@
 
 class Test {
     Super<String,Integer> ssi1 = new Super<>(1, "", 2);
-    Super<String,Integer> ssi2 = new Super<>(1, "", 2) {};
 }
--- a/test/tools/javac/generics/diamond/T6939780.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/T6939780.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,6 +1,6 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939780
+ * @bug 6939780 7020044
  *
  * @summary  add a warning to detect diamond sites
  * @author mcimadamore
--- a/test/tools/javac/generics/diamond/T6939780.out	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/T6939780.out	Mon Mar 07 14:31:50 2011 +0000
@@ -1,5 +1,3 @@
 T6939780.java:19:28: compiler.warn.diamond.redundant.args: Foo<java.lang.Number>, Foo<java.lang.Number>
 T6939780.java:20:28: compiler.warn.diamond.redundant.args.1: Foo<java.lang.Integer>, Foo<java.lang.Number>
-T6939780.java:22:28: compiler.warn.diamond.redundant.args: Foo<java.lang.Number>, Foo<java.lang.Number>
-T6939780.java:23:28: compiler.warn.diamond.redundant.args.1: Foo<java.lang.Integer>, Foo<java.lang.Number>
-4 warnings
+2 warnings
--- a/test/tools/javac/generics/diamond/neg/Neg01.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg01.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,8 +1,9 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  Check that diamond fails when inference violates declared bounds
+ *           (basic test with nested class, generic/non-generic constructors)
  * @author mcimadamore
  * @compile/fail/ref=Neg01.out Neg01.java -XDrawDiagnostics
  *
@@ -20,19 +21,9 @@
         Neg01<?> n3 = new Neg01<>("");
         Neg01<? super String> n4 = new Neg01<>("");
 
-        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<>("", "");
-        Neg01<? extends String> n10 = new Neg01<>("", "");
-        Neg01<?> n11 = new Neg01<>("", "");
-        Foo<? super String> n12 = new Neg01<>("", "");
-
-        Neg01<String> n13 = new Neg01<>("", ""){};
-        Neg01<? extends String> n14 = new Neg01<>("", ""){};
-        Neg01<?> n15 = new Neg01<>("", ""){};
-        Neg01<? super String> n16 = new Neg01<>("", ""){};
+        Neg01<String> n5 = new Neg01<>("", "");
+        Neg01<? extends String> n6 = new Neg01<>("", "");
+        Neg01<?> n7 = new Neg01<>("", "");
+        Foo<? super String> n8 = new Neg01<>("", "");
     }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg01.out	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg01.out	Mon Mar 07 14:31:50 2011 +0000
@@ -1,29 +1,15 @@
-Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, , , (compiler.misc.location: kindname.class, Neg01<X>, null)
-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, X
-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, X
-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, X
-Neg01.java:36:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
-28 errors
+Neg01.java:19:15: compiler.err.not.within.bounds: java.lang.String, X
+Neg01.java:19:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:20:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
+Neg01.java:20:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:21:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:22:15: compiler.err.not.within.bounds: ? super java.lang.String, X
+Neg01.java:22:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:24:15: compiler.err.not.within.bounds: java.lang.String, X
+Neg01.java:24:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:25:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
+Neg01.java:25:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:26:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+Neg01.java:27:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , (compiler.misc.location: kindname.class, Neg01<X>, null)
+Neg01.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
+14 errors
--- a/test/tools/javac/generics/diamond/neg/Neg02.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg02.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,8 +1,9 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  Check that diamond fails when inference violates declared bounds
+ *           (test with nested class, qualified/simple type expressions)
  * @author mcimadamore
  * @compile/fail/ref=Neg02.out Neg02.java -XDrawDiagnostics
  *
@@ -21,20 +22,10 @@
         Foo<?> f3 = new Foo<>("");
         Foo<? super String> f4 = new Foo<>("");
 
-        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<>("", "");
-        Foo<? extends String> f10 = new Foo<>("", "");
-        Foo<?> f11 = new Foo<>("", "");
-        Foo<? super String> f12 = new Foo<>("", "");
-
-        Foo<String> f13 = new Foo<>("", ""){};
-        Foo<? extends String> f14 = new Foo<>("", ""){};
-        Foo<?> f15 = new Foo<>("", ""){};
-        Foo<? super String> f16 = new Foo<>("", ""){};
+        Foo<String> f5 = new Foo<>("", "");
+        Foo<? extends String> f6 = new Foo<>("", "");
+        Foo<?> f7 = new Foo<>("", "");
+        Foo<? super String> f8 = new Foo<>("", "");
     }
 
     void testQualified() {
@@ -43,19 +34,9 @@
         Foo<?> f3 = new Neg02.Foo<>("");
         Foo<? super String> f4 = new Neg02.Foo<>("");
 
-        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<>("", "");
-        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<>("", ""){};
-        Foo<? extends String> f14 = new Neg02.Foo<>("", ""){};
-        Foo<?> f15 = new Neg02.Foo<>("", ""){};
-        Foo<? super String> f16 = new Neg02.Foo<>("", ""){};
+        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<>("", "");
     }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg02.out	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg02.out	Mon Mar 07 14:31:50 2011 +0000
@@ -1,57 +1,29 @@
-Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-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, X
-Neg02.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
-56 errors
+Neg02.java:20:13: compiler.err.not.within.bounds: java.lang.String, X
+Neg02.java:20:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:21:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
+Neg02.java:21:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:22:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:23:13: compiler.err.not.within.bounds: ? super java.lang.String, X
+Neg02.java:23:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:25:13: compiler.err.not.within.bounds: java.lang.String, X
+Neg02.java:25:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:26:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
+Neg02.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:27:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:28:13: compiler.err.not.within.bounds: ? super java.lang.String, X
+Neg02.java:28:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:32:13: compiler.err.not.within.bounds: java.lang.String, X
+Neg02.java:32:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:33:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
+Neg02.java:33:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:34:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:35:13: compiler.err.not.within.bounds: ? super java.lang.String, X
+Neg02.java:35:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:37:13: compiler.err.not.within.bounds: java.lang.String, X
+Neg02.java:37:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:38:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
+Neg02.java:38:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:39:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+Neg02.java:40:13: compiler.err.not.within.bounds: ? super java.lang.String, X
+Neg02.java:40:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
+28 errors
--- a/test/tools/javac/generics/diamond/neg/Neg03.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg03.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,8 +1,9 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  Check that diamond fails when inference violates declared bounds
+ *           (test with inner class, qualified/simple type expressions)
  * @author mcimadamore
  * @compile/fail/ref=Neg03.out Neg03.java -XDrawDiagnostics
  *
@@ -21,20 +22,10 @@
         Foo<?> f3 = new Foo<>("");
         Foo<? super String> f4 = new Foo<>("");
 
-        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<>("", "");
-        Foo<? extends String> f10 = new Foo<>("", "");
-        Foo<?> f11 = new Foo<>("", "");
-        Foo<? super String> f12 = new Foo<>("", "");
-
-        Foo<String> f13 = new Foo<>("", ""){};
-        Foo<? extends String> f14 = new Foo<>("", ""){};
-        Foo<?> f15 = new Foo<>("", ""){};
-        Foo<? super String> f16 = new Foo<>("", ""){};
+        Foo<String> f5 = new Foo<>("", "");
+        Foo<? extends String> f6 = new Foo<>("", "");
+        Foo<?> f7 = new Foo<>("", "");
+        Foo<? super String> f8 = new Foo<>("", "");
     }
 
     void testQualified_1() {
@@ -43,20 +34,10 @@
         Foo<?> f3 = new Neg03<U>.Foo<>("");
         Foo<? super String> f4 = new Neg03<U>.Foo<>("");
 
-        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<>("", "");
-        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<>("", ""){};
-        Foo<? extends String> f14 = new Neg03<U>.Foo<>("", ""){};
-        Foo<?> f15 = new Neg03<U>.Foo<>("", ""){};
-        Foo<? super String> f16 = new Neg03<U>.Foo<>("", ""){};
+        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<>("", "");
     }
 
     void testQualified_2(Neg03<U> n) {
@@ -65,19 +46,9 @@
         Foo<?> f3 = n.new Foo<>("");
         Foo<? super String> f4 = n.new Foo<>("");
 
-        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<>("", "");
-        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<>("", ""){};
-        Foo<? extends String> f14 = n.new Foo<>("", ""){};
-        Foo<?> f15 = n.new Foo<>("", ""){};
-        Foo<? super String> f16 = n.new Foo<>("", ""){};
+        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<>("", "");
     }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg03.out	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg03.out	Mon Mar 07 14:31:50 2011 +0000
@@ -1,85 +1,43 @@
-Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
+Neg03.java:20:13: compiler.err.not.within.bounds: java.lang.String, V
+Neg03.java:20:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:21:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
+Neg03.java:21:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:22:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:23:13: compiler.err.not.within.bounds: ? super java.lang.String, V
+Neg03.java:23:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:25:13: compiler.err.not.within.bounds: java.lang.String, V
+Neg03.java:25:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:26:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
+Neg03.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:27:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:28:13: compiler.err.not.within.bounds: ? super java.lang.String, V
+Neg03.java:28:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:32:13: compiler.err.not.within.bounds: java.lang.String, V
+Neg03.java:32:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:33:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
+Neg03.java:33:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:34:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:35:13: compiler.err.not.within.bounds: ? super java.lang.String, V
+Neg03.java:35:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:37:13: compiler.err.not.within.bounds: java.lang.String, V
+Neg03.java:37:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:38:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
+Neg03.java:38:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:39:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:40:13: compiler.err.not.within.bounds: ? super java.lang.String, V
+Neg03.java:40:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:44:13: compiler.err.not.within.bounds: java.lang.String, V
+Neg03.java:44:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:45:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
+Neg03.java:45:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:46:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:47:13: compiler.err.not.within.bounds: ? super java.lang.String, V
 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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-Neg03.java:81:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
-84 errors
+Neg03.java:49:13: compiler.err.not.within.bounds: java.lang.String, V
+Neg03.java:49:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:50:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
+Neg03.java:50:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:51:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+Neg03.java:52:13: compiler.err.not.within.bounds: ? super java.lang.String, V
+Neg03.java:52:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
+42 errors
--- a/test/tools/javac/generics/diamond/neg/Neg04.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg04.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,8 +1,9 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  Check that diamond fails when inference violates declared bounds
+ *           (test with local class, qualified/simple type expressions)
  * @author mcimadamore
  * @compile/fail/ref=Neg04.out Neg04.java -XDrawDiagnostics
  *
@@ -20,19 +21,9 @@
         Foo<?> n3 = new Foo<>("");
         Foo<? super String> n4 = new Foo<>("");
 
-        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<>("", "");
-        Foo<? extends String> n10 = new Foo<>("", "");
-        Foo<?> n11 = new Foo<>("", "");
-        Foo<? super String> n12 = new Foo<>("", "");
-
-        Foo<String> n13 = new Foo<>("", ""){};
-        Foo<? extends String> n14 = new Foo<>("", ""){};
-        Foo<?> n15 = new Foo<>("", ""){};
-        Foo<? super String> n16 = new Foo<>("", ""){};
+        Foo<String> n5 = new Foo<>("", "");
+        Foo<? extends String> n6 = new Foo<>("", "");
+        Foo<?> n7 = new Foo<>("", "");
+        Foo<? super String> n8 = new Foo<>("", "");
     }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg04.out	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg04.out	Mon Mar 07 14:31:50 2011 +0000
@@ -1,29 +1,15 @@
-Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-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, V
-Neg04.java:36:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
-28 errors
+Neg04.java:19:13: compiler.err.not.within.bounds: java.lang.String, V
+Neg04.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
+Neg04.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String, V
+Neg04.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:24:13: compiler.err.not.within.bounds: java.lang.String, V
+Neg04.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
+Neg04.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+Neg04.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, V
+Neg04.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
+14 errors
--- a/test/tools/javac/generics/diamond/neg/Neg05.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg05.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,8 +1,8 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  Check that usage of rare types doesn't cause spurious diamond diagnostics
  * @author mcimadamore
  * @compile/fail/ref=Neg05.out Neg05.java -XDrawDiagnostics
  *
@@ -21,20 +21,10 @@
         Neg05<?>.Foo<?> f3 = new Neg05.Foo<>("");
         Neg05<?>.Foo<? super String> f4 = new Neg05.Foo<>("");
 
-        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<>("", "");
-        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<>("", ""){};
-        Neg05<?>.Foo<? extends String> f14 = new Neg05.Foo<>("", ""){};
-        Neg05<?>.Foo<?> f15 = new Neg05.Foo<>("", ""){};
-        Neg05<?>.Foo<? super String> f16 = new Neg05.Foo<>("", ""){};
+        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<>("", "");
     }
 
     void testRare_2(Neg05 n) {
@@ -43,19 +33,9 @@
         Neg05<?>.Foo<?> f3 = n.new Foo<>("");
         Neg05<?>.Foo<? super String> f4 = n.new Foo<>("");
 
-        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<>("", "");
-        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<>("", ""){};
-        Neg05<?>.Foo<? extends String> f14 = n.new Foo<>("", ""){};
-        Neg05<?>.Foo<?> f15 = n.new Foo<>("", ""){};
-        Neg05<?>.Foo<? super String> f16 = n.new Foo<>("", ""){};
+        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<>("", "");
     }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg05.out	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg05.out	Mon Mar 07 14:31:50 2011 +0000
@@ -7,43 +7,19 @@
 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:24:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), 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:25:45: compiler.err.prob.found.req: (compiler.misc.incompatible.types), 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:26:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), 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
-Neg05.java:44:45: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:46:37: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:47:47: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:48:32: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:49:45: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:51:37: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:52:48: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:53:33: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:54:46: compiler.err.improperly.formed.type.inner.raw.param
-Neg05.java:56:38: compiler.err.improperly.formed.type.inner.raw.param
-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
-48 errors
+Neg05.java:27:43: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
+Neg05.java:31:37: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:32:47: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:33:32: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:34:45: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:36:37: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:37:47: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:38:32: compiler.err.improperly.formed.type.inner.raw.param
+Neg05.java:39:45: compiler.err.improperly.formed.type.inner.raw.param
+24 errors
--- a/test/tools/javac/generics/diamond/neg/Neg06.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg06.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,21 +1,17 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  Check that diamond works where LHS is supertype of RHS (nilary constructor)
  * @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<>() {};
 }
--- a/test/tools/javac/generics/diamond/neg/Neg06.out	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg06.out	Mon Mar 07 14:31:50 2011 +0000
@@ -1,4 +1,2 @@
-Neg06.java:18:36: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.IFoo), (compiler.misc.infer.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.infer.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.infer.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>)
-3 errors
+Neg06.java:16:37: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg06.CFoo), (compiler.misc.infer.no.conforming.instance.exists: X, Neg06.CFoo<X>, Neg06.CSuperFoo<java.lang.String>)
+1 error
--- a/test/tools/javac/generics/diamond/neg/Neg07.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg07.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,8 +1,8 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  Check that diamond works where LHS is supertype of RHS (1-ary constructor)
  * @author mcimadamore
  * @compile/fail/ref=Neg07.out Neg07.java -XDrawDiagnostics
  *
@@ -15,5 +15,4 @@
    }
 
    SuperFoo<String> sf1 = new Foo<>("");
-   SuperFoo<String> sf2 = new Foo<>("") {};
 }
--- a/test/tools/javac/generics/diamond/neg/Neg07.out	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg07.out	Mon Mar 07 14:31:50 2011 +0000
@@ -1,3 +1,2 @@
 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
+1 error
--- a/test/tools/javac/generics/diamond/neg/Neg08.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg08.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,30 +1,15 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620 6894753
+ * @bug 7020043 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
- * @author mcimadamore
+ * @summary  Check that diamond is not allowed with non-generic class types
+ * @author R&eacute;mi Forax
  * @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);
+   public static void main(String[] args) {
+     String s = new String<>("foo");
+   }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg08.out	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg08.out	Mon Mar 07 14:31:50 2011 +0000
@@ -1,4 +1,2 @@
-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
+Neg08.java:13:27: compiler.err.cant.apply.diamond.1: java.lang.String, (compiler.misc.diamond.non.generic: java.lang.String)
+1 error
--- a/test/tools/javac/generics/diamond/neg/Neg09.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg09.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,22 +1,25 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620 6894753
+ * @bug 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
- * @author mcimadamore
+ * @summary  Check that diamond is not allowed with anonymous inner class expressions
+ * @author Maurizio Cimadamore
  * @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> {}
+    class Member<X> {}
 
-    Foo<?> fw = new Foo<>();
-    DoubleFoo<?,?> dw = new DoubleFoo<>();
-    TripleFoo<?,?,?> tw = new TripleFoo<>();
+    static class Nested<X> {}
+
+    void testSimple() {
+        Member<?> m1 = new Member<>() {};
+        Nested<?> m2 = new Nested<>() {};
+    }
+
+    void testQualified() {
+        Member<?> m1 = this.new Member<>() {};
+        Nested<?> m2 = new Neg09.Nested<>() {};
+    }
 }
--- a/test/tools/javac/generics/diamond/neg/Neg09.out	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg09.out	Mon Mar 07 14:31:50 2011 +0000
@@ -1,4 +1,5 @@
-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
+Neg09.java:17:34: compiler.err.cant.apply.diamond.1: Neg09.Member, (compiler.misc.diamond.and.anon.class: Neg09.Member)
+Neg09.java:18:34: compiler.err.cant.apply.diamond.1: Neg09.Nested, (compiler.misc.diamond.and.anon.class: Neg09.Nested)
+Neg09.java:22:39: compiler.err.cant.apply.diamond.1: Neg09.Member, (compiler.misc.diamond.and.anon.class: Neg09.Member)
+Neg09.java:23:40: compiler.err.cant.apply.diamond.1: Neg09.Nested, (compiler.misc.diamond.and.anon.class: Neg09.Nested)
+4 errors
--- a/test/tools/javac/generics/diamond/neg/Neg10.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg10.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,8 +1,8 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  Check that 'complex' diamond can infer type that is too specific
  * @author mcimadamore
  * @compile/fail/ref=Neg10.out Neg10.java -XDrawDiagnostics
  *
--- a/test/tools/javac/generics/diamond/neg/Neg11.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/neg/Neg11.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,8 +1,8 @@
 /*
  * @test /nodynamiccopyright/
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  Check that unresolved symbols doesn't cause spurious diamond diagnostics
  * @author mcimadamore
  * @compile/fail/ref=Neg11.out Neg11.java -XDrawDiagnostics
  *
--- a/test/tools/javac/generics/diamond/neg/Neg12.java	Mon Mar 07 14:11:48 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 7020043
- *
- * @summary  Project Coin: diamond allowed on non-generic type
- * @author R&eacute;mi Forax
- * @compile/fail/ref=Neg12.out Neg12.java -XDrawDiagnostics
- *
- */
-
-class DiamondRaw {
-   public static void main(String[] args) {
-     String s = new String<>("foo");
-   }
-}
--- a/test/tools/javac/generics/diamond/neg/Neg12.out	Mon Mar 07 14:11:48 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Neg12.java:13:27: compiler.err.cant.apply.diamond.1: java.lang.String, (compiler.misc.diamond.non.generic: java.lang.String)
-1 error
--- a/test/tools/javac/generics/diamond/pos/Pos01.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/pos/Pos01.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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
@@ -23,9 +23,9 @@
 
 /*
  * @test
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  basic test for diamond (generic/non-generic constructors)
  * @author mcimadamore
  * @compile Pos01.java
  * @run main Pos01
@@ -44,20 +44,10 @@
         Pos01<?> p3 = new Pos01<>(1);
         Pos01<? super Integer> p4 = new Pos01<>(1);
 
-        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, "");
-        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, ""){};
-        Pos01<? extends Integer> p14= new Pos01<>(1, ""){};
-        Pos01<?> p15 = new Pos01<>(1, ""){};
-        Pos01<? super Integer> p16 = new Pos01<>(1, ""){};
+        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, "");
     }
 
     public static void main(String[] args) {
--- a/test/tools/javac/generics/diamond/pos/Pos02.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/pos/Pos02.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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
@@ -23,9 +23,9 @@
 
 /*
  * @test
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  basic test for diamond (simple/qualified type-expressions)
  * @author mcimadamore
  * @compile Pos02.java
  * @run main Pos02
@@ -44,20 +44,10 @@
         Foo<?> f3 = new Foo<>(1);
         Foo<? super Integer> f4 = new Foo<>(1);
 
-        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, "");
-        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, ""){};
-        Foo<? extends Integer> f14 = new Foo<>(1, ""){};
-        Foo<?> f15 = new Foo<>(1, ""){};
-        Foo<? super Integer> f16 = new Foo<>(1, ""){};
+        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, "");
     }
 
     void testQualified() {
@@ -66,20 +56,10 @@
         Foo<?> f3 = new Pos02.Foo<>(1);
         Foo<? super Integer> f4 = new Pos02.Foo<>(1);
 
-        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, "");
-        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, ""){};
-        Foo<? extends Integer> f14 = new Pos02.Foo<>(1, ""){};
-        Foo<?> f15 = new Pos02.Foo<>(1, ""){};
-        Foo<? super Integer> f16 = new Pos02.Foo<>(1, ""){};
+        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, "");
     }
 
     public static void main(String[] args) {
--- a/test/tools/javac/generics/diamond/pos/Pos03.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/pos/Pos03.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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
@@ -23,9 +23,9 @@
 
 /*
  * @test
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  basic test for diamond (simple/qualified type-expressions, member inner)
  * @author mcimadamore
  * @compile Pos03.java
  * @run main Pos03
@@ -45,20 +45,10 @@
         Foo<?> f3 = new Foo<>(1);
         Foo<? super Integer> f4 = new Foo<>(1);
 
-        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, "");
-        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, ""){};
-        Foo<? extends Integer> f14 = new Foo<>(1, ""){};
-        Foo<?> f15 = new Foo<>(1, ""){};
-        Foo<? super Integer> f16 = new Foo<>(1, ""){};
+        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, "");
     }
 
     void testQualified_1() {
@@ -67,20 +57,10 @@
         Foo<?> f3 = new Pos03<U>.Foo<>(1);
         Foo<? super Integer> f4 = new Pos03<U>.Foo<>(1);
 
-        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, "");
-        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, ""){};
-        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, ""){};
+        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, "");
     }
 
     void testQualified_2(Pos03<U> p) {
@@ -89,20 +69,10 @@
         Foo<?> f3 = p.new Foo<>(1);
         Foo<? super Integer> f4 = p.new Foo<>(1);
 
-        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, "");
-        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, ""){};
-        Foo<? extends Integer> f14 = p.new Foo<>(1, ""){};
-        Foo<?> f15 = p.new Foo<>(1, ""){};
-        Foo<? super Integer> f16 = p.new Foo<>(1, ""){};
+        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, "");
     }
 
     public static void main(String[] args) {
--- a/test/tools/javac/generics/diamond/pos/Pos04.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/pos/Pos04.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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
@@ -23,9 +23,9 @@
 
 /*
  * @test
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  basic test for diamond (simple/qualified type-expressions, local class)
  * @author mcimadamore
  * @compile Pos04.java
  * @run main Pos04
@@ -44,20 +44,10 @@
         Foo<?> p3 = new Foo<>(1);
         Foo<? super Integer> p4 = new Foo<>(1);
 
-        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, "");
-        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, ""){};
-        Foo<? extends Integer> p14 = new Foo<>(1, ""){};
-        Foo<?> p15 = new Foo<>(1, ""){};
-        Foo<? super Integer> p16 = new Foo<>(1, ""){};
+        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, "");
     }
 
     public static void main(String[] args) {
--- a/test/tools/javac/generics/diamond/pos/Pos05.java	Mon Mar 07 14:11:48 2011 +0000
+++ b/test/tools/javac/generics/diamond/pos/Pos05.java	Mon Mar 07 14:31:50 2011 +0000
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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
@@ -23,9 +23,9 @@
 
 /*
  * @test
- * @bug 6939620
+ * @bug 6939620 7020044
  *
- * @summary  Switch to 'complex' diamond inference scheme
+ * @summary  Check that 'complex' inference sometimes works in method context
  * @author mcimadamore
  * @compile Pos05.java
  *
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/generics/diamond/pos/Pos06.java	Mon Mar 07 14:31:50 2011 +0000
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6939620 6894753 7020044
+ *
+ * @summary  Diamond and subtyping
+ * @author mcimadamore
+ * @compile Pos06.java
+ *
+ */
+
+class Pos06 {
+    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/pos/Pos07.java	Mon Mar 07 14:31:50 2011 +0000
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6939620 6894753 7020044
+ *
+ * @summary  Diamond and intersection types
+ * @author mcimadamore
+ * @compile Pos07.java
+ *
+ */
+
+class Pos07 {
+    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<>();
+}
--- a/test/tools/javac/multicatch/Neg05.java	Mon Mar 07 14:11:48 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * @test /nodynamiccopyright/
- * @bug 6943289
- *
- * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
- * @author mcimadamore
- * @compile/fail/ref=Neg05.out -XDrawDiagnostics Neg05.java
- *
- */
-
-class Neg02 {
-
-    static class Foo<X> {
-       Foo(X x) {}
-    }
-
-    static interface Base<X> {}
-    static class A extends Exception implements Base<String> {}
-    static class B extends Exception implements Base<Integer> {}
-
-    void m() {
-        try {
-            if (true) {
-                throw new A();
-            }
-            else {
-                throw new B();
-            }
-        } catch (A | B ex) {
-            Foo<?> f = new Foo<>(ex);
-        }
-    }
-}
--- a/test/tools/javac/multicatch/Neg05.out	Mon Mar 07 14:11:48 2011 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-Neg05.java:30:31: compiler.err.cant.apply.diamond.1: (compiler.misc.diamond: Neg02.Foo), (compiler.misc.diamond.invalid.arg: java.lang.Exception&Neg02.Base<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, (compiler.misc.diamond: Neg02.Foo))
-1 error
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test/tools/javac/multicatch/Pos09.java	Mon Mar 07 14:31:50 2011 +0000
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2010, 2011, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 6943289 7020044
+ *
+ * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
+ * @author mcimadamore
+ * @compile Pos09.java
+ *
+ */
+
+class Pos09 {
+
+    static class Foo<X> {
+       Foo(X x) {}
+    }
+
+    static interface Base<X> {}
+    static class A extends Exception implements Base<String> {}
+    static class B extends Exception implements Base<Integer> {}
+
+    void m() {
+        try {
+            if (true) {
+                throw new A();
+            }
+            else {
+                throw new B();
+            }
+        } catch (A | B ex) {
+            Foo<?> f = new Foo<>(ex);
+        }
+    }
+}