7020044: Project Coin: diamond erroneous allowed on some anonymous inner classes

Mon, 07 Mar 2011 14:31:50 +0000

author
mcimadamore
date
Mon, 07 Mar 2011 14:31:50 +0000
changeset 914
ca32f2986301
parent 913
74f0c05c51eb
child 915
b1b898c00b71

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

src/share/classes/com/sun/tools/javac/comp/Attr.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/comp/Check.java file | annotate | diff | comparison | revisions
src/share/classes/com/sun/tools/javac/resources/compiler.properties file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples.not-yet.txt file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/DiamondAndAnonClass.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/DiamondInvalidArg.java file | annotate | diff | comparison | revisions
test/tools/javac/diags/examples/DiamondInvalidArgs.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/6996914/T6996914a.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/6996914/T6996914b.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/T6939780.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/T6939780.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg01.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg01.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg02.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg02.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg03.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg03.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg04.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg04.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg05.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg05.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg06.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg06.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg07.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg07.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg08.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg08.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg09.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg09.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg10.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg11.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg12.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/neg/Neg12.out file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/pos/Pos01.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/pos/Pos02.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/pos/Pos03.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/pos/Pos04.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/pos/Pos05.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/pos/Pos06.java file | annotate | diff | comparison | revisions
test/tools/javac/generics/diamond/pos/Pos07.java file | annotate | diff | comparison | revisions
test/tools/javac/multicatch/Neg05.java file | annotate | diff | comparison | revisions
test/tools/javac/multicatch/Neg05.out file | annotate | diff | comparison | revisions
test/tools/javac/multicatch/Pos09.java file | annotate | diff | comparison | revisions
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Mar 07 14:11:48 2011 +0000
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java	Mon Mar 07 14:31:50 2011 +0000
     1.3 @@ -1581,15 +1581,7 @@
     1.4          // symbol + type back into the attributed tree.
     1.5          Type clazztype = attribType(clazz, env);
     1.6          Pair<Scope,Scope> mapping = getSyntheticScopeMapping(clazztype, cdef != null);
     1.7 -        if (!TreeInfo.isDiamond(tree)) {
     1.8 -            clazztype = chk.checkClassType(
     1.9 -                tree.clazz.pos(), clazztype, true);
    1.10 -        } else if (!clazztype.isErroneous() &&
    1.11 -                !clazztype.tsym.type.isParameterized()) {
    1.12 -            log.error(tree.clazz.pos(),
    1.13 -                    "cant.apply.diamond.1",
    1.14 -                    clazztype, diags.fragment("diamond.non.generic", clazztype));
    1.15 -        }
    1.16 +        clazztype = chk.checkDiamond(tree, clazztype);
    1.17          chk.validate(clazz, localEnv);
    1.18          if (tree.encl != null) {
    1.19              // We have to work in this case to store
    1.20 @@ -1614,10 +1606,12 @@
    1.21          List<Type> argtypes = attribArgs(tree.args, localEnv);
    1.22          List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv);
    1.23  
    1.24 -        if (TreeInfo.isDiamond(tree) && clazztype.tsym.type.isParameterized()) {
    1.25 +        if (TreeInfo.isDiamond(tree) && !clazztype.isErroneous()) {
    1.26              clazztype = attribDiamond(localEnv, tree, clazztype, mapping, argtypes, typeargtypes);
    1.27              clazz.type = clazztype;
    1.28          } else if (allowDiamondFinder &&
    1.29 +                tree.def == null &&
    1.30 +                !clazztype.isErroneous() &&
    1.31                  clazztype.getTypeArguments().nonEmpty() &&
    1.32                  findDiamonds) {
    1.33              boolean prevDeferDiags = log.deferDiagnostics;
    1.34 @@ -1641,8 +1635,7 @@
    1.35              if (inferred != null &&
    1.36                      !inferred.isErroneous() &&
    1.37                      inferred.tag == CLASS &&
    1.38 -                    types.isAssignable(inferred, pt.tag == NONE ? clazztype : pt, Warner.noWarnings) &&
    1.39 -                    chk.checkDiamond((ClassType)inferred).isEmpty()) {
    1.40 +                    types.isAssignable(inferred, pt.tag == NONE ? clazztype : pt, Warner.noWarnings)) {
    1.41                  String key = types.isSameType(clazztype, inferred) ?
    1.42                      "diamond.redundant.args" :
    1.43                      "diamond.redundant.args.1";
    1.44 @@ -1857,34 +1850,9 @@
    1.45                          ex.diagnostic);
    1.46              }
    1.47          }
    1.48 -        clazztype = chk.checkClassType(tree.clazz.pos(),
    1.49 +        return chk.checkClassType(tree.clazz.pos(),
    1.50                  clazztype,
    1.51                  true);
    1.52 -        if (clazztype.tag == CLASS) {
    1.53 -            List<Type> invalidDiamondArgs = chk.checkDiamond((ClassType)clazztype);
    1.54 -            if (!clazztype.isErroneous() && invalidDiamondArgs.nonEmpty()) {
    1.55 -                //one or more types inferred in the previous steps is either a
    1.56 -                //captured type or an intersection type --- we need to report an error.
    1.57 -                String subkey = invalidDiamondArgs.size() > 1 ?
    1.58 -                    "diamond.invalid.args" :
    1.59 -                    "diamond.invalid.arg";
    1.60 -                //The error message is of the kind:
    1.61 -                //
    1.62 -                //cannot infer type arguments for {clazztype}<>;
    1.63 -                //reason: {subkey}
    1.64 -                //
    1.65 -                //where subkey is a fragment of the kind:
    1.66 -                //
    1.67 -                //type argument(s) {invalidDiamondArgs} inferred for {clazztype}<> is not allowed in this context
    1.68 -                log.error(tree.clazz.pos(),
    1.69 -                            "cant.apply.diamond.1",
    1.70 -                            diags.fragment("diamond", clazztype.tsym),
    1.71 -                            diags.fragment(subkey,
    1.72 -                                           invalidDiamondArgs,
    1.73 -                                           diags.fragment("diamond", clazztype.tsym)));
    1.74 -            }
    1.75 -        }
    1.76 -        return clazztype;
    1.77      }
    1.78  
    1.79      /** Creates a synthetic scope containing fake generic constructors.
     2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Mar 07 14:11:48 2011 +0000
     2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java	Mon Mar 07 14:31:50 2011 +0000
     2.3 @@ -664,40 +664,25 @@
     2.4              return true;
     2.5      }
     2.6  
     2.7 -    /** Check that the type inferred using the diamond operator does not contain
     2.8 -     *  non-denotable types such as captured types or intersection types.
     2.9 -     *  @param t the type inferred using the diamond operator
    2.10 +    /** Check that usage of diamond operator is correct (i.e. diamond should not
    2.11 +     * be used with non-generic classes or in anonymous class creation expressions)
    2.12       */
    2.13 -    List<Type> checkDiamond(ClassType t) {
    2.14 -        DiamondTypeChecker dtc = new DiamondTypeChecker();
    2.15 -        ListBuffer<Type> buf = ListBuffer.lb();
    2.16 -        for (Type arg : t.getTypeArguments()) {
    2.17 -            if (!dtc.visit(arg, null)) {
    2.18 -                buf.append(arg);
    2.19 -            }
    2.20 -        }
    2.21 -        return buf.toList();
    2.22 -    }
    2.23 -
    2.24 -    static class DiamondTypeChecker extends Types.SimpleVisitor<Boolean, Void> {
    2.25 -        public Boolean visitType(Type t, Void s) {
    2.26 -            return true;
    2.27 -        }
    2.28 -        @Override
    2.29 -        public Boolean visitClassType(ClassType t, Void s) {
    2.30 -            if (t.isCompound()) {
    2.31 -                return false;
    2.32 -            }
    2.33 -            for (Type targ : t.getTypeArguments()) {
    2.34 -                if (!visit(targ, s)) {
    2.35 -                    return false;
    2.36 -                }
    2.37 -            }
    2.38 -            return true;
    2.39 -        }
    2.40 -        @Override
    2.41 -        public Boolean visitCapturedType(CapturedType t, Void s) {
    2.42 -            return false;
    2.43 +    Type checkDiamond(JCNewClass tree, Type t) {
    2.44 +        if (!TreeInfo.isDiamond(tree) ||
    2.45 +                t.isErroneous()) {
    2.46 +            return checkClassType(tree.clazz.pos(), t, true);
    2.47 +        } else if (tree.def != null) {
    2.48 +            log.error(tree.clazz.pos(),
    2.49 +                    "cant.apply.diamond.1",
    2.50 +                    t, diags.fragment("diamond.and.anon.class", t));
    2.51 +            return types.createErrorType(t);
    2.52 +        } else if (!t.tsym.type.isParameterized()) {
    2.53 +            log.error(tree.clazz.pos(),
    2.54 +                "cant.apply.diamond.1",
    2.55 +                t, diags.fragment("diamond.non.generic", t));
    2.56 +            return types.createErrorType(t);
    2.57 +        } else {
    2.58 +            return t;
    2.59          }
    2.60      }
    2.61  
     3.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Mar 07 14:11:48 2011 +0000
     3.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties	Mon Mar 07 14:31:50 2011 +0000
     3.3 @@ -1588,14 +1588,6 @@
     3.4  compiler.misc.diamond.non.generic=\
     3.5      cannot use ''<>'' with non-generic class {0}
     3.6  
     3.7 -# 0: list of type, 1: message segment
     3.8 -compiler.misc.diamond.invalid.arg=\
     3.9 -    type argument {0} inferred for {1} is not allowed in this context
    3.10 -
    3.11 -# 0: list of type, 1: message segment
    3.12 -compiler.misc.diamond.invalid.args=\
    3.13 -    type arguments {0} inferred for {1} are not allowed in this context
    3.14 -
    3.15  # 0: type, 1: list of type
    3.16  compiler.misc.explicit.param.do.not.conform.to.bounds=\
    3.17      explicit type argument {0} does not conform to declared bound(s) {1}
    3.18 @@ -1803,8 +1795,8 @@
    3.19  compiler.misc.varargs.clash.with=\
    3.20      {0} in {1} overrides {2} in {3}
    3.21  
    3.22 -compiler.misc.non.denotable.type=\
    3.23 -    Non-denotable type {0} not allowed here
    3.24 +compiler.misc.diamond.and.anon.class=\
    3.25 +    cannot use ''<>'' with anonymous inner classes
    3.26  
    3.27  # 0: symbol kind, 1: symbol, 2: symbol, 3: message segment
    3.28  compiler.misc.inapplicable.method=\
     4.1 --- a/test/tools/javac/diags/examples.not-yet.txt	Mon Mar 07 14:11:48 2011 +0000
     4.2 +++ b/test/tools/javac/diags/examples.not-yet.txt	Mon Mar 07 14:31:50 2011 +0000
     4.3 @@ -70,7 +70,6 @@
     4.4  compiler.misc.kindname.type.variable
     4.5  compiler.misc.kindname.type.variable.bound
     4.6  compiler.misc.kindname.value
     4.7 -compiler.misc.non.denotable.type
     4.8  compiler.misc.no.unique.minimal.instance.exists
     4.9  compiler.misc.resume.abort                              # prompt for a response
    4.10  compiler.misc.source.unavailable                        # DiagnosticSource
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/test/tools/javac/diags/examples/DiamondAndAnonClass.java	Mon Mar 07 14:31:50 2011 +0000
     5.3 @@ -0,0 +1,33 @@
     5.4 +/*
     5.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
     5.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     5.7 + *
     5.8 + * This code is free software; you can redistribute it and/or modify it
     5.9 + * under the terms of the GNU General Public License version 2 only, as
    5.10 + * published by the Free Software Foundation.
    5.11 + *
    5.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
    5.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    5.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    5.15 + * version 2 for more details (a copy is included in the LICENSE file that
    5.16 + * accompanied this code).
    5.17 + *
    5.18 + * You should have received a copy of the GNU General Public License version
    5.19 + * 2 along with this work; if not, write to the Free Software Foundation,
    5.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    5.21 + *
    5.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    5.23 + * or visit www.oracle.com if you need additional information or have any
    5.24 + * questions.
    5.25 + */
    5.26 +
    5.27 +// key: compiler.misc.diamond.and.anon.class
    5.28 +// key: compiler.err.cant.apply.diamond.1
    5.29 +
    5.30 +import java.util.*;
    5.31 +
    5.32 +class DiamondAndAnonClass {
    5.33 +    void m() {
    5.34 +        List<String> list = new ArrayList<>() {};
    5.35 +    }
    5.36 +}
     6.1 --- a/test/tools/javac/diags/examples/DiamondInvalidArg.java	Mon Mar 07 14:11:48 2011 +0000
     6.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.3 @@ -1,31 +0,0 @@
     6.4 -/*
     6.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     6.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     6.7 - *
     6.8 - * This code is free software; you can redistribute it and/or modify it
     6.9 - * under the terms of the GNU General Public License version 2 only, as
    6.10 - * published by the Free Software Foundation.
    6.11 - *
    6.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
    6.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    6.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    6.15 - * version 2 for more details (a copy is included in the LICENSE file that
    6.16 - * accompanied this code).
    6.17 - *
    6.18 - * You should have received a copy of the GNU General Public License version
    6.19 - * 2 along with this work; if not, write to the Free Software Foundation,
    6.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    6.21 - *
    6.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    6.23 - * or visit www.oracle.com if you need additional information or have any
    6.24 - * questions.
    6.25 - */
    6.26 -
    6.27 -// key: compiler.misc.diamond.invalid.arg
    6.28 -// key: compiler.misc.diamond
    6.29 -// key: compiler.err.cant.apply.diamond.1
    6.30 -
    6.31 -class DiamondInvalidArg {
    6.32 -    static class Foo<X extends Number & Comparable<Number>> { }
    6.33 -    Foo<?> foo = new Foo<>();
    6.34 -}
     7.1 --- a/test/tools/javac/diags/examples/DiamondInvalidArgs.java	Mon Mar 07 14:11:48 2011 +0000
     7.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     7.3 @@ -1,32 +0,0 @@
     7.4 -/*
     7.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     7.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     7.7 - *
     7.8 - * This code is free software; you can redistribute it and/or modify it
     7.9 - * under the terms of the GNU General Public License version 2 only, as
    7.10 - * published by the Free Software Foundation.
    7.11 - *
    7.12 - * This code is distributed in the hope that it will be useful, but WITHOUT
    7.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    7.14 - * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
    7.15 - * version 2 for more details (a copy is included in the LICENSE file that
    7.16 - * accompanied this code).
    7.17 - *
    7.18 - * You should have received a copy of the GNU General Public License version
    7.19 - * 2 along with this work; if not, write to the Free Software Foundation,
    7.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
    7.21 - *
    7.22 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    7.23 - * or visit www.oracle.com if you need additional information or have any
    7.24 - * questions.
    7.25 - */
    7.26 -
    7.27 -// key: compiler.misc.diamond.invalid.args
    7.28 -// key: compiler.misc.diamond
    7.29 -// key: compiler.err.cant.apply.diamond.1
    7.30 -
    7.31 -class DiamondInvalidArgs {
    7.32 -    static class Foo<X extends Number & Comparable<Number>,
    7.33 -                           Y extends Number & Comparable<Number>> { }
    7.34 -    Foo<?,?> foo = new Foo<>();
    7.35 -}
     8.1 --- a/test/tools/javac/generics/diamond/6996914/T6996914a.java	Mon Mar 07 14:11:48 2011 +0000
     8.2 +++ b/test/tools/javac/generics/diamond/6996914/T6996914a.java	Mon Mar 07 14:31:50 2011 +0000
     8.3 @@ -1,5 +1,5 @@
     8.4  /*
     8.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     8.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
     8.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     8.8   *
     8.9   * This code is free software; you can redistribute it and/or modify it
    8.10 @@ -23,7 +23,7 @@
    8.11  
    8.12  /*
    8.13   * @test
    8.14 - * @bug 6996914
    8.15 + * @bug 6996914 7020044
    8.16   * @summary  Diamond inference: problem when accessing protected constructor
    8.17   * @run main T6996914a
    8.18   */
    8.19 @@ -53,17 +53,6 @@
    8.20          }
    8.21      }
    8.22  
    8.23 -    enum DiamondKind {
    8.24 -        STANDARD("new Foo<>();"),
    8.25 -        ANON("new Foo<>() {};");
    8.26 -
    8.27 -        String expr;
    8.28 -
    8.29 -        DiamondKind(String expr) {
    8.30 -            this.expr = expr;
    8.31 -        }
    8.32 -    }
    8.33 -
    8.34      enum ConstructorKind {
    8.35          PACKAGE(""),
    8.36          PROTECTED("protected"),
    8.37 @@ -104,14 +93,14 @@
    8.38          final static String sourceStub =
    8.39                          "#I\n" +
    8.40                          "class Test {\n" +
    8.41 -                        "  Foo<String> fs = #D\n" +
    8.42 +                        "  Foo<String> fs = new Foo<>();\n" +
    8.43                          "}\n";
    8.44  
    8.45          String source;
    8.46  
    8.47 -        public ClientClass(PackageKind pk, DiamondKind dk) {
    8.48 +        public ClientClass(PackageKind pk) {
    8.49              super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
    8.50 -            source = sourceStub.replace("#I", pk.importDecl).replace("#D", dk.expr);
    8.51 +            source = sourceStub.replace("#I", pk.importDecl);
    8.52          }
    8.53  
    8.54          @Override
    8.55 @@ -123,22 +112,20 @@
    8.56      public static void main(String... args) throws Exception {
    8.57          for (PackageKind pk : PackageKind.values()) {
    8.58              for (ConstructorKind ck : ConstructorKind.values()) {
    8.59 -                for (DiamondKind dk : DiamondKind.values()) {
    8.60 -                    compileAndCheck(pk, ck, dk);
    8.61 -                }
    8.62 +                    compileAndCheck(pk, ck);
    8.63              }
    8.64          }
    8.65      }
    8.66  
    8.67 -    static void compileAndCheck(PackageKind pk, ConstructorKind ck, DiamondKind dk) throws Exception {
    8.68 +    static void compileAndCheck(PackageKind pk, ConstructorKind ck) throws Exception {
    8.69          FooClass foo = new FooClass(pk, ck);
    8.70 -        ClientClass client = new ClientClass(pk, dk);
    8.71 +        ClientClass client = new ClientClass(pk);
    8.72          final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
    8.73          ErrorListener el = new ErrorListener();
    8.74          JavacTask ct = (JavacTask)tool.getTask(null, null, el,
    8.75                  null, null, Arrays.asList(foo, client));
    8.76          ct.analyze();
    8.77 -        if (el.errors > 0 == check(pk, ck, dk)) {
    8.78 +        if (el.errors > 0 == check(pk, ck)) {
    8.79              String msg = el.errors > 0 ?
    8.80                  "Error compiling files" :
    8.81                  "No error when compiling files";
    8.82 @@ -146,10 +133,9 @@
    8.83          }
    8.84      }
    8.85  
    8.86 -    static boolean check(PackageKind pk, ConstructorKind ck, DiamondKind dk) {
    8.87 +    static boolean check(PackageKind pk, ConstructorKind ck) {
    8.88          switch (pk) {
    8.89 -            case A: return ck == ConstructorKind.PUBLIC ||
    8.90 -                    (ck  == ConstructorKind.PROTECTED && dk == DiamondKind.ANON);
    8.91 +            case A: return ck == ConstructorKind.PUBLIC;
    8.92              case DEFAULT: return ck != ConstructorKind.PRIVATE;
    8.93              default: throw new AssertionError("Unknown package kind");
    8.94          }
     9.1 --- a/test/tools/javac/generics/diamond/6996914/T6996914b.java	Mon Mar 07 14:11:48 2011 +0000
     9.2 +++ b/test/tools/javac/generics/diamond/6996914/T6996914b.java	Mon Mar 07 14:31:50 2011 +0000
     9.3 @@ -1,5 +1,5 @@
     9.4  /*
     9.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
     9.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
     9.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     9.8   *
     9.9   * This code is free software; you can redistribute it and/or modify it
    9.10 @@ -23,7 +23,7 @@
    9.11  
    9.12  /*
    9.13   * @test
    9.14 - * @bug 6996914
    9.15 + * @bug 6996914 7020044
    9.16   * @summary  Diamond inference: problem when accessing protected constructor
    9.17   * @compile T6996914b.java
    9.18   */
    9.19 @@ -35,5 +35,4 @@
    9.20  
    9.21  class Test {
    9.22      Super<String,Integer> ssi1 = new Super<>(1, "", 2);
    9.23 -    Super<String,Integer> ssi2 = new Super<>(1, "", 2) {};
    9.24  }
    10.1 --- a/test/tools/javac/generics/diamond/T6939780.java	Mon Mar 07 14:11:48 2011 +0000
    10.2 +++ b/test/tools/javac/generics/diamond/T6939780.java	Mon Mar 07 14:31:50 2011 +0000
    10.3 @@ -1,6 +1,6 @@
    10.4  /*
    10.5   * @test /nodynamiccopyright/
    10.6 - * @bug 6939780
    10.7 + * @bug 6939780 7020044
    10.8   *
    10.9   * @summary  add a warning to detect diamond sites
   10.10   * @author mcimadamore
    11.1 --- a/test/tools/javac/generics/diamond/T6939780.out	Mon Mar 07 14:11:48 2011 +0000
    11.2 +++ b/test/tools/javac/generics/diamond/T6939780.out	Mon Mar 07 14:31:50 2011 +0000
    11.3 @@ -1,5 +1,3 @@
    11.4  T6939780.java:19:28: compiler.warn.diamond.redundant.args: Foo<java.lang.Number>, Foo<java.lang.Number>
    11.5  T6939780.java:20:28: compiler.warn.diamond.redundant.args.1: Foo<java.lang.Integer>, Foo<java.lang.Number>
    11.6 -T6939780.java:22:28: compiler.warn.diamond.redundant.args: Foo<java.lang.Number>, Foo<java.lang.Number>
    11.7 -T6939780.java:23:28: compiler.warn.diamond.redundant.args.1: Foo<java.lang.Integer>, Foo<java.lang.Number>
    11.8 -4 warnings
    11.9 +2 warnings
    12.1 --- a/test/tools/javac/generics/diamond/neg/Neg01.java	Mon Mar 07 14:11:48 2011 +0000
    12.2 +++ b/test/tools/javac/generics/diamond/neg/Neg01.java	Mon Mar 07 14:31:50 2011 +0000
    12.3 @@ -1,8 +1,9 @@
    12.4  /*
    12.5   * @test /nodynamiccopyright/
    12.6 - * @bug 6939620
    12.7 + * @bug 6939620 7020044
    12.8   *
    12.9 - * @summary  Switch to 'complex' diamond inference scheme
   12.10 + * @summary  Check that diamond fails when inference violates declared bounds
   12.11 + *           (basic test with nested class, generic/non-generic constructors)
   12.12   * @author mcimadamore
   12.13   * @compile/fail/ref=Neg01.out Neg01.java -XDrawDiagnostics
   12.14   *
   12.15 @@ -20,19 +21,9 @@
   12.16          Neg01<?> n3 = new Neg01<>("");
   12.17          Neg01<? super String> n4 = new Neg01<>("");
   12.18  
   12.19 -        Neg01<String> n5 = new Neg01<>(""){};
   12.20 -        Neg01<? extends String> n6 = new Neg01<>(""){};
   12.21 -        Neg01<?> n7 = new Neg01<>(""){};
   12.22 -        Neg01<? super String> n8 = new Neg01<>(""){};
   12.23 -
   12.24 -        Neg01<String> n9 = new Neg01<>("", "");
   12.25 -        Neg01<? extends String> n10 = new Neg01<>("", "");
   12.26 -        Neg01<?> n11 = new Neg01<>("", "");
   12.27 -        Foo<? super String> n12 = new Neg01<>("", "");
   12.28 -
   12.29 -        Neg01<String> n13 = new Neg01<>("", ""){};
   12.30 -        Neg01<? extends String> n14 = new Neg01<>("", ""){};
   12.31 -        Neg01<?> n15 = new Neg01<>("", ""){};
   12.32 -        Neg01<? super String> n16 = new Neg01<>("", ""){};
   12.33 +        Neg01<String> n5 = new Neg01<>("", "");
   12.34 +        Neg01<? extends String> n6 = new Neg01<>("", "");
   12.35 +        Neg01<?> n7 = new Neg01<>("", "");
   12.36 +        Foo<? super String> n8 = new Neg01<>("", "");
   12.37      }
   12.38  }
    13.1 --- a/test/tools/javac/generics/diamond/neg/Neg01.out	Mon Mar 07 14:11:48 2011 +0000
    13.2 +++ b/test/tools/javac/generics/diamond/neg/Neg01.out	Mon Mar 07 14:31:50 2011 +0000
    13.3 @@ -1,29 +1,15 @@
    13.4 -Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String, X
    13.5 -Neg01.java:18:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
    13.6 -Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
    13.7 -Neg01.java:19:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
    13.8 -Neg01.java:20:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
    13.9 -Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String, X
   13.10 -Neg01.java:21:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.11 -Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String, X
   13.12 -Neg01.java:23:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.13 -Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
   13.14 -Neg01.java:24:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.15 -Neg01.java:25:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.16 -Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String, X
   13.17 -Neg01.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.18 -Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String, X
   13.19 -Neg01.java:28:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.20 -Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
   13.21 -Neg01.java:29:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.22 -Neg01.java:30:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.23 -Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , (compiler.misc.location: kindname.class, Neg01<X>, null)
   13.24 -Neg01.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.25 -Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String, X
   13.26 -Neg01.java:33:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.27 -Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
   13.28 -Neg01.java:34:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.29 -Neg01.java:35:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.30 -Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String, X
   13.31 -Neg01.java:36:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.32 -28 errors
   13.33 +Neg01.java:19:15: compiler.err.not.within.bounds: java.lang.String, X
   13.34 +Neg01.java:19:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.35 +Neg01.java:20:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
   13.36 +Neg01.java:20:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.37 +Neg01.java:21:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.38 +Neg01.java:22:15: compiler.err.not.within.bounds: ? super java.lang.String, X
   13.39 +Neg01.java:22:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.40 +Neg01.java:24:15: compiler.err.not.within.bounds: java.lang.String, X
   13.41 +Neg01.java:24:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.42 +Neg01.java:25:15: compiler.err.not.within.bounds: ? extends java.lang.String, X
   13.43 +Neg01.java:25:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.44 +Neg01.java:26:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.45 +Neg01.java:27:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , (compiler.misc.location: kindname.class, Neg01<X>, null)
   13.46 +Neg01.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg01), null
   13.47 +14 errors
    14.1 --- a/test/tools/javac/generics/diamond/neg/Neg02.java	Mon Mar 07 14:11:48 2011 +0000
    14.2 +++ b/test/tools/javac/generics/diamond/neg/Neg02.java	Mon Mar 07 14:31:50 2011 +0000
    14.3 @@ -1,8 +1,9 @@
    14.4  /*
    14.5   * @test /nodynamiccopyright/
    14.6 - * @bug 6939620
    14.7 + * @bug 6939620 7020044
    14.8   *
    14.9 - * @summary  Switch to 'complex' diamond inference scheme
   14.10 + * @summary  Check that diamond fails when inference violates declared bounds
   14.11 + *           (test with nested class, qualified/simple type expressions)
   14.12   * @author mcimadamore
   14.13   * @compile/fail/ref=Neg02.out Neg02.java -XDrawDiagnostics
   14.14   *
   14.15 @@ -21,20 +22,10 @@
   14.16          Foo<?> f3 = new Foo<>("");
   14.17          Foo<? super String> f4 = new Foo<>("");
   14.18  
   14.19 -        Foo<String> f5 = new Foo<>(""){};
   14.20 -        Foo<? extends String> f6 = new Foo<>(""){};
   14.21 -        Foo<?> f7 = new Foo<>(""){};
   14.22 -        Foo<? super String> f8 = new Foo<>(""){};
   14.23 -
   14.24 -        Foo<String> f9 = new Foo<>("", "");
   14.25 -        Foo<? extends String> f10 = new Foo<>("", "");
   14.26 -        Foo<?> f11 = new Foo<>("", "");
   14.27 -        Foo<? super String> f12 = new Foo<>("", "");
   14.28 -
   14.29 -        Foo<String> f13 = new Foo<>("", ""){};
   14.30 -        Foo<? extends String> f14 = new Foo<>("", ""){};
   14.31 -        Foo<?> f15 = new Foo<>("", ""){};
   14.32 -        Foo<? super String> f16 = new Foo<>("", ""){};
   14.33 +        Foo<String> f5 = new Foo<>("", "");
   14.34 +        Foo<? extends String> f6 = new Foo<>("", "");
   14.35 +        Foo<?> f7 = new Foo<>("", "");
   14.36 +        Foo<? super String> f8 = new Foo<>("", "");
   14.37      }
   14.38  
   14.39      void testQualified() {
   14.40 @@ -43,19 +34,9 @@
   14.41          Foo<?> f3 = new Neg02.Foo<>("");
   14.42          Foo<? super String> f4 = new Neg02.Foo<>("");
   14.43  
   14.44 -        Foo<String> f5 = new Neg02.Foo<>(""){};
   14.45 -        Foo<? extends String> f6 = new Neg02.Foo<>(""){};
   14.46 -        Foo<?> f7 = new Neg02.Foo<>(""){};
   14.47 -        Foo<? super String> f8 = new Neg02.Foo<>(""){};
   14.48 -
   14.49 -        Foo<String> f9 = new Neg02.Foo<>("", "");
   14.50 -        Foo<? extends String> f10 = new Neg02.Foo<>("", "");
   14.51 -        Foo<?> f11 = new Neg02.Foo<>("", "");
   14.52 -        Foo<? super String> f12 = new Neg02.Foo<>("", "");
   14.53 -
   14.54 -        Foo<String> f13 = new Neg02.Foo<>("", ""){};
   14.55 -        Foo<? extends String> f14 = new Neg02.Foo<>("", ""){};
   14.56 -        Foo<?> f15 = new Neg02.Foo<>("", ""){};
   14.57 -        Foo<? super String> f16 = new Neg02.Foo<>("", ""){};
   14.58 +        Foo<String> f5 = new Neg02.Foo<>("", "");
   14.59 +        Foo<? extends String> f6 = new Neg02.Foo<>("", "");
   14.60 +        Foo<?> f7 = new Neg02.Foo<>("", "");
   14.61 +        Foo<? super String> f8 = new Neg02.Foo<>("", "");
   14.62      }
   14.63  }
    15.1 --- a/test/tools/javac/generics/diamond/neg/Neg02.out	Mon Mar 07 14:11:48 2011 +0000
    15.2 +++ b/test/tools/javac/generics/diamond/neg/Neg02.out	Mon Mar 07 14:31:50 2011 +0000
    15.3 @@ -1,57 +1,29 @@
    15.4 -Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String, X
    15.5 -Neg02.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
    15.6 -Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
    15.7 -Neg02.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
    15.8 -Neg02.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
    15.9 -Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.10 -Neg02.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.11 -Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String, X
   15.12 -Neg02.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.13 -Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.14 -Neg02.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.15 -Neg02.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.16 -Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.17 -Neg02.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.18 -Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String, X
   15.19 -Neg02.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.20 -Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.21 -Neg02.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.22 -Neg02.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.23 -Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.24 -Neg02.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.25 -Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String, X
   15.26 -Neg02.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.27 -Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.28 -Neg02.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.29 -Neg02.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.30 -Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.31 -Neg02.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.32 -Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String, X
   15.33 -Neg02.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.34 -Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.35 -Neg02.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.36 -Neg02.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.37 -Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.38 -Neg02.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.39 -Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String, X
   15.40 -Neg02.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.41 -Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.42 -Neg02.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.43 -Neg02.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.44 -Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.45 -Neg02.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.46 -Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String, X
   15.47 -Neg02.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.48 -Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.49 -Neg02.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.50 -Neg02.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.51 -Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.52 -Neg02.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.53 -Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String, X
   15.54 -Neg02.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.55 -Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.56 -Neg02.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.57 -Neg02.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.58 -Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.59 -Neg02.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.60 -56 errors
   15.61 +Neg02.java:20:13: compiler.err.not.within.bounds: java.lang.String, X
   15.62 +Neg02.java:20:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.63 +Neg02.java:21:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.64 +Neg02.java:21:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.65 +Neg02.java:22:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.66 +Neg02.java:23:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.67 +Neg02.java:23:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.68 +Neg02.java:25:13: compiler.err.not.within.bounds: java.lang.String, X
   15.69 +Neg02.java:25:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.70 +Neg02.java:26:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.71 +Neg02.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.72 +Neg02.java:27:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.73 +Neg02.java:28:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.74 +Neg02.java:28:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.75 +Neg02.java:32:13: compiler.err.not.within.bounds: java.lang.String, X
   15.76 +Neg02.java:32:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.77 +Neg02.java:33:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.78 +Neg02.java:33:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.79 +Neg02.java:34:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.80 +Neg02.java:35:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.81 +Neg02.java:35:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.82 +Neg02.java:37:13: compiler.err.not.within.bounds: java.lang.String, X
   15.83 +Neg02.java:37:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.84 +Neg02.java:38:13: compiler.err.not.within.bounds: ? extends java.lang.String, X
   15.85 +Neg02.java:38:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.86 +Neg02.java:39:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.87 +Neg02.java:40:13: compiler.err.not.within.bounds: ? super java.lang.String, X
   15.88 +Neg02.java:40:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg02.Foo), null
   15.89 +28 errors
    16.1 --- a/test/tools/javac/generics/diamond/neg/Neg03.java	Mon Mar 07 14:11:48 2011 +0000
    16.2 +++ b/test/tools/javac/generics/diamond/neg/Neg03.java	Mon Mar 07 14:31:50 2011 +0000
    16.3 @@ -1,8 +1,9 @@
    16.4  /*
    16.5   * @test /nodynamiccopyright/
    16.6 - * @bug 6939620
    16.7 + * @bug 6939620 7020044
    16.8   *
    16.9 - * @summary  Switch to 'complex' diamond inference scheme
   16.10 + * @summary  Check that diamond fails when inference violates declared bounds
   16.11 + *           (test with inner class, qualified/simple type expressions)
   16.12   * @author mcimadamore
   16.13   * @compile/fail/ref=Neg03.out Neg03.java -XDrawDiagnostics
   16.14   *
   16.15 @@ -21,20 +22,10 @@
   16.16          Foo<?> f3 = new Foo<>("");
   16.17          Foo<? super String> f4 = new Foo<>("");
   16.18  
   16.19 -        Foo<String> f5 = new Foo<>(""){};
   16.20 -        Foo<? extends String> f6 = new Foo<>(""){};
   16.21 -        Foo<?> f7 = new Foo<>(""){};
   16.22 -        Foo<? super String> f8 = new Foo<>(""){};
   16.23 -
   16.24 -        Foo<String> f9 = new Foo<>("", "");
   16.25 -        Foo<? extends String> f10 = new Foo<>("", "");
   16.26 -        Foo<?> f11 = new Foo<>("", "");
   16.27 -        Foo<? super String> f12 = new Foo<>("", "");
   16.28 -
   16.29 -        Foo<String> f13 = new Foo<>("", ""){};
   16.30 -        Foo<? extends String> f14 = new Foo<>("", ""){};
   16.31 -        Foo<?> f15 = new Foo<>("", ""){};
   16.32 -        Foo<? super String> f16 = new Foo<>("", ""){};
   16.33 +        Foo<String> f5 = new Foo<>("", "");
   16.34 +        Foo<? extends String> f6 = new Foo<>("", "");
   16.35 +        Foo<?> f7 = new Foo<>("", "");
   16.36 +        Foo<? super String> f8 = new Foo<>("", "");
   16.37      }
   16.38  
   16.39      void testQualified_1() {
   16.40 @@ -43,20 +34,10 @@
   16.41          Foo<?> f3 = new Neg03<U>.Foo<>("");
   16.42          Foo<? super String> f4 = new Neg03<U>.Foo<>("");
   16.43  
   16.44 -        Foo<String> f5 = new Neg03<U>.Foo<>(""){};
   16.45 -        Foo<? extends String> f6 = new Neg03<U>.Foo<>(""){};
   16.46 -        Foo<?> f7 = new Neg03<U>.Foo<>(""){};
   16.47 -        Foo<? super String> f8 = new Neg03<U>.Foo<>(""){};
   16.48 -
   16.49 -        Foo<String> f9 = new Neg03<U>.Foo<>("", "");
   16.50 -        Foo<? extends String> f10 = new Neg03<U>.Foo<>("", "");
   16.51 -        Foo<?> f11 = new Neg03<U>.Foo<>("", "");
   16.52 -        Foo<? super String> f12 = new Neg03<U>.Foo<>("", "");
   16.53 -
   16.54 -        Foo<String> f13 = new Neg03<U>.Foo<>("", ""){};
   16.55 -        Foo<? extends String> f14 = new Neg03<U>.Foo<>("", ""){};
   16.56 -        Foo<?> f15 = new Neg03<U>.Foo<>("", ""){};
   16.57 -        Foo<? super String> f16 = new Neg03<U>.Foo<>("", ""){};
   16.58 +        Foo<String> f5 = new Neg03<U>.Foo<>("", "");
   16.59 +        Foo<? extends String> f6 = new Neg03<U>.Foo<>("", "");
   16.60 +        Foo<?> f7 = new Neg03<U>.Foo<>("", "");
   16.61 +        Foo<? super String> f8 = new Neg03<U>.Foo<>("", "");
   16.62      }
   16.63  
   16.64      void testQualified_2(Neg03<U> n) {
   16.65 @@ -65,19 +46,9 @@
   16.66          Foo<?> f3 = n.new Foo<>("");
   16.67          Foo<? super String> f4 = n.new Foo<>("");
   16.68  
   16.69 -        Foo<String> f5 = n.new Foo<>(""){};
   16.70 -        Foo<? extends String> f6 = n.new Foo<>(""){};
   16.71 -        Foo<?> f7 = n.new Foo<>(""){};
   16.72 -        Foo<? super String> f8 = n.new Foo<>(""){};
   16.73 -
   16.74 -        Foo<String> f9 = n.new Foo<>("", "");
   16.75 -        Foo<? extends String> f10 = n.new Foo<>("", "");
   16.76 -        Foo<?> f11 = n.new Foo<>("", "");
   16.77 -        Foo<? super String> f12 = n.new Foo<>("", "");
   16.78 -
   16.79 -        Foo<String> f13 = n.new Foo<>("", ""){};
   16.80 -        Foo<? extends String> f14 = n.new Foo<>("", ""){};
   16.81 -        Foo<?> f15 = n.new Foo<>("", ""){};
   16.82 -        Foo<? super String> f16 = n.new Foo<>("", ""){};
   16.83 +        Foo<String> f5 = n.new Foo<>("", "");
   16.84 +        Foo<? extends String> f6 = n.new Foo<>("", "");
   16.85 +        Foo<?> f7 = n.new Foo<>("", "");
   16.86 +        Foo<? super String> f8 = n.new Foo<>("", "");
   16.87      }
   16.88  }
    17.1 --- a/test/tools/javac/generics/diamond/neg/Neg03.out	Mon Mar 07 14:11:48 2011 +0000
    17.2 +++ b/test/tools/javac/generics/diamond/neg/Neg03.out	Mon Mar 07 14:31:50 2011 +0000
    17.3 @@ -1,85 +1,43 @@
    17.4 -Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String, V
    17.5 -Neg03.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
    17.6 -Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
    17.7 -Neg03.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
    17.8 -Neg03.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
    17.9 -Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.10 -Neg03.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.11 -Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String, V
   17.12 -Neg03.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.13 -Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.14 -Neg03.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.15 -Neg03.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.16 -Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.17 -Neg03.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.18 -Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String, V
   17.19 -Neg03.java:29:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.20 -Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.21 -Neg03.java:30:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.22 -Neg03.java:31:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.23 -Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.24 -Neg03.java:32:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.25 -Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String, V
   17.26 -Neg03.java:34:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.27 -Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.28 -Neg03.java:35:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.29 -Neg03.java:36:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.30 -Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.31 -Neg03.java:37:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.32 -Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String, V
   17.33 -Neg03.java:41:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.34 -Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.35 -Neg03.java:42:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.36 -Neg03.java:43:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.37 -Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.38 -Neg03.java:44:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.39 -Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String, V
   17.40 -Neg03.java:46:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.41 -Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.42 +Neg03.java:20:13: compiler.err.not.within.bounds: java.lang.String, V
   17.43 +Neg03.java:20:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.44 +Neg03.java:21:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.45 +Neg03.java:21:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.46 +Neg03.java:22:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.47 +Neg03.java:23:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.48 +Neg03.java:23:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.49 +Neg03.java:25:13: compiler.err.not.within.bounds: java.lang.String, V
   17.50 +Neg03.java:25:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.51 +Neg03.java:26:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.52 +Neg03.java:26:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.53 +Neg03.java:27:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.54 +Neg03.java:28:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.55 +Neg03.java:28:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.56 +Neg03.java:32:13: compiler.err.not.within.bounds: java.lang.String, V
   17.57 +Neg03.java:32:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.58 +Neg03.java:33:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.59 +Neg03.java:33:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.60 +Neg03.java:34:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.61 +Neg03.java:35:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.62 +Neg03.java:35:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.63 +Neg03.java:37:13: compiler.err.not.within.bounds: java.lang.String, V
   17.64 +Neg03.java:37:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.65 +Neg03.java:38:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.66 +Neg03.java:38:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.67 +Neg03.java:39:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.68 +Neg03.java:40:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.69 +Neg03.java:40:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.70 +Neg03.java:44:13: compiler.err.not.within.bounds: java.lang.String, V
   17.71 +Neg03.java:44:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.72 +Neg03.java:45:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.73 +Neg03.java:45:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.74 +Neg03.java:46:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.75 +Neg03.java:47:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.76  Neg03.java:47:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.77 -Neg03.java:48:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.78 -Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.79 -Neg03.java:49:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.80 -Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String, V
   17.81 -Neg03.java:51:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.82 -Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.83 -Neg03.java:52:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.84 -Neg03.java:53:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.85 -Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.86 -Neg03.java:54:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.87 -Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String, V
   17.88 -Neg03.java:56:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.89 -Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.90 -Neg03.java:57:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.91 -Neg03.java:58:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.92 -Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   17.93 -Neg03.java:59:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.94 -Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String, V
   17.95 -Neg03.java:63:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.96 -Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   17.97 -Neg03.java:64:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.98 -Neg03.java:65:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
   17.99 -Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  17.100 -Neg03.java:66:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.101 -Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String, V
  17.102 -Neg03.java:68:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.103 -Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  17.104 -Neg03.java:69:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.105 -Neg03.java:70:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.106 -Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  17.107 -Neg03.java:71:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.108 -Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String, V
  17.109 -Neg03.java:73:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.110 -Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  17.111 -Neg03.java:74:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.112 -Neg03.java:75:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.113 -Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  17.114 -Neg03.java:76:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.115 -Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String, V
  17.116 -Neg03.java:78:29: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.117 -Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  17.118 -Neg03.java:79:39: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.119 -Neg03.java:80:24: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.120 -Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  17.121 -Neg03.java:81:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.122 -84 errors
  17.123 +Neg03.java:49:13: compiler.err.not.within.bounds: java.lang.String, V
  17.124 +Neg03.java:49:28: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.125 +Neg03.java:50:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
  17.126 +Neg03.java:50:38: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.127 +Neg03.java:51:23: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.128 +Neg03.java:52:13: compiler.err.not.within.bounds: ? super java.lang.String, V
  17.129 +Neg03.java:52:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Neg03.Foo), null
  17.130 +42 errors
    18.1 --- a/test/tools/javac/generics/diamond/neg/Neg04.java	Mon Mar 07 14:11:48 2011 +0000
    18.2 +++ b/test/tools/javac/generics/diamond/neg/Neg04.java	Mon Mar 07 14:31:50 2011 +0000
    18.3 @@ -1,8 +1,9 @@
    18.4  /*
    18.5   * @test /nodynamiccopyright/
    18.6 - * @bug 6939620
    18.7 + * @bug 6939620 7020044
    18.8   *
    18.9 - * @summary  Switch to 'complex' diamond inference scheme
   18.10 + * @summary  Check that diamond fails when inference violates declared bounds
   18.11 + *           (test with local class, qualified/simple type expressions)
   18.12   * @author mcimadamore
   18.13   * @compile/fail/ref=Neg04.out Neg04.java -XDrawDiagnostics
   18.14   *
   18.15 @@ -20,19 +21,9 @@
   18.16          Foo<?> n3 = new Foo<>("");
   18.17          Foo<? super String> n4 = new Foo<>("");
   18.18  
   18.19 -        Foo<String> n5 = new Foo<>(""){};
   18.20 -        Foo<? extends String> n6 = new Foo<>(""){};
   18.21 -        Foo<?> n7 = new Foo<>(""){};
   18.22 -        Foo<? super String> n8 = new Foo<>(""){};
   18.23 -
   18.24 -        Foo<String> n9 = new Foo<>("", "");
   18.25 -        Foo<? extends String> n10 = new Foo<>("", "");
   18.26 -        Foo<?> n11 = new Foo<>("", "");
   18.27 -        Foo<? super String> n12 = new Foo<>("", "");
   18.28 -
   18.29 -        Foo<String> n13 = new Foo<>("", ""){};
   18.30 -        Foo<? extends String> n14 = new Foo<>("", ""){};
   18.31 -        Foo<?> n15 = new Foo<>("", ""){};
   18.32 -        Foo<? super String> n16 = new Foo<>("", ""){};
   18.33 +        Foo<String> n5 = new Foo<>("", "");
   18.34 +        Foo<? extends String> n6 = new Foo<>("", "");
   18.35 +        Foo<?> n7 = new Foo<>("", "");
   18.36 +        Foo<? super String> n8 = new Foo<>("", "");
   18.37      }
   18.38  }
    19.1 --- a/test/tools/javac/generics/diamond/neg/Neg04.out	Mon Mar 07 14:11:48 2011 +0000
    19.2 +++ b/test/tools/javac/generics/diamond/neg/Neg04.out	Mon Mar 07 14:31:50 2011 +0000
    19.3 @@ -1,29 +1,15 @@
    19.4 -Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String, V
    19.5 -Neg04.java:18:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
    19.6 -Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
    19.7 -Neg04.java:19:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
    19.8 -Neg04.java:20:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
    19.9 -Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   19.10 -Neg04.java:21:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.11 -Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String, V
   19.12 -Neg04.java:23:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.13 -Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   19.14 -Neg04.java:24:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.15 -Neg04.java:25:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.16 -Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   19.17 -Neg04.java:26:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.18 -Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String, V
   19.19 -Neg04.java:28:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.20 -Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   19.21 -Neg04.java:29:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.22 -Neg04.java:30:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.23 -Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   19.24 -Neg04.java:31:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.25 -Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String, V
   19.26 -Neg04.java:33:27: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.27 -Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   19.28 -Neg04.java:34:37: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.29 -Neg04.java:35:22: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.30 -Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   19.31 -Neg04.java:36:35: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.32 -28 errors
   19.33 +Neg04.java:19:13: compiler.err.not.within.bounds: java.lang.String, V
   19.34 +Neg04.java:19:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.35 +Neg04.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   19.36 +Neg04.java:20:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.37 +Neg04.java:21:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.38 +Neg04.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   19.39 +Neg04.java:22:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.40 +Neg04.java:24:13: compiler.err.not.within.bounds: java.lang.String, V
   19.41 +Neg04.java:24:26: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.42 +Neg04.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String, V
   19.43 +Neg04.java:25:36: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.44 +Neg04.java:26:21: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.45 +Neg04.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String, V
   19.46 +Neg04.java:27:34: compiler.err.cant.apply.diamond: (compiler.misc.diamond: Foo), null
   19.47 +14 errors
    20.1 --- a/test/tools/javac/generics/diamond/neg/Neg05.java	Mon Mar 07 14:11:48 2011 +0000
    20.2 +++ b/test/tools/javac/generics/diamond/neg/Neg05.java	Mon Mar 07 14:31:50 2011 +0000
    20.3 @@ -1,8 +1,8 @@
    20.4  /*
    20.5   * @test /nodynamiccopyright/
    20.6 - * @bug 6939620
    20.7 + * @bug 6939620 7020044
    20.8   *
    20.9 - * @summary  Switch to 'complex' diamond inference scheme
   20.10 + * @summary  Check that usage of rare types doesn't cause spurious diamond diagnostics
   20.11   * @author mcimadamore
   20.12   * @compile/fail/ref=Neg05.out Neg05.java -XDrawDiagnostics
   20.13   *
   20.14 @@ -21,20 +21,10 @@
   20.15          Neg05<?>.Foo<?> f3 = new Neg05.Foo<>("");
   20.16          Neg05<?>.Foo<? super String> f4 = new Neg05.Foo<>("");
   20.17  
   20.18 -        Neg05<?>.Foo<String> f5 = new Neg05.Foo<>(""){};
   20.19 -        Neg05<?>.Foo<? extends String> f6 = new Neg05.Foo<>(""){};
   20.20 -        Neg05<?>.Foo<?> f7 = new Neg05.Foo<>(""){};
   20.21 -        Neg05<?>.Foo<? super String> f8 = new Neg05.Foo<>(""){};
   20.22 -
   20.23 -        Neg05<?>.Foo<String> f9 = new Neg05.Foo<>("", "");
   20.24 -        Neg05<?>.Foo<? extends String> f10 = new Neg05.Foo<>("", "");
   20.25 -        Neg05<?>.Foo<?> f11 = new Neg05.Foo<>("", "");
   20.26 -        Neg05<?>.Foo<? super String> f12 = new Neg05.Foo<>("", "");
   20.27 -
   20.28 -        Neg05<?>.Foo<String> f13 = new Neg05.Foo<>("", ""){};
   20.29 -        Neg05<?>.Foo<? extends String> f14 = new Neg05.Foo<>("", ""){};
   20.30 -        Neg05<?>.Foo<?> f15 = new Neg05.Foo<>("", ""){};
   20.31 -        Neg05<?>.Foo<? super String> f16 = new Neg05.Foo<>("", ""){};
   20.32 +        Neg05<?>.Foo<String> f5 = new Neg05.Foo<>("", "");
   20.33 +        Neg05<?>.Foo<? extends String> f6 = new Neg05.Foo<>("", "");
   20.34 +        Neg05<?>.Foo<?> f7 = new Neg05.Foo<>("", "");
   20.35 +        Neg05<?>.Foo<? super String> f8 = new Neg05.Foo<>("", "");
   20.36      }
   20.37  
   20.38      void testRare_2(Neg05 n) {
   20.39 @@ -43,19 +33,9 @@
   20.40          Neg05<?>.Foo<?> f3 = n.new Foo<>("");
   20.41          Neg05<?>.Foo<? super String> f4 = n.new Foo<>("");
   20.42  
   20.43 -        Neg05<?>.Foo<String> f5 = n.new Foo<>(""){};
   20.44 -        Neg05<?>.Foo<? extends String> f6 = n.new Foo<>(""){};
   20.45 -        Neg05<?>.Foo<?> f7 = n.new Foo<>(""){};
   20.46 -        Neg05<?>.Foo<? super String> f8 = n.new Foo<>(""){};
   20.47 -
   20.48 -        Neg05<?>.Foo<String> f9 = n.new Foo<>("", "");
   20.49 -        Neg05<?>.Foo<? extends String> f10 = n.new Foo<>("", "");
   20.50 -        Neg05<?>.Foo<?> f11 = n.new Foo<>("", "");
   20.51 -        Neg05<?>.Foo<? super String> f12 = n.new Foo<>("", "");
   20.52 -
   20.53 -        Neg05<?>.Foo<String> f13 = n.new Foo<>("", ""){};
   20.54 -        Neg05<?>.Foo<? extends String> f14 = n.new Foo<>("", ""){};
   20.55 -        Neg05<?>.Foo<?> f15 = n.new Foo<>("", ""){};
   20.56 -        Neg05<?>.Foo<? super String> f16 = n.new Foo<>("", ""){};
   20.57 +        Neg05<?>.Foo<String> f5 = n.new Foo<>("", "");
   20.58 +        Neg05<?>.Foo<? extends String> f6 = n.new Foo<>("", "");
   20.59 +        Neg05<?>.Foo<?> f7 = n.new Foo<>("", "");
   20.60 +        Neg05<?>.Foo<? super String> f8 = n.new Foo<>("", "");
   20.61      }
   20.62  }
    21.1 --- a/test/tools/javac/generics/diamond/neg/Neg05.out	Mon Mar 07 14:11:48 2011 +0000
    21.2 +++ b/test/tools/javac/generics/diamond/neg/Neg05.out	Mon Mar 07 14:31:50 2011 +0000
    21.3 @@ -7,43 +7,19 @@
    21.4  Neg05.java:22:56: compiler.err.improperly.formed.type.inner.raw.param
    21.5  Neg05.java:22:43: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
    21.6  Neg05.java:24:48: compiler.err.improperly.formed.type.inner.raw.param
    21.7 -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>
    21.8 +Neg05.java:24:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
    21.9  Neg05.java:25:58: compiler.err.improperly.formed.type.inner.raw.param
   21.10 -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>
   21.11 +Neg05.java:25:45: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
   21.12  Neg05.java:26:43: compiler.err.improperly.formed.type.inner.raw.param
   21.13 -Neg05.java:26:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.anonymous.class: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
   21.14 +Neg05.java:26:30: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
   21.15  Neg05.java:27:56: compiler.err.improperly.formed.type.inner.raw.param
   21.16 -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>
   21.17 -Neg05.java:29:48: compiler.err.improperly.formed.type.inner.raw.param
   21.18 -Neg05.java:29:35: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<java.lang.String>
   21.19 -Neg05.java:30:59: compiler.err.improperly.formed.type.inner.raw.param
   21.20 -Neg05.java:30:46: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? extends java.lang.String>
   21.21 -Neg05.java:31:44: compiler.err.improperly.formed.type.inner.raw.param
   21.22 -Neg05.java:31:31: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
   21.23 -Neg05.java:32:57: compiler.err.improperly.formed.type.inner.raw.param
   21.24 -Neg05.java:32:44: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
   21.25 -Neg05.java:34:49: compiler.err.improperly.formed.type.inner.raw.param
   21.26 -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>
   21.27 -Neg05.java:35:59: compiler.err.improperly.formed.type.inner.raw.param
   21.28 -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>
   21.29 -Neg05.java:36:44: compiler.err.improperly.formed.type.inner.raw.param
   21.30 -Neg05.java:36:31: compiler.err.prob.found.req: (compiler.misc.incompatible.types), compiler.misc.anonymous.class: Neg05.Foo<java.lang.String>, Neg05<?>.Foo<?>
   21.31 -Neg05.java:37:57: compiler.err.improperly.formed.type.inner.raw.param
   21.32 -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>
   21.33 -Neg05.java:41:37: compiler.err.improperly.formed.type.inner.raw.param
   21.34 -Neg05.java:42:47: compiler.err.improperly.formed.type.inner.raw.param
   21.35 -Neg05.java:43:32: compiler.err.improperly.formed.type.inner.raw.param
   21.36 -Neg05.java:44:45: compiler.err.improperly.formed.type.inner.raw.param
   21.37 -Neg05.java:46:37: compiler.err.improperly.formed.type.inner.raw.param
   21.38 -Neg05.java:47:47: compiler.err.improperly.formed.type.inner.raw.param
   21.39 -Neg05.java:48:32: compiler.err.improperly.formed.type.inner.raw.param
   21.40 -Neg05.java:49:45: compiler.err.improperly.formed.type.inner.raw.param
   21.41 -Neg05.java:51:37: compiler.err.improperly.formed.type.inner.raw.param
   21.42 -Neg05.java:52:48: compiler.err.improperly.formed.type.inner.raw.param
   21.43 -Neg05.java:53:33: compiler.err.improperly.formed.type.inner.raw.param
   21.44 -Neg05.java:54:46: compiler.err.improperly.formed.type.inner.raw.param
   21.45 -Neg05.java:56:38: compiler.err.improperly.formed.type.inner.raw.param
   21.46 -Neg05.java:57:48: compiler.err.improperly.formed.type.inner.raw.param
   21.47 -Neg05.java:58:33: compiler.err.improperly.formed.type.inner.raw.param
   21.48 -Neg05.java:59:46: compiler.err.improperly.formed.type.inner.raw.param
   21.49 -48 errors
   21.50 +Neg05.java:27:43: compiler.err.prob.found.req: (compiler.misc.incompatible.types), Neg05.Foo<java.lang.String>, Neg05<?>.Foo<? super java.lang.String>
   21.51 +Neg05.java:31:37: compiler.err.improperly.formed.type.inner.raw.param
   21.52 +Neg05.java:32:47: compiler.err.improperly.formed.type.inner.raw.param
   21.53 +Neg05.java:33:32: compiler.err.improperly.formed.type.inner.raw.param
   21.54 +Neg05.java:34:45: compiler.err.improperly.formed.type.inner.raw.param
   21.55 +Neg05.java:36:37: compiler.err.improperly.formed.type.inner.raw.param
   21.56 +Neg05.java:37:47: compiler.err.improperly.formed.type.inner.raw.param
   21.57 +Neg05.java:38:32: compiler.err.improperly.formed.type.inner.raw.param
   21.58 +Neg05.java:39:45: compiler.err.improperly.formed.type.inner.raw.param
   21.59 +24 errors
    22.1 --- a/test/tools/javac/generics/diamond/neg/Neg06.java	Mon Mar 07 14:11:48 2011 +0000
    22.2 +++ b/test/tools/javac/generics/diamond/neg/Neg06.java	Mon Mar 07 14:31:50 2011 +0000
    22.3 @@ -1,21 +1,17 @@
    22.4  /*
    22.5   * @test /nodynamiccopyright/
    22.6 - * @bug 6939620
    22.7 + * @bug 6939620 7020044
    22.8   *
    22.9 - * @summary  Switch to 'complex' diamond inference scheme
   22.10 + * @summary  Check that diamond works where LHS is supertype of RHS (nilary constructor)
   22.11   * @author mcimadamore
   22.12   * @compile/fail/ref=Neg06.out Neg06.java -XDrawDiagnostics
   22.13   *
   22.14   */
   22.15  
   22.16  class Neg06 {
   22.17 -   interface ISuperFoo<X> {}
   22.18 -   interface IFoo<X extends Number> extends ISuperFoo<X> {}
   22.19  
   22.20     static class CSuperFoo<X> {}
   22.21     static class CFoo<X extends Number> extends CSuperFoo<X> {}
   22.22  
   22.23 -   ISuperFoo<String> isf = new IFoo<>() {};
   22.24     CSuperFoo<String> csf1 = new CFoo<>();
   22.25 -   CSuperFoo<String> csf2 = new CFoo<>() {};
   22.26  }
    23.1 --- a/test/tools/javac/generics/diamond/neg/Neg06.out	Mon Mar 07 14:11:48 2011 +0000
    23.2 +++ b/test/tools/javac/generics/diamond/neg/Neg06.out	Mon Mar 07 14:31:50 2011 +0000
    23.3 @@ -1,4 +1,2 @@
    23.4 -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>)
    23.5 -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>)
    23.6 -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>)
    23.7 -3 errors
    23.8 +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>)
    23.9 +1 error
    24.1 --- a/test/tools/javac/generics/diamond/neg/Neg07.java	Mon Mar 07 14:11:48 2011 +0000
    24.2 +++ b/test/tools/javac/generics/diamond/neg/Neg07.java	Mon Mar 07 14:31:50 2011 +0000
    24.3 @@ -1,8 +1,8 @@
    24.4  /*
    24.5   * @test /nodynamiccopyright/
    24.6 - * @bug 6939620
    24.7 + * @bug 6939620 7020044
    24.8   *
    24.9 - * @summary  Switch to 'complex' diamond inference scheme
   24.10 + * @summary  Check that diamond works where LHS is supertype of RHS (1-ary constructor)
   24.11   * @author mcimadamore
   24.12   * @compile/fail/ref=Neg07.out Neg07.java -XDrawDiagnostics
   24.13   *
   24.14 @@ -15,5 +15,4 @@
   24.15     }
   24.16  
   24.17     SuperFoo<String> sf1 = new Foo<>("");
   24.18 -   SuperFoo<String> sf2 = new Foo<>("") {};
   24.19  }
    25.1 --- a/test/tools/javac/generics/diamond/neg/Neg07.out	Mon Mar 07 14:11:48 2011 +0000
    25.2 +++ b/test/tools/javac/generics/diamond/neg/Neg07.out	Mon Mar 07 14:31:50 2011 +0000
    25.3 @@ -1,3 +1,2 @@
    25.4  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)
    25.5 -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)
    25.6 -2 errors
    25.7 +1 error
    26.1 --- a/test/tools/javac/generics/diamond/neg/Neg08.java	Mon Mar 07 14:11:48 2011 +0000
    26.2 +++ b/test/tools/javac/generics/diamond/neg/Neg08.java	Mon Mar 07 14:31:50 2011 +0000
    26.3 @@ -1,30 +1,15 @@
    26.4  /*
    26.5   * @test /nodynamiccopyright/
    26.6 - * @bug 6939620 6894753
    26.7 + * @bug 7020043 7020044
    26.8   *
    26.9 - * @summary  Switch to 'complex' diamond inference scheme
   26.10 - * @author mcimadamore
   26.11 + * @summary  Check that diamond is not allowed with non-generic class types
   26.12 + * @author R&eacute;mi Forax
   26.13   * @compile/fail/ref=Neg08.out Neg08.java -XDrawDiagnostics
   26.14   *
   26.15   */
   26.16  
   26.17  class Neg08 {
   26.18 -    static class Foo<X> {
   26.19 -        Foo(X x) {  }
   26.20 -    }
   26.21 -
   26.22 -    static class DoubleFoo<X,Y> {
   26.23 -        DoubleFoo(X x,Y y) {  }
   26.24 -    }
   26.25 -
   26.26 -    static class TripleFoo<X,Y,Z> {
   26.27 -        TripleFoo(X x,Y y,Z z) {  }
   26.28 -    }
   26.29 -
   26.30 -    Foo<? extends Integer> fi = new Foo<>(1);
   26.31 -    Foo<?> fw = new Foo<>(fi);
   26.32 -    Foo<? extends Double> fd = new Foo<>(3.0);
   26.33 -    DoubleFoo<?,?> dw = new DoubleFoo<>(fi,fd);
   26.34 -    Foo<String> fs = new Foo<>("one");
   26.35 -    TripleFoo<?,?,?> tw = new TripleFoo<>(fi,fd,fs);
   26.36 +   public static void main(String[] args) {
   26.37 +     String s = new String<>("foo");
   26.38 +   }
   26.39  }
    27.1 --- a/test/tools/javac/generics/diamond/neg/Neg08.out	Mon Mar 07 14:11:48 2011 +0000
    27.2 +++ b/test/tools/javac/generics/diamond/neg/Neg08.out	Mon Mar 07 14:31:50 2011 +0000
    27.3 @@ -1,4 +1,2 @@
    27.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))
    27.5 -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))
    27.6 -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))
    27.7 -3 errors
    27.8 +Neg08.java:13:27: compiler.err.cant.apply.diamond.1: java.lang.String, (compiler.misc.diamond.non.generic: java.lang.String)
    27.9 +1 error
    28.1 --- a/test/tools/javac/generics/diamond/neg/Neg09.java	Mon Mar 07 14:11:48 2011 +0000
    28.2 +++ b/test/tools/javac/generics/diamond/neg/Neg09.java	Mon Mar 07 14:31:50 2011 +0000
    28.3 @@ -1,22 +1,25 @@
    28.4  /*
    28.5   * @test /nodynamiccopyright/
    28.6 - * @bug 6939620 6894753
    28.7 + * @bug 7020044
    28.8   *
    28.9 - * @summary  Switch to 'complex' diamond inference scheme
   28.10 - * @author mcimadamore
   28.11 + * @summary  Check that diamond is not allowed with anonymous inner class expressions
   28.12 + * @author Maurizio Cimadamore
   28.13   * @compile/fail/ref=Neg09.out Neg09.java -XDrawDiagnostics
   28.14   *
   28.15   */
   28.16  
   28.17  class Neg09 {
   28.18 -    static class Foo<X extends Number & Comparable<Number>> {}
   28.19 -    static class DoubleFoo<X extends Number & Comparable<Number>,
   28.20 -                           Y extends Number & Comparable<Number>> {}
   28.21 -    static class TripleFoo<X extends Number & Comparable<Number>,
   28.22 -                           Y extends Number & Comparable<Number>,
   28.23 -                           Z> {}
   28.24 +    class Member<X> {}
   28.25  
   28.26 -    Foo<?> fw = new Foo<>();
   28.27 -    DoubleFoo<?,?> dw = new DoubleFoo<>();
   28.28 -    TripleFoo<?,?,?> tw = new TripleFoo<>();
   28.29 +    static class Nested<X> {}
   28.30 +
   28.31 +    void testSimple() {
   28.32 +        Member<?> m1 = new Member<>() {};
   28.33 +        Nested<?> m2 = new Nested<>() {};
   28.34 +    }
   28.35 +
   28.36 +    void testQualified() {
   28.37 +        Member<?> m1 = this.new Member<>() {};
   28.38 +        Nested<?> m2 = new Neg09.Nested<>() {};
   28.39 +    }
   28.40  }
    29.1 --- a/test/tools/javac/generics/diamond/neg/Neg09.out	Mon Mar 07 14:11:48 2011 +0000
    29.2 +++ b/test/tools/javac/generics/diamond/neg/Neg09.out	Mon Mar 07 14:31:50 2011 +0000
    29.3 @@ -1,4 +1,5 @@
    29.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))
    29.5 -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))
    29.6 -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))
    29.7 -3 errors
    29.8 +Neg09.java:17:34: compiler.err.cant.apply.diamond.1: Neg09.Member, (compiler.misc.diamond.and.anon.class: Neg09.Member)
    29.9 +Neg09.java:18:34: compiler.err.cant.apply.diamond.1: Neg09.Nested, (compiler.misc.diamond.and.anon.class: Neg09.Nested)
   29.10 +Neg09.java:22:39: compiler.err.cant.apply.diamond.1: Neg09.Member, (compiler.misc.diamond.and.anon.class: Neg09.Member)
   29.11 +Neg09.java:23:40: compiler.err.cant.apply.diamond.1: Neg09.Nested, (compiler.misc.diamond.and.anon.class: Neg09.Nested)
   29.12 +4 errors
    30.1 --- a/test/tools/javac/generics/diamond/neg/Neg10.java	Mon Mar 07 14:11:48 2011 +0000
    30.2 +++ b/test/tools/javac/generics/diamond/neg/Neg10.java	Mon Mar 07 14:31:50 2011 +0000
    30.3 @@ -1,8 +1,8 @@
    30.4  /*
    30.5   * @test /nodynamiccopyright/
    30.6 - * @bug 6939620
    30.7 + * @bug 6939620 7020044
    30.8   *
    30.9 - * @summary  Switch to 'complex' diamond inference scheme
   30.10 + * @summary  Check that 'complex' diamond can infer type that is too specific
   30.11   * @author mcimadamore
   30.12   * @compile/fail/ref=Neg10.out Neg10.java -XDrawDiagnostics
   30.13   *
    31.1 --- a/test/tools/javac/generics/diamond/neg/Neg11.java	Mon Mar 07 14:11:48 2011 +0000
    31.2 +++ b/test/tools/javac/generics/diamond/neg/Neg11.java	Mon Mar 07 14:31:50 2011 +0000
    31.3 @@ -1,8 +1,8 @@
    31.4  /*
    31.5   * @test /nodynamiccopyright/
    31.6 - * @bug 6939620
    31.7 + * @bug 6939620 7020044
    31.8   *
    31.9 - * @summary  Switch to 'complex' diamond inference scheme
   31.10 + * @summary  Check that unresolved symbols doesn't cause spurious diamond diagnostics
   31.11   * @author mcimadamore
   31.12   * @compile/fail/ref=Neg11.out Neg11.java -XDrawDiagnostics
   31.13   *
    32.1 --- a/test/tools/javac/generics/diamond/neg/Neg12.java	Mon Mar 07 14:11:48 2011 +0000
    32.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    32.3 @@ -1,15 +0,0 @@
    32.4 -/*
    32.5 - * @test /nodynamiccopyright/
    32.6 - * @bug 7020043
    32.7 - *
    32.8 - * @summary  Project Coin: diamond allowed on non-generic type
    32.9 - * @author R&eacute;mi Forax
   32.10 - * @compile/fail/ref=Neg12.out Neg12.java -XDrawDiagnostics
   32.11 - *
   32.12 - */
   32.13 -
   32.14 -class DiamondRaw {
   32.15 -   public static void main(String[] args) {
   32.16 -     String s = new String<>("foo");
   32.17 -   }
   32.18 -}
    33.1 --- a/test/tools/javac/generics/diamond/neg/Neg12.out	Mon Mar 07 14:11:48 2011 +0000
    33.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    33.3 @@ -1,2 +0,0 @@
    33.4 -Neg12.java:13:27: compiler.err.cant.apply.diamond.1: java.lang.String, (compiler.misc.diamond.non.generic: java.lang.String)
    33.5 -1 error
    34.1 --- a/test/tools/javac/generics/diamond/pos/Pos01.java	Mon Mar 07 14:11:48 2011 +0000
    34.2 +++ b/test/tools/javac/generics/diamond/pos/Pos01.java	Mon Mar 07 14:31:50 2011 +0000
    34.3 @@ -1,5 +1,5 @@
    34.4  /*
    34.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    34.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    34.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    34.8   *
    34.9   * This code is free software; you can redistribute it and/or modify it
   34.10 @@ -23,9 +23,9 @@
   34.11  
   34.12  /*
   34.13   * @test
   34.14 - * @bug 6939620
   34.15 + * @bug 6939620 7020044
   34.16   *
   34.17 - * @summary  Switch to 'complex' diamond inference scheme
   34.18 + * @summary  basic test for diamond (generic/non-generic constructors)
   34.19   * @author mcimadamore
   34.20   * @compile Pos01.java
   34.21   * @run main Pos01
   34.22 @@ -44,20 +44,10 @@
   34.23          Pos01<?> p3 = new Pos01<>(1);
   34.24          Pos01<? super Integer> p4 = new Pos01<>(1);
   34.25  
   34.26 -        Pos01<Integer> p5 = new Pos01<>(1){};
   34.27 -        Pos01<? extends Integer> p6 = new Pos01<>(1){};
   34.28 -        Pos01<?> p7 = new Pos01<>(1){};
   34.29 -        Pos01<? super Integer> p8 = new Pos01<>(1){};
   34.30 -
   34.31 -        Pos01<Integer> p9 = new Pos01<>(1, "");
   34.32 -        Pos01<? extends Integer> p10 = new Pos01<>(1, "");
   34.33 -        Pos01<?> p11 = new Pos01<>(1, "");
   34.34 -        Pos01<? super Integer> p12 = new Pos01<>(1, "");
   34.35 -
   34.36 -        Pos01<Integer> p13 = new Pos01<>(1, ""){};
   34.37 -        Pos01<? extends Integer> p14= new Pos01<>(1, ""){};
   34.38 -        Pos01<?> p15 = new Pos01<>(1, ""){};
   34.39 -        Pos01<? super Integer> p16 = new Pos01<>(1, ""){};
   34.40 +        Pos01<Integer> p5 = new Pos01<>(1, "");
   34.41 +        Pos01<? extends Integer> p6 = new Pos01<>(1, "");
   34.42 +        Pos01<?> p7 = new Pos01<>(1, "");
   34.43 +        Pos01<? super Integer> p8 = new Pos01<>(1, "");
   34.44      }
   34.45  
   34.46      public static void main(String[] args) {
    35.1 --- a/test/tools/javac/generics/diamond/pos/Pos02.java	Mon Mar 07 14:11:48 2011 +0000
    35.2 +++ b/test/tools/javac/generics/diamond/pos/Pos02.java	Mon Mar 07 14:31:50 2011 +0000
    35.3 @@ -1,5 +1,5 @@
    35.4  /*
    35.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    35.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    35.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    35.8   *
    35.9   * This code is free software; you can redistribute it and/or modify it
   35.10 @@ -23,9 +23,9 @@
   35.11  
   35.12  /*
   35.13   * @test
   35.14 - * @bug 6939620
   35.15 + * @bug 6939620 7020044
   35.16   *
   35.17 - * @summary  Switch to 'complex' diamond inference scheme
   35.18 + * @summary  basic test for diamond (simple/qualified type-expressions)
   35.19   * @author mcimadamore
   35.20   * @compile Pos02.java
   35.21   * @run main Pos02
   35.22 @@ -44,20 +44,10 @@
   35.23          Foo<?> f3 = new Foo<>(1);
   35.24          Foo<? super Integer> f4 = new Foo<>(1);
   35.25  
   35.26 -        Foo<Integer> f5 = new Foo<>(1){};
   35.27 -        Foo<? extends Integer> f6 = new Foo<>(1){};
   35.28 -        Foo<?> f7 = new Foo<>(1){};
   35.29 -        Foo<? super Integer> f8 = new Foo<>(1){};
   35.30 -
   35.31 -        Foo<Integer> f9 = new Foo<>(1, "");
   35.32 -        Foo<? extends Integer> f10 = new Foo<>(1, "");
   35.33 -        Foo<?> f11 = new Foo<>(1, "");
   35.34 -        Foo<? super Integer> f12 = new Foo<>(1, "");
   35.35 -
   35.36 -        Foo<Integer> f13 = new Foo<>(1, ""){};
   35.37 -        Foo<? extends Integer> f14 = new Foo<>(1, ""){};
   35.38 -        Foo<?> f15 = new Foo<>(1, ""){};
   35.39 -        Foo<? super Integer> f16 = new Foo<>(1, ""){};
   35.40 +        Foo<Integer> f5 = new Foo<>(1, "");
   35.41 +        Foo<? extends Integer> f6 = new Foo<>(1, "");
   35.42 +        Foo<?> f7 = new Foo<>(1, "");
   35.43 +        Foo<? super Integer> f8 = new Foo<>(1, "");
   35.44      }
   35.45  
   35.46      void testQualified() {
   35.47 @@ -66,20 +56,10 @@
   35.48          Foo<?> f3 = new Pos02.Foo<>(1);
   35.49          Foo<? super Integer> f4 = new Pos02.Foo<>(1);
   35.50  
   35.51 -        Foo<Integer> f5 = new Pos02.Foo<>(1){};
   35.52 -        Foo<? extends Integer> f6 = new Pos02.Foo<>(1){};
   35.53 -        Foo<?> f7 = new Pos02.Foo<>(1){};
   35.54 -        Foo<? super Integer> f8 = new Pos02.Foo<>(1){};
   35.55 -
   35.56 -        Foo<Integer> f9 = new Pos02.Foo<>(1, "");
   35.57 -        Foo<? extends Integer> f10 = new Pos02.Foo<>(1, "");
   35.58 -        Foo<?> f11 = new Pos02.Foo<>(1, "");
   35.59 -        Foo<? super Integer> f12 = new Pos02.Foo<>(1, "");
   35.60 -
   35.61 -        Foo<Integer> f13 = new Pos02.Foo<>(1, ""){};
   35.62 -        Foo<? extends Integer> f14 = new Pos02.Foo<>(1, ""){};
   35.63 -        Foo<?> f15 = new Pos02.Foo<>(1, ""){};
   35.64 -        Foo<? super Integer> f16 = new Pos02.Foo<>(1, ""){};
   35.65 +        Foo<Integer> f5 = new Pos02.Foo<>(1, "");
   35.66 +        Foo<? extends Integer> f6 = new Pos02.Foo<>(1, "");
   35.67 +        Foo<?> f7 = new Pos02.Foo<>(1, "");
   35.68 +        Foo<? super Integer> f8 = new Pos02.Foo<>(1, "");
   35.69      }
   35.70  
   35.71      public static void main(String[] args) {
    36.1 --- a/test/tools/javac/generics/diamond/pos/Pos03.java	Mon Mar 07 14:11:48 2011 +0000
    36.2 +++ b/test/tools/javac/generics/diamond/pos/Pos03.java	Mon Mar 07 14:31:50 2011 +0000
    36.3 @@ -1,5 +1,5 @@
    36.4  /*
    36.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    36.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    36.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    36.8   *
    36.9   * This code is free software; you can redistribute it and/or modify it
   36.10 @@ -23,9 +23,9 @@
   36.11  
   36.12  /*
   36.13   * @test
   36.14 - * @bug 6939620
   36.15 + * @bug 6939620 7020044
   36.16   *
   36.17 - * @summary  Switch to 'complex' diamond inference scheme
   36.18 + * @summary  basic test for diamond (simple/qualified type-expressions, member inner)
   36.19   * @author mcimadamore
   36.20   * @compile Pos03.java
   36.21   * @run main Pos03
   36.22 @@ -45,20 +45,10 @@
   36.23          Foo<?> f3 = new Foo<>(1);
   36.24          Foo<? super Integer> f4 = new Foo<>(1);
   36.25  
   36.26 -        Foo<Integer> f5 = new Foo<>(1){};
   36.27 -        Foo<? extends Integer> f6 = new Foo<>(1){};
   36.28 -        Foo<?> f7 = new Foo<>(1){};
   36.29 -        Foo<? super Integer> f8 = new Foo<>(1){};
   36.30 -
   36.31 -        Foo<Integer> f9 = new Foo<>(1, "");
   36.32 -        Foo<? extends Integer> f10 = new Foo<>(1, "");
   36.33 -        Foo<?> f11 = new Foo<>(1, "");
   36.34 -        Foo<? super Integer> f12 = new Foo<>(1, "");
   36.35 -
   36.36 -        Foo<Integer> f13 = new Foo<>(1, ""){};
   36.37 -        Foo<? extends Integer> f14 = new Foo<>(1, ""){};
   36.38 -        Foo<?> f15 = new Foo<>(1, ""){};
   36.39 -        Foo<? super Integer> f16 = new Foo<>(1, ""){};
   36.40 +        Foo<Integer> f5 = new Foo<>(1, "");
   36.41 +        Foo<? extends Integer> f6 = new Foo<>(1, "");
   36.42 +        Foo<?> f7 = new Foo<>(1, "");
   36.43 +        Foo<? super Integer> f8 = new Foo<>(1, "");
   36.44      }
   36.45  
   36.46      void testQualified_1() {
   36.47 @@ -67,20 +57,10 @@
   36.48          Foo<?> f3 = new Pos03<U>.Foo<>(1);
   36.49          Foo<? super Integer> f4 = new Pos03<U>.Foo<>(1);
   36.50  
   36.51 -        Foo<Integer> f5 = new Pos03<U>.Foo<>(1){};
   36.52 -        Foo<? extends Integer> f6 = new Pos03<U>.Foo<>(1){};
   36.53 -        Foo<?> f7 = new Pos03<U>.Foo<>(1){};
   36.54 -        Foo<? super Integer> f8 = new Pos03<U>.Foo<>(1){};
   36.55 -
   36.56 -        Foo<Integer> f9 = new Pos03<U>.Foo<>(1, "");
   36.57 -        Foo<? extends Integer> f10 = new Pos03<U>.Foo<>(1, "");
   36.58 -        Foo<?> f11 = new Pos03<U>.Foo<>(1, "");
   36.59 -        Foo<? super Integer> f12 = new Pos03<U>.Foo<>(1, "");
   36.60 -
   36.61 -        Foo<Integer> f13 = new Pos03<U>.Foo<>(1, ""){};
   36.62 -        Foo<? extends Integer> f14 = new Pos03<U>.Foo<>(1, ""){};
   36.63 -        Foo<?> f15 = new Pos03<U>.Foo<>(1, ""){};
   36.64 -        Foo<? super Integer> f16 = new Pos03<U>.Foo<>(1, ""){};
   36.65 +        Foo<Integer> f5 = new Pos03<U>.Foo<>(1, "");
   36.66 +        Foo<? extends Integer> f6 = new Pos03<U>.Foo<>(1, "");
   36.67 +        Foo<?> f7 = new Pos03<U>.Foo<>(1, "");
   36.68 +        Foo<? super Integer> f8 = new Pos03<U>.Foo<>(1, "");
   36.69      }
   36.70  
   36.71      void testQualified_2(Pos03<U> p) {
   36.72 @@ -89,20 +69,10 @@
   36.73          Foo<?> f3 = p.new Foo<>(1);
   36.74          Foo<? super Integer> f4 = p.new Foo<>(1);
   36.75  
   36.76 -        Foo<Integer> f5 = p.new Foo<>(1){};
   36.77 -        Foo<? extends Integer> f6 = p.new Foo<>(1){};
   36.78 -        Foo<?> f7 = p.new Foo<>(1){};
   36.79 -        Foo<? super Integer> f8 = p.new Foo<>(1){};
   36.80 -
   36.81 -        Foo<Integer> f9 = p.new Foo<>(1, "");
   36.82 -        Foo<? extends Integer> f10 = p.new Foo<>(1, "");
   36.83 -        Foo<?> f11 = p.new Foo<>(1, "");
   36.84 -        Foo<? super Integer> f12 = p.new Foo<>(1, "");
   36.85 -
   36.86 -        Foo<Integer> f13 = p.new Foo<>(1, ""){};
   36.87 -        Foo<? extends Integer> f14 = p.new Foo<>(1, ""){};
   36.88 -        Foo<?> f15 = p.new Foo<>(1, ""){};
   36.89 -        Foo<? super Integer> f16 = p.new Foo<>(1, ""){};
   36.90 +        Foo<Integer> f5 = p.new Foo<>(1, "");
   36.91 +        Foo<? extends Integer> f6 = p.new Foo<>(1, "");
   36.92 +        Foo<?> f7 = p.new Foo<>(1, "");
   36.93 +        Foo<? super Integer> f8 = p.new Foo<>(1, "");
   36.94      }
   36.95  
   36.96      public static void main(String[] args) {
    37.1 --- a/test/tools/javac/generics/diamond/pos/Pos04.java	Mon Mar 07 14:11:48 2011 +0000
    37.2 +++ b/test/tools/javac/generics/diamond/pos/Pos04.java	Mon Mar 07 14:31:50 2011 +0000
    37.3 @@ -1,5 +1,5 @@
    37.4  /*
    37.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    37.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    37.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    37.8   *
    37.9   * This code is free software; you can redistribute it and/or modify it
   37.10 @@ -23,9 +23,9 @@
   37.11  
   37.12  /*
   37.13   * @test
   37.14 - * @bug 6939620
   37.15 + * @bug 6939620 7020044
   37.16   *
   37.17 - * @summary  Switch to 'complex' diamond inference scheme
   37.18 + * @summary  basic test for diamond (simple/qualified type-expressions, local class)
   37.19   * @author mcimadamore
   37.20   * @compile Pos04.java
   37.21   * @run main Pos04
   37.22 @@ -44,20 +44,10 @@
   37.23          Foo<?> p3 = new Foo<>(1);
   37.24          Foo<? super Integer> p4 = new Foo<>(1);
   37.25  
   37.26 -        Foo<Integer> p5 = new Foo<>(1){};
   37.27 -        Foo<? extends Integer> p6 = new Foo<>(1){};
   37.28 -        Foo<?> p7 = new Foo<>(1){};
   37.29 -        Foo<? super Integer> p8 = new Foo<>(1){};
   37.30 -
   37.31 -        Foo<Integer> p9 = new Foo<>(1, "");
   37.32 -        Foo<? extends Integer> p10 = new Foo<>(1, "");
   37.33 -        Foo<?> p11 = new Foo<>(1, "");
   37.34 -        Foo<? super Integer> p12 = new Foo<>(1, "");
   37.35 -
   37.36 -        Foo<Integer> p13 = new Foo<>(1, ""){};
   37.37 -        Foo<? extends Integer> p14 = new Foo<>(1, ""){};
   37.38 -        Foo<?> p15 = new Foo<>(1, ""){};
   37.39 -        Foo<? super Integer> p16 = new Foo<>(1, ""){};
   37.40 +        Foo<Integer> p5 = new Foo<>(1, "");
   37.41 +        Foo<? extends Integer> p6 = new Foo<>(1, "");
   37.42 +        Foo<?> p7 = new Foo<>(1, "");
   37.43 +        Foo<? super Integer> p8 = new Foo<>(1, "");
   37.44      }
   37.45  
   37.46      public static void main(String[] args) {
    38.1 --- a/test/tools/javac/generics/diamond/pos/Pos05.java	Mon Mar 07 14:11:48 2011 +0000
    38.2 +++ b/test/tools/javac/generics/diamond/pos/Pos05.java	Mon Mar 07 14:31:50 2011 +0000
    38.3 @@ -1,5 +1,5 @@
    38.4  /*
    38.5 - * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
    38.6 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    38.7   * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    38.8   *
    38.9   * This code is free software; you can redistribute it and/or modify it
   38.10 @@ -23,9 +23,9 @@
   38.11  
   38.12  /*
   38.13   * @test
   38.14 - * @bug 6939620
   38.15 + * @bug 6939620 7020044
   38.16   *
   38.17 - * @summary  Switch to 'complex' diamond inference scheme
   38.18 + * @summary  Check that 'complex' inference sometimes works in method context
   38.19   * @author mcimadamore
   38.20   * @compile Pos05.java
   38.21   *
    39.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    39.2 +++ b/test/tools/javac/generics/diamond/pos/Pos06.java	Mon Mar 07 14:31:50 2011 +0000
    39.3 @@ -0,0 +1,53 @@
    39.4 +/*
    39.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    39.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    39.7 + *
    39.8 + * This code is free software; you can redistribute it and/or modify it
    39.9 + * under the terms of the GNU General Public License version 2 only, as
   39.10 + * published by the Free Software Foundation.
   39.11 + *
   39.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   39.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   39.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   39.15 + * version 2 for more details (a copy is included in the LICENSE file that
   39.16 + * accompanied this code).
   39.17 + *
   39.18 + * You should have received a copy of the GNU General Public License version
   39.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   39.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   39.21 + *
   39.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   39.23 + * or visit www.oracle.com if you need additional information or have any
   39.24 + * questions.
   39.25 + */
   39.26 +
   39.27 +/*
   39.28 + * @test
   39.29 + * @bug 6939620 6894753 7020044
   39.30 + *
   39.31 + * @summary  Diamond and subtyping
   39.32 + * @author mcimadamore
   39.33 + * @compile Pos06.java
   39.34 + *
   39.35 + */
   39.36 +
   39.37 +class Pos06 {
   39.38 +    static class Foo<X> {
   39.39 +        Foo(X x) {  }
   39.40 +    }
   39.41 +
   39.42 +    static class DoubleFoo<X,Y> {
   39.43 +        DoubleFoo(X x,Y y) {  }
   39.44 +    }
   39.45 +
   39.46 +    static class TripleFoo<X,Y,Z> {
   39.47 +        TripleFoo(X x,Y y,Z z) {  }
   39.48 +    }
   39.49 +
   39.50 +    Foo<? extends Integer> fi = new Foo<>(1);
   39.51 +    Foo<?> fw = new Foo<>(fi);
   39.52 +    Foo<? extends Double> fd = new Foo<>(3.0);
   39.53 +    DoubleFoo<?,?> dw = new DoubleFoo<>(fi,fd);
   39.54 +    Foo<String> fs = new Foo<>("one");
   39.55 +    TripleFoo<?,?,?> tw = new TripleFoo<>(fi,fd,fs);
   39.56 +}
    40.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    40.2 +++ b/test/tools/javac/generics/diamond/pos/Pos07.java	Mon Mar 07 14:31:50 2011 +0000
    40.3 @@ -0,0 +1,45 @@
    40.4 +/*
    40.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
    40.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    40.7 + *
    40.8 + * This code is free software; you can redistribute it and/or modify it
    40.9 + * under the terms of the GNU General Public License version 2 only, as
   40.10 + * published by the Free Software Foundation.
   40.11 + *
   40.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   40.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   40.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   40.15 + * version 2 for more details (a copy is included in the LICENSE file that
   40.16 + * accompanied this code).
   40.17 + *
   40.18 + * You should have received a copy of the GNU General Public License version
   40.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   40.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   40.21 + *
   40.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   40.23 + * or visit www.oracle.com if you need additional information or have any
   40.24 + * questions.
   40.25 + */
   40.26 +
   40.27 +/*
   40.28 + * @test
   40.29 + * @bug 6939620 6894753 7020044
   40.30 + *
   40.31 + * @summary  Diamond and intersection types
   40.32 + * @author mcimadamore
   40.33 + * @compile Pos07.java
   40.34 + *
   40.35 + */
   40.36 +
   40.37 +class Pos07 {
   40.38 +    static class Foo<X extends Number & Comparable<Number>> {}
   40.39 +    static class DoubleFoo<X extends Number & Comparable<Number>,
   40.40 +                           Y extends Number & Comparable<Number>> {}
   40.41 +    static class TripleFoo<X extends Number & Comparable<Number>,
   40.42 +                           Y extends Number & Comparable<Number>,
   40.43 +                           Z> {}
   40.44 +
   40.45 +    Foo<?> fw = new Foo<>();
   40.46 +    DoubleFoo<?,?> dw = new DoubleFoo<>();
   40.47 +    TripleFoo<?,?,?> tw = new TripleFoo<>();
   40.48 +}
    41.1 --- a/test/tools/javac/multicatch/Neg05.java	Mon Mar 07 14:11:48 2011 +0000
    41.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    41.3 @@ -1,33 +0,0 @@
    41.4 -/*
    41.5 - * @test /nodynamiccopyright/
    41.6 - * @bug 6943289
    41.7 - *
    41.8 - * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
    41.9 - * @author mcimadamore
   41.10 - * @compile/fail/ref=Neg05.out -XDrawDiagnostics Neg05.java
   41.11 - *
   41.12 - */
   41.13 -
   41.14 -class Neg02 {
   41.15 -
   41.16 -    static class Foo<X> {
   41.17 -       Foo(X x) {}
   41.18 -    }
   41.19 -
   41.20 -    static interface Base<X> {}
   41.21 -    static class A extends Exception implements Base<String> {}
   41.22 -    static class B extends Exception implements Base<Integer> {}
   41.23 -
   41.24 -    void m() {
   41.25 -        try {
   41.26 -            if (true) {
   41.27 -                throw new A();
   41.28 -            }
   41.29 -            else {
   41.30 -                throw new B();
   41.31 -            }
   41.32 -        } catch (A | B ex) {
   41.33 -            Foo<?> f = new Foo<>(ex);
   41.34 -        }
   41.35 -    }
   41.36 -}
    42.1 --- a/test/tools/javac/multicatch/Neg05.out	Mon Mar 07 14:11:48 2011 +0000
    42.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
    42.3 @@ -1,2 +0,0 @@
    42.4 -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))
    42.5 -1 error
    43.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
    43.2 +++ b/test/tools/javac/multicatch/Pos09.java	Mon Mar 07 14:31:50 2011 +0000
    43.3 @@ -0,0 +1,56 @@
    43.4 +/*
    43.5 + * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    43.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
    43.7 + *
    43.8 + * This code is free software; you can redistribute it and/or modify it
    43.9 + * under the terms of the GNU General Public License version 2 only, as
   43.10 + * published by the Free Software Foundation.
   43.11 + *
   43.12 + * This code is distributed in the hope that it will be useful, but WITHOUT
   43.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
   43.14 + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
   43.15 + * version 2 for more details (a copy is included in the LICENSE file that
   43.16 + * accompanied this code).
   43.17 + *
   43.18 + * You should have received a copy of the GNU General Public License version
   43.19 + * 2 along with this work; if not, write to the Free Software Foundation,
   43.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
   43.21 + *
   43.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
   43.23 + * or visit www.oracle.com if you need additional information or have any
   43.24 + * questions.
   43.25 + */
   43.26 +
   43.27 +/*
   43.28 + * @test
   43.29 + * @bug 6943289 7020044
   43.30 + *
   43.31 + * @summary Project Coin: Improved Exception Handling for Java (aka 'multicatch')
   43.32 + * @author mcimadamore
   43.33 + * @compile Pos09.java
   43.34 + *
   43.35 + */
   43.36 +
   43.37 +class Pos09 {
   43.38 +
   43.39 +    static class Foo<X> {
   43.40 +       Foo(X x) {}
   43.41 +    }
   43.42 +
   43.43 +    static interface Base<X> {}
   43.44 +    static class A extends Exception implements Base<String> {}
   43.45 +    static class B extends Exception implements Base<Integer> {}
   43.46 +
   43.47 +    void m() {
   43.48 +        try {
   43.49 +            if (true) {
   43.50 +                throw new A();
   43.51 +            }
   43.52 +            else {
   43.53 +                throw new B();
   43.54 +            }
   43.55 +        } catch (A | B ex) {
   43.56 +            Foo<?> f = new Foo<>(ex);
   43.57 +        }
   43.58 +    }
   43.59 +}

mercurial