# HG changeset patch # User mcimadamore # Date 1271244209 -3600 # Node ID e2aaa958b02db0029b960b1f36db8d43d33b7135 # Parent 63dc7f367a372a4da786585f215184d87de1499e 6939618: Revert 'simple' diamond implementation Summary: backout changeset for 6840638 Reviewed-by: jjg diff -r 63dc7f367a37 -r e2aaa958b02d langtools/src/share/classes/com/sun/tools/javac/code/Source.java --- a/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Fri Apr 09 15:39:39 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/code/Source.java Wed Apr 14 12:23:29 2010 +0100 @@ -122,9 +122,6 @@ public boolean allowGenerics() { return compareTo(JDK1_5) >= 0; } - public boolean allowDiamond() { - return compareTo(JDK1_7) >= 0; - } public boolean allowEnums() { return compareTo(JDK1_5) >= 0; } diff -r 63dc7f367a37 -r e2aaa958b02d langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Apr 09 15:39:39 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Apr 14 12:23:29 2010 +0100 @@ -207,21 +207,6 @@ return owntype; } - Type checkReturn(JCTree tree, Type owntype, int ownkind, int pkind, Type pt) { - if (owntype.tag != ERROR && pt.tag != METHOD && pt.tag != FORALL) { - if ((ownkind & ~pkind) == 0) { - owntype = chk.checkReturnType(tree.pos(), owntype, pt); - } else { - log.error(tree.pos(), "unexpected.type", - kindNames(pkind), - kindName(ownkind)); - owntype = types.createErrorType(owntype); - } - } - tree.type = owntype; - return owntype; - } - /** Is given blank final variable assignable, i.e. in a scope where it * may be assigned to even though it is final? * @param v The blank final variable. @@ -440,14 +425,7 @@ /** Derived visitor method: attribute a type tree. */ Type attribType(JCTree tree, Env env) { - Type result = attribType(tree, env, Type.noType); - return result; - } - - /** Derived visitor method: attribute a type tree. - */ - Type attribType(JCTree tree, Env env, Type pt) { - Type result = attribTree(tree, env, TYP, pt); + Type result = attribTree(tree, env, TYP, Type.noType); return result; } @@ -1400,7 +1378,7 @@ // Check that value of resulting type is admissible in the // current context. Also, capture the return type - result = checkReturn(tree, capture(restype), VAL, pkind, pt); + result = check(tree, capture(restype), VAL, pkind, pt); } chk.validate(tree.typeargs, localEnv); } @@ -1475,9 +1453,9 @@ // Attribute clazz expression and store // symbol + type back into the attributed tree. - Type clazztype = attribType(clazz, env); + Type clazztype = chk.checkClassType( + tree.clazz.pos(), attribType(clazz, env), true); chk.validate(clazz, localEnv); - clazztype = chk.checkNewClassType(clazz.pos(), clazztype, true, pt); if (tree.encl != null) { // We have to work in this case to store // symbol + type back into the attributed tree. @@ -1582,9 +1560,7 @@ // ... // } if (Resolve.isStatic(env)) cdef.mods.flags |= STATIC; - clazz = TreeInfo.isDiamond(tree) ? - make.Type(clazztype) - : clazz; + if (clazztype.tsym.isInterface()) { cdef.implementing = List.of(clazz); } else { @@ -2571,7 +2547,7 @@ if (clazztype.tag == CLASS) { List formals = clazztype.tsym.type.getTypeArguments(); - if (actuals.length() == formals.length() || actuals.isEmpty()) { + if (actuals.length() == formals.length()) { List a = actuals; List f = formals; while (a.nonEmpty()) { @@ -2597,18 +2573,7 @@ clazzOuter = site; } } - if (actuals.nonEmpty()) { - owntype = new ClassType(clazzOuter, actuals, clazztype.tsym); - } - else if (TreeInfo.isDiamond(tree)) { - //a type apply with no explicit type arguments - diamond operator - //the result type is a forall F where F's tvars are the type-variables - //that will be inferred when F is checked against the expected type - List ftvars = clazztype.tsym.type.getTypeArguments(); - List new_tvars = types.newInstances(ftvars); - clazztype = new ClassType(clazzOuter, new_tvars, clazztype.tsym); - owntype = new ForAll(new_tvars, clazztype); - } + owntype = new ClassType(clazzOuter, actuals, clazztype.tsym); } else { if (formals.length() != 0) { log.error(tree.pos(), "wrong.number.type.args", diff -r 63dc7f367a37 -r e2aaa958b02d langtools/src/share/classes/com/sun/tools/javac/comp/Check.java --- a/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Apr 09 15:39:39 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Apr 14 12:23:29 2010 +0100 @@ -375,6 +375,8 @@ Type checkType(DiagnosticPosition pos, Type found, Type req) { if (req.tag == ERROR) return req; + if (found.tag == FORALL) + return instantiatePoly(pos, (ForAll)found, req, convertWarner(pos, found, req)); if (req.tag == NONE) return found; if (types.isAssignable(found, req, convertWarner(pos, found, req))) @@ -392,33 +394,6 @@ return typeError(pos, diags.fragment("incompatible.types"), found, req); } - Type checkReturnType(DiagnosticPosition pos, Type found, Type req) { - if (found.tag == FORALL) { - try { - return instantiatePoly(pos, (ForAll) found, req, convertWarner(pos, found, req)); - } catch (Infer.NoInstanceException ex) { - if (ex.isAmbiguous) { - JCDiagnostic d = ex.getDiagnostic(); - log.error(pos, - "undetermined.type" + (d != null ? ".1" : ""), - found, d); - return types.createErrorType(req); - } else { - JCDiagnostic d = ex.getDiagnostic(); - return typeError(pos, - diags.fragment("incompatible.types" + (d != null ? ".1" : ""), d), - found, req); - } - } catch (Infer.InvalidInstanceException ex) { - JCDiagnostic d = ex.getDiagnostic(); - log.error(pos, "invalid.inferred.types", ((ForAll)found).tvars, d); - return types.createErrorType(req); - } - } else { - return checkType(pos, found, req); - } - } - /** Instantiate polymorphic type to some prototype, unless * prototype is `anyPoly' in which case polymorphic type * is returned unchanged. @@ -432,9 +407,28 @@ } else if (pt.tag == ERROR) { return pt; } else { - return infer.instantiateExpr(t, pt, warn); + try { + return infer.instantiateExpr(t, pt, warn); + } catch (Infer.NoInstanceException ex) { + if (ex.isAmbiguous) { + JCDiagnostic d = ex.getDiagnostic(); + log.error(pos, + "undetermined.type" + (d!=null ? ".1" : ""), + t, d); + return types.createErrorType(pt); + } else { + JCDiagnostic d = ex.getDiagnostic(); + return typeError(pos, + diags.fragment("incompatible.types" + (d!=null ? ".1" : ""), d), + t, pt); + } + } catch (Infer.InvalidInstanceException ex) { + JCDiagnostic d = ex.getDiagnostic(); + log.error(pos, "invalid.inferred.types", t.tvars, d); + return types.createErrorType(pt); + } } - } + } /** Check that a given type can be cast to a given target type. * Return the result of the cast. @@ -557,29 +551,6 @@ return t; } - /** Check that type is a valid type for a new expression. If the type contains - * some uninferred type variables, instantiate them exploiting the expected - * type. - * - * @param pos Position to be used for error reporting. - * @param t The type to be checked. - * @param noBounds True if type bounds are illegal here. - * @param pt Expected type (used with diamond operator) - */ - Type checkNewClassType(DiagnosticPosition pos, Type t, boolean noBounds, Type pt) { - if (t.tag == FORALL) { - try { - t = instantiatePoly(pos, (ForAll)t, pt, Warner.noWarnings); - } - catch (Infer.NoInstanceException ex) { - JCDiagnostic d = ex.getDiagnostic(); - log.error(pos, "cant.apply.diamond", t.getTypeArguments(), d); - return types.createErrorType(pt); - } - } - return checkClassType(pos, t, noBounds); - } - /** Check that type is a reifiable class, interface or array type. * @param pos Position to be used for error reporting. * @param t The type to be checked. @@ -936,8 +907,7 @@ } checkCapture(tree); - } - if (tree.type.tag == CLASS || tree.type.tag == FORALL) { + // Check that this type is either fully parameterized, or // not parameterized at all. if (tree.type.getEnclosingType().isRaw()) diff -r 63dc7f367a37 -r e2aaa958b02d langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java --- a/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Fri Apr 09 15:39:39 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Apr 14 12:23:29 2010 +0100 @@ -131,7 +131,6 @@ this.allowForeach = source.allowForeach(); this.allowStaticImport = source.allowStaticImport(); this.allowAnnotations = source.allowAnnotations(); - this.allowDiamond = source.allowDiamond(); this.allowTypeAnnotations = source.allowTypeAnnotations(); this.keepDocComments = keepDocComments; if (keepDocComments) @@ -149,10 +148,6 @@ */ boolean allowGenerics; - /** Switch: Should diamond operator be recognized? - */ - boolean allowDiamond; - /** Switch: Should varargs be recognized? */ boolean allowVarargs; @@ -199,7 +194,6 @@ static final int TYPE = 2; static final int NOPARAMS = 4; static final int TYPEARG = 8; - static final int DIAMOND = 16; /** The current mode. */ @@ -1349,11 +1343,6 @@ ListBuffer args = lb(); if (S.token() == LT) { S.nextToken(); - if (S.token() == GT && (mode & DIAMOND) != 0) { - checkDiamond(); - S.nextToken(); - return List.nil(); - } args.append(((mode & EXPR) == 0) ? typeArgument() : parseType()); while (S.token() == COMMA) { S.nextToken(); @@ -1527,7 +1516,7 @@ t = F.AnnotatedType(newAnnotations, t); int oldmode = mode; - mode = TYPE | DIAMOND; + mode = TYPE; if (S.token() == LT) { checkGenerics(); t = typeArguments(t); @@ -1580,11 +1569,8 @@ JCExpression innerCreator(int newpos, List typeArgs, JCExpression encl) { JCExpression t = toP(F.at(S.pos()).Ident(ident())); if (S.token() == LT) { - int oldmode = mode; - mode |= DIAMOND; checkGenerics(); t = typeArguments(t); - mode = oldmode; } return classCreatorRest(newpos, encl, typeArgs, t); } @@ -3151,12 +3137,6 @@ } } - void checkDiamond() { - if (!allowDiamond) { - log.error(S.pos(), "diamond.not.supported.in.source", source.name); - allowDiamond = true; - } - } void checkGenerics() { if (!allowGenerics) { log.error(S.pos(), "generics.not.supported.in.source", source.name); diff -r 63dc7f367a37 -r e2aaa958b02d langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties --- a/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Apr 09 15:39:39 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/resources/compiler.properties Wed Apr 14 12:23:29 2010 +0100 @@ -1082,10 +1082,6 @@ symbol: {0} <{2}>{1}({3})\n\ location: {4} {5} -compiler.err.cant.apply.diamond=\ - diamond operator cannot infer types for {0};\n\ - reason: {1} - ## The following are all possible string for "kindname". ## They should be called whatever the JLS calls them after it been translated ## to the appropriate language. @@ -1227,10 +1223,6 @@ enums are not supported in -source {0}\n\ (use -source 5 or higher to enable enums) -compiler.err.diamond.not.supported.in.source=\ - diamond operator is not supported in -source {0}\n\ -(use -source 7 or higher to enable diamond operator) - compiler.err.string.switch.not.supported.in.source=\ strings in switch are not supported in -source {0}\n\ (use -source 7 or higher to enable strings in switch) diff -r 63dc7f367a37 -r e2aaa958b02d langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java --- a/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Fri Apr 09 15:39:39 2010 -0700 +++ b/langtools/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Apr 14 12:23:29 2010 +0100 @@ -204,15 +204,6 @@ return (JCMethodInvocation)exec.expr; } - /** Return true if a tree represents a diamond new expr. */ - public static boolean isDiamond(JCTree tree) { - switch(tree.getTag()) { - case JCTree.TYPEAPPLY: return ((JCTypeApply)tree).getTypeArguments().isEmpty(); - case JCTree.NEWCLASS: return isDiamond(((JCNewClass)tree).clazz); - default: return false; - } - } - /** Return true if a tree represents the null literal. */ public static boolean isNull(JCTree tree) { if (tree.getTag() != JCTree.LITERAL) diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/neg/Neg01.java --- a/langtools/test/tools/javac/generics/diamond/neg/Neg01.java Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * @test /nodynamiccopyright/ - * @bug 6840638 - * - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') - * @author mcimadamore - * @compile/fail/ref=Neg01.out Neg01.java -source 1.7 -XDrawDiagnostics - * - */ - -class Neg01 { - - Neg01(X x) {} - - Neg01(X x, Z z) {} - - void test() { - Neg01 n1 = new Neg01<>(""); //new Foo created - Neg01 n2 = new Neg01<>(""); //new Foo created - Neg01 n3 = new Neg01<>(""); //new Foo created - Neg01 n4 = new Neg01<>(""); //new Foo created - - Neg01 n5 = new Neg01<>(""){}; //new Foo created - Neg01 n6 = new Neg01<>(""){}; //new Foo created - Neg01 n7 = new Neg01<>(""){}; //new Foo created - Neg01 n8 = new Neg01<>(""){}; //new Foo created - - Neg01 n9 = new Neg01<>("", ""); //new Foo created - Neg01 n10 = new Neg01<>("", ""); //new Foo created - Neg01 n11 = new Neg01<>("", ""); //new Foo created - Foo n12 = new Neg01<>("", ""); //new Foo created - - Neg01 n13 = new Neg01<>("", ""){}; //new Foo created - Neg01 n14 = new Neg01<>("", ""){}; //new Foo created - Neg01 n15 = new Neg01<>("", ""){}; //new Foo created - Neg01 n16 = new Neg01<>("", ""){}; //new Foo created - } -} diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/neg/Neg01.out --- a/langtools/test/tools/javac/generics/diamond/neg/Neg01.out Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String -Neg01.java:18:37: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01, Neg01) -Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String -Neg01.java:19:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg01.java:20:23: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String, kindname.class, Neg01 -Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String -Neg01.java:21:45: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01, Neg01) -Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String -Neg01.java:23:37: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01, Neg01) -Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String -Neg01.java:24:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg01.java:25:23: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String, kindname.class, Neg01 -Neg01.java:25:38: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , , kindname.class, Neg01 -Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String -Neg01.java:26:45: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01, Neg01) -Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String -Neg01.java:28:37: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01, Neg01) -Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String -Neg01.java:29:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg01.java:30:24: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String,java.lang.String, kindname.class, Neg01 -Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , kindname.class, Neg01 -Neg01.java:31:35: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String,java.lang.String, kindname.class, Neg01 -Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String -Neg01.java:33:38: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01, Neg01) -Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String -Neg01.java:34:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg01.java:35:24: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String,java.lang.String, kindname.class, Neg01 -Neg01.java:35:43: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , , kindname.class, Neg01 -Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String -Neg01.java:36:46: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01, Neg01) -30 errors diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/neg/Neg02.java --- a/langtools/test/tools/javac/generics/diamond/neg/Neg02.java Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - * @test /nodynamiccopyright/ - * @bug 6840638 - * - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') - * @author mcimadamore - * @compile/fail/ref=Neg02.out Neg02.java -source 1.7 -XDrawDiagnostics - * - */ - -class Neg02 { - - static class Foo { - Foo(X x) {} - Foo(X x, Z z) {} - } - - void testSimple() { - Foo f1 = new Foo<>(""); //new Foo created - Foo f2 = new Foo<>(""); //new Foo created - Foo f3 = new Foo<>(""); //new Foo created - Foo f4 = new Foo<>(""); //new Foo created - - Foo f5 = new Foo<>(""){}; //new Foo created - Foo f6 = new Foo<>(""){}; //new Foo created - Foo f7 = new Foo<>(""){}; //new Foo created - Foo f8 = new Foo<>(""){}; //new Foo created - - Foo f9 = new Foo<>("", ""); //new Foo created - Foo f10 = new Foo<>("", ""); //new Foo created - Foo f11 = new Foo<>("", ""); //new Foo created - Foo f12 = new Foo<>("", ""); //new Foo created - - Foo f13 = new Foo<>("", ""){}; //new Foo created - Foo f14 = new Foo<>("", ""){}; //new Foo created - Foo f15 = new Foo<>("", ""){}; //new Foo created - Foo f16 = new Foo<>("", ""){}; //new Foo created - } - - void testQualified() { - Foo f1 = new Neg02.Foo<>(""); //new Foo created - Foo f2 = new Neg02.Foo<>(""); //new Foo created - Foo f3 = new Neg02.Foo<>(""); //new Foo created - Foo f4 = new Neg02.Foo<>(""); //new Foo created - - Foo f5 = new Neg02.Foo<>(""){}; //new Foo created - Foo f6 = new Neg02.Foo<>(""){}; //new Foo created - Foo f7 = new Neg02.Foo<>(""){}; //new Foo created - Foo f8 = new Neg02.Foo<>(""){}; //new Foo created - - Foo f9 = new Neg02.Foo<>("", ""); //new Foo created - Foo f10 = new Neg02.Foo<>("", ""); //new Foo created - Foo f11 = new Neg02.Foo<>("", ""); //new Foo created - Foo f12 = new Neg02.Foo<>("", ""); //new Foo created - - Foo f13 = new Neg02.Foo<>("", ""){}; //new Foo created - Foo f14 = new Neg02.Foo<>("", ""){}; //new Foo created - Foo f15 = new Neg02.Foo<>("", ""){}; //new Foo created - Foo f16 = new Neg02.Foo<>("", ""){}; //new Foo created - } -} diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/neg/Neg02.out --- a/langtools/test/tools/javac/generics/diamond/neg/Neg02.out Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String -Neg02.java:19:33: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg02.java:20:43: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg02.java:21:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo -Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg02.java:22:41: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String -Neg02.java:24:33: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg02.java:25:43: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg02.java:26:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo -Neg02.java:26:34: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo -Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg02.java:27:41: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String -Neg02.java:29:33: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg02.java:30:44: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg02.java:31:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo -Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg02.java:32:42: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String -Neg02.java:34:34: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg02.java:35:44: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg02.java:36:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo -Neg02.java:36:39: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo -Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg02.java:37:42: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String -Neg02.java:41:39: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg02.java:42:49: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg02.java:43:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo -Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg02.java:44:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String -Neg02.java:46:39: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg02.java:47:49: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg02.java:48:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo -Neg02.java:48:40: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo -Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg02.java:49:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String -Neg02.java:51:39: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg02.java:52:50: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg02.java:53:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo -Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg02.java:54:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String -Neg02.java:56:40: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg02.java:57:50: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) -Neg02.java:58:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo -Neg02.java:58:45: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo -Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg02.java:59:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo, Neg02.Foo) -60 errors diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/neg/Neg03.java --- a/langtools/test/tools/javac/generics/diamond/neg/Neg03.java Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,83 +0,0 @@ -/* - * @test /nodynamiccopyright/ - * @bug 6840638 - * - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') - * @author mcimadamore - * @compile/fail/ref=Neg03.out Neg03.java -source 1.7 -XDrawDiagnostics - * - */ - -class Neg03 { - - class Foo { - Foo(V x) {} - Foo(V x, Z z) {} - } - - void testSimple() { - Foo f1 = new Foo<>(""); //new Foo created - Foo f2 = new Foo<>(""); //new Foo created - Foo f3 = new Foo<>(""); //new Foo created - Foo f4 = new Foo<>(""); //new Foo created - - Foo f5 = new Foo<>(""){}; //new Foo created - Foo f6 = new Foo<>(""){}; //new Foo created - Foo f7 = new Foo<>(""){}; //new Foo created - Foo f8 = new Foo<>(""){}; //new Foo created - - Foo f9 = new Foo<>("", ""); //new Foo created - Foo f10 = new Foo<>("", ""); //new Foo created - Foo f11 = new Foo<>("", ""); //new Foo created - Foo f12 = new Foo<>("", ""); //new Foo created - - Foo f13 = new Foo<>("", ""){}; //new Foo created - Foo f14 = new Foo<>("", ""){}; //new Foo created - Foo f15 = new Foo<>("", ""){}; //new Foo created - Foo f16 = new Foo<>("", ""){}; //new Foo created - } - - void testQualified_1() { - Foo f1 = new Neg03.Foo<>(""); //new Foo created - Foo f2 = new Neg03.Foo<>(""); //new Foo created - Foo f3 = new Neg03.Foo<>(""); //new Foo created - Foo f4 = new Neg03.Foo<>(""); //new Foo created - - Foo f5 = new Neg03.Foo<>(""){}; //new Foo created - Foo f6 = new Neg03.Foo<>(""){}; //new Foo created - Foo f7 = new Neg03.Foo<>(""){}; //new Foo created - Foo f8 = new Neg03.Foo<>(""){}; //new Foo created - - Foo f9 = new Neg03.Foo<>("", ""); //new Foo created - Foo f10 = new Neg03.Foo<>("", ""); //new Foo created - Foo f11 = new Neg03.Foo<>("", ""); //new Foo created - Foo f12 = new Neg03.Foo<>("", ""); //new Foo created - - Foo f13 = new Neg03.Foo<>("", ""){}; //new Foo created - Foo f14 = new Neg03.Foo<>("", ""){}; //new Foo created - Foo f15 = new Neg03.Foo<>("", ""){}; //new Foo created - Foo f16 = new Neg03.Foo<>("", ""){}; //new Foo created - } - - void testQualified_2(Neg03 n) { - Foo f1 = n.new Foo<>(""); //new Foo created - Foo f2 = n.new Foo<>(""); //new Foo created - Foo f3 = n.new Foo<>(""); //new Foo created - Foo f4 = n.new Foo<>(""); //new Foo created - - Foo f5 = n.new Foo<>(""){}; //new Foo created - Foo f6 = n.new Foo<>(""){}; //new Foo created - Foo f7 = n.new Foo<>(""){}; //new Foo created - Foo f8 = n.new Foo<>(""){}; //new Foo created - - Foo f9 = n.new Foo<>("", ""); //new Foo created - Foo f10 = n.new Foo<>("", ""); //new Foo created - Foo f11 = n.new Foo<>("", ""); //new Foo created - Foo f12 = n.new Foo<>("", ""); //new Foo created - - Foo f13 = n.new Foo<>("", ""){}; //new Foo created - Foo f14 = n.new Foo<>("", ""){}; //new Foo created - Foo f15 = n.new Foo<>("", ""){}; //new Foo created - Foo f16 = n.new Foo<>("", ""){}; //new Foo created - } -} diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/neg/Neg03.out --- a/langtools/test/tools/javac/generics/diamond/neg/Neg03.out Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:19:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:20:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:21:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03.Foo -Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:22:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:24:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:25:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:26:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03.Foo -Neg03.java:26:34: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03.Foo -Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:27:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:29:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:30:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:31:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03.Foo -Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:32:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:34:34: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:35:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:36:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03.Foo -Neg03.java:36:39: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03.Foo -Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:37:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:41:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:42:52: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:43:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03.Foo -Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:44:50: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:46:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:47:52: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:48:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03.Foo -Neg03.java:48:43: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03.Foo -Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:49:50: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:51:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:52:53: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:53:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03.Foo -Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:54:51: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:56:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:57:53: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:58:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03.Foo -Neg03.java:58:48: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03.Foo -Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:59:51: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:63:28: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:64:38: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:65:23: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03.Foo -Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:66:36: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:68:28: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:69:38: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:70:23: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03.Foo -Neg03.java:70:36: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03.Foo -Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:71:36: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:73:28: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:74:39: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:75:24: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03.Foo -Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:76:37: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String -Neg03.java:78:29: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg03.java:79:39: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg03.java:80:24: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03.Foo -Neg03.java:80:41: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03.Foo -Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg03.java:81:37: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03.Foo, Neg03.Foo) -90 errors diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/neg/Neg04.java --- a/langtools/test/tools/javac/generics/diamond/neg/Neg04.java Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,38 +0,0 @@ -/* - * @test /nodynamiccopyright/ - * @bug 6840638 - * - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') - * @author mcimadamore - * @compile/fail/ref=Neg04.out Neg04.java -source 1.7 -XDrawDiagnostics - * - */ - -class Neg04 { - - void test() { - class Foo { - Foo(V x) {} - Foo(V x, Z z) {} - } - Foo n1 = new Foo<>(""); //new Foo created - Foo n2 = new Foo<>(""); //new Foo created - Foo n3 = new Foo<>(""); //new Foo created - Foo n4 = new Foo<>(""); //new Foo created - - Foo n5 = new Foo<>(""){}; //new Foo created - Foo n6 = new Foo<>(""){}; //new Foo created - Foo n7 = new Foo<>(""){}; //new Foo created - Foo n8 = new Foo<>(""){}; //new Foo created - - Foo n9 = new Foo<>("", ""); //new Foo created - Foo n10 = new Foo<>("", ""); //new Foo created - Foo n11 = new Foo<>("", ""); //new Foo created - Foo n12 = new Foo<>("", ""); //new Foo created - - Foo n13 = new Foo<>("", ""){}; //new Foo created - Foo n14 = new Foo<>("", ""){}; //new Foo created - Foo n15 = new Foo<>("", ""){}; //new Foo created - Foo n16 = new Foo<>("", ""){}; //new Foo created - } -} diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/neg/Neg04.out --- a/langtools/test/tools/javac/generics/diamond/neg/Neg04.out Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,31 +0,0 @@ -Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String -Neg04.java:18:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo, Foo) -Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg04.java:19:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg04.java:20:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Foo -Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg04.java:21:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo, Foo) -Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String -Neg04.java:23:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo, Foo) -Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg04.java:24:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg04.java:25:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Foo -Neg04.java:25:34: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Foo -Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg04.java:26:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo, Foo) -Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String -Neg04.java:28:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo, Foo) -Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg04.java:29:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg04.java:30:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Foo -Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg04.java:31:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo, Foo) -Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String -Neg04.java:33:34: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo, Foo) -Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String -Neg04.java:34:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) -Neg04.java:35:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Foo -Neg04.java:35:39: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Foo -Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String -Neg04.java:36:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo, Foo) -30 errors diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/neg/Neg05.java --- a/langtools/test/tools/javac/generics/diamond/neg/Neg05.java Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -/* - * @test /nodynamiccopyright/ - * @bug 6840638 - * - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') - * @author mcimadamore - * @compile/fail/ref=Neg05.out Neg05.java -source 1.7 -XDrawDiagnostics - * - */ - -class Neg05 { - - class Foo { - Foo(V x) {} - Foo(V x, Z z) {} - } - - void testRare_1() { - Neg05.Foo f1 = new Neg05.Foo<>(""); //new Foo created - Neg05.Foo f2 = new Neg05.Foo<>(""); //new Foo created - Neg05.Foo f3 = new Neg05.Foo<>(""); //new Foo created - Neg05.Foo f4 = new Neg05.Foo<>(""); //new Foo created - - Neg05.Foo f5 = new Neg05.Foo<>(""){}; //new Foo created - Neg05.Foo f6 = new Neg05.Foo<>(""){}; //new Foo created - Neg05.Foo f7 = new Neg05.Foo<>(""){}; //new Foo created - Neg05.Foo f8 = new Neg05.Foo<>(""){}; //new Foo created - - Neg05.Foo f9 = new Neg05.Foo<>("", ""); //new Foo created - Neg05.Foo f10 = new Neg05.Foo<>("", ""); //new Foo created - Neg05.Foo f11 = new Neg05.Foo<>("", ""); //new Foo created - Neg05.Foo f12 = new Neg05.Foo<>("", ""); //new Foo created - - Neg05.Foo f13 = new Neg05.Foo<>("", ""){}; //new Foo created - Neg05.Foo f14 = new Neg05.Foo<>("", ""){}; //new Foo created - Neg05.Foo f15 = new Neg05.Foo<>("", ""){}; //new Foo created - Neg05.Foo f16 = new Neg05.Foo<>("", ""){}; //new Foo created - } - - void testRare_2(Neg05 n) { - Neg05.Foo f1 = n.new Foo<>(""); //new Foo created - Neg05.Foo f2 = n.new Foo<>(""); //new Foo created - Neg05.Foo f3 = n.new Foo<>(""); //new Foo created - Neg05.Foo f4 = n.new Foo<>(""); //new Foo created - - Neg05.Foo f5 = n.new Foo<>(""){}; //new Foo created - Neg05.Foo f6 = n.new Foo<>(""){}; //new Foo created - Neg05.Foo f7 = n.new Foo<>(""){}; //new Foo created - Neg05.Foo f8 = n.new Foo<>(""){}; //new Foo created - - Neg05.Foo f9 = n.new Foo<>("", ""); //new Foo created - Neg05.Foo f10 = n.new Foo<>("", ""); //new Foo created - Neg05.Foo f11 = n.new Foo<>("", ""); //new Foo created - Neg05.Foo f12 = n.new Foo<>("", ""); //new Foo created - - Neg05.Foo f13 = n.new Foo<>("", ""){}; //new Foo created - Neg05.Foo f14 = n.new Foo<>("", ""){}; //new Foo created - Neg05.Foo f15 = n.new Foo<>("", ""){}; //new Foo created - Neg05.Foo f16 = n.new Foo<>("", ""){}; //new Foo created - } -} diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/neg/Neg05.out --- a/langtools/test/tools/javac/generics/diamond/neg/Neg05.out Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,33 +0,0 @@ -Neg05.java:19:48: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:20:58: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:21:43: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:22:56: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:24:48: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:25:58: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:26:43: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:27:56: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:29:48: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:30:59: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:31:44: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:32:57: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:34:49: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:35:59: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:36:44: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:37:57: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:41:37: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:42:47: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:43:32: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:44:45: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:46:37: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:47:47: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:48:32: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:49:45: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:51:37: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:52:48: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:53:33: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:54:46: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:56:38: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:57:48: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:58:33: compiler.err.improperly.formed.type.inner.raw.param -Neg05.java:59:46: compiler.err.improperly.formed.type.inner.raw.param -32 errors diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/pos/Pos01.java --- a/langtools/test/tools/javac/generics/diamond/pos/Pos01.java Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * @test /nodynamiccopyright/ - * @bug 6840638 - * - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') - * @author mcimadamore - * @compile Pos01.java -source 1.7 - * @run main Pos01 - * - */ - -public class Pos01 { - - Pos01(X x) {} - - Pos01(X x, Z z) {} - - void test() { - Pos01 p1 = new Pos01<>(1); //new Foo created - Pos01 p2 = new Pos01<>(1); //new Foo created - Pos01 p3 = new Pos01<>(1); //new Foo created - Pos01 p4 = new Pos01<>(1); //new Foo created - - Pos01 p5 = new Pos01<>(1){}; //new Foo created - Pos01 p6 = new Pos01<>(1){}; //new Foo created - Pos01 p7 = new Pos01<>(1){}; //new Foo created - Pos01 p8 = new Pos01<>(1){}; //new Foo created - - Pos01 p9 = new Pos01<>(1, ""); //new Foo created - Pos01 p10 = new Pos01<>(1, ""); //new Foo created - Pos01 p11 = new Pos01<>(1, ""); //new Foo created - Pos01 p12 = new Pos01<>(1, ""); //new Foo created - - Pos01 p13 = new Pos01<>(1, ""){}; //new Foo created - Pos01 p14= new Pos01<>(1, ""){}; //new Foo created - Pos01 p15 = new Pos01<>(1, ""){}; //new Foo created - Pos01 p16 = new Pos01<>(1, ""){}; //new Foo created - } - - public static void main(String[] args) { - Pos01 p1 = new Pos01<>(""); - p1.test(); - } -} diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/pos/Pos02.java --- a/langtools/test/tools/javac/generics/diamond/pos/Pos02.java Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,67 +0,0 @@ -/* - * @test /nodynamiccopyright/ - * @bug 6840638 - * - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') - * @author mcimadamore - * @compile Pos02.java -source 1.7 - * @run main Pos02 - */ - -public class Pos02 { - - static class Foo { - Foo(X x) {} - Foo(X x, Z z) {} - } - - void testSimple() { - Foo f1 = new Foo<>(1); //new Foo created - Foo f2 = new Foo<>(1); //new Foo created - Foo f3 = new Foo<>(1); //new Foo created - Foo f4 = new Foo<>(1); //new Foo created - - Foo f5 = new Foo<>(1){}; //new Foo created - Foo f6 = new Foo<>(1){}; //new Foo created - Foo f7 = new Foo<>(1){}; //new Foo created - Foo f8 = new Foo<>(1){}; //new Foo created - - Foo f9 = new Foo<>(1, ""); //new Foo created - Foo f10 = new Foo<>(1, ""); //new Foo created - Foo f11 = new Foo<>(1, ""); //new Foo created - Foo f12 = new Foo<>(1, ""); //new Foo created - - Foo f13 = new Foo<>(1, ""){}; //new Foo created - Foo f14 = new Foo<>(1, ""){}; //new Foo created - Foo f15 = new Foo<>(1, ""){}; //new Foo created - Foo f16 = new Foo<>(1, ""){}; //new Foo created - } - - void testQualified() { - Foo f1 = new Pos02.Foo<>(1); //new Foo created - Foo f2 = new Pos02.Foo<>(1); //new Foo created - Foo f3 = new Pos02.Foo<>(1); //new Foo created - Foo f4 = new Pos02.Foo<>(1); //new Foo created - - Foo f5 = new Pos02.Foo<>(1){}; //new Foo created - Foo f6 = new Pos02.Foo<>(1){}; //new Foo created - Foo f7 = new Pos02.Foo<>(1){}; //new Foo created - Foo f8 = new Pos02.Foo<>(1){}; //new Foo created - - Foo f9 = new Pos02.Foo<>(1, ""); //new Foo created - Foo f10 = new Pos02.Foo<>(1, ""); //new Foo created - Foo f11 = new Pos02.Foo<>(1, ""); //new Foo created - Foo f12 = new Pos02.Foo<>(1, ""); //new Foo created - - Foo f13 = new Pos02.Foo<>(1, ""){}; //new Foo created - Foo f14 = new Pos02.Foo<>(1, ""){}; //new Foo created - Foo f15 = new Pos02.Foo<>(1, ""){}; //new Foo created - Foo f16 = new Pos02.Foo<>(1, ""){}; //new Foo created - } - - public static void main(String[] args) { - Pos02 p2 = new Pos02(); - p2.testSimple(); - p2.testQualified(); - } -} diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/pos/Pos03.java --- a/langtools/test/tools/javac/generics/diamond/pos/Pos03.java Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,91 +0,0 @@ -/* - * @test /nodynamiccopyright/ - * @bug 6840638 - * - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') - * @author mcimadamore - * @compile Pos03.java -source 1.7 - * @run main Pos03 - * - */ - -public class Pos03 { - - class Foo { - Foo(V x) {} - Foo(V x, Z z) {} - } - - void testSimple() { - Foo f1 = new Foo<>(1); //new Foo created - Foo f2 = new Foo<>(1); //new Foo created - Foo f3 = new Foo<>(1); //new Foo created - Foo f4 = new Foo<>(1); //new Foo created - - Foo f5 = new Foo<>(1){}; //new Foo created - Foo f6 = new Foo<>(1){}; //new Foo created - Foo f7 = new Foo<>(1){}; //new Foo created - Foo f8 = new Foo<>(1){}; //new Foo created - - Foo f9 = new Foo<>(1, ""); //new Foo created - Foo f10 = new Foo<>(1, ""); //new Foo created - Foo f11 = new Foo<>(1, ""); //new Foo created - Foo f12 = new Foo<>(1, ""); //new Foo created - - Foo f13 = new Foo<>(1, ""){}; //new Foo created - Foo f14 = new Foo<>(1, ""){}; //new Foo created - Foo f15 = new Foo<>(1, ""){}; //new Foo created - Foo f16 = new Foo<>(1, ""){}; //new Foo created - } - - void testQualified_1() { - Foo f1 = new Pos03.Foo<>(1); //new Foo created - Foo f2 = new Pos03.Foo<>(1); //new Foo created - Foo f3 = new Pos03.Foo<>(1); //new Foo created - Foo f4 = new Pos03.Foo<>(1); //new Foo created - - Foo f5 = new Pos03.Foo<>(1){}; //new Foo created - Foo f6 = new Pos03.Foo<>(1){}; //new Foo created - Foo f7 = new Pos03.Foo<>(1){}; //new Foo created - Foo f8 = new Pos03.Foo<>(1){}; //new Foo created - - Foo f9 = new Pos03.Foo<>(1, ""); //new Foo created - Foo f10 = new Pos03.Foo<>(1, ""); //new Foo created - Foo f11 = new Pos03.Foo<>(1, ""); //new Foo created - Foo f12 = new Pos03.Foo<>(1, ""); //new Foo created - - Foo f13 = new Pos03.Foo<>(1, ""){}; //new Foo created - Foo f14 = new Pos03.Foo<>(1, ""){}; //new Foo created - Foo f15 = new Pos03.Foo<>(1, ""){}; //new Foo created - Foo f16 = new Pos03.Foo<>(1, ""){}; //new Foo created - } - - void testQualified_2(Pos03 p) { - Foo f1 = p.new Foo<>(1); //new Foo created - Foo f2 = p.new Foo<>(1); //new Foo created - Foo f3 = p.new Foo<>(1); //new Foo created - Foo f4 = p.new Foo<>(1); //new Foo created - - Foo f5 = p.new Foo<>(1){}; //new Foo created - Foo f6 = p.new Foo<>(1){}; //new Foo created - Foo f7 = p.new Foo<>(1){}; //new Foo created - Foo f8 = p.new Foo<>(1){}; //new Foo created - - Foo f9 = p.new Foo<>(1, ""); //new Foo created - Foo f10 = p.new Foo<>(1, ""); //new Foo created - Foo f11 = p.new Foo<>(1, ""); //new Foo created - Foo f12 = p.new Foo<>(1, ""); //new Foo created - - Foo f13 = p.new Foo<>(1, ""){}; //new Foo created - Foo f14 = p.new Foo<>(1, ""){}; //new Foo created - Foo f15 = p.new Foo<>(1, ""){}; //new Foo created - Foo f16 = p.new Foo<>(1, ""){}; //new Foo created - } - - public static void main(String[] args) { - Pos03 p3 = new Pos03<>(); - p3.testSimple(); - p3.testQualified_1(); - p3.testQualified_2(p3); - } -} diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/generics/diamond/pos/Pos04.java --- a/langtools/test/tools/javac/generics/diamond/pos/Pos04.java Fri Apr 09 15:39:39 2010 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,44 +0,0 @@ -/* - * @test /nodynamiccopyright/ - * @bug 6840638 - * - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') - * @author mcimadamore - * @compile Pos04.java -source 1.7 - * @run main Pos04 - * - */ - -public class Pos04 { - - void test() { - class Foo { - Foo(V x) {} - Foo(V x, Z z) {} - } - Foo p1 = new Foo<>(1); //new Foo created - Foo p2 = new Foo<>(1); //new Foo created - Foo p3 = new Foo<>(1); //new Foo created - Foo p4 = new Foo<>(1); //new Foo created - - Foo p5 = new Foo<>(1){}; //new Foo created - Foo p6 = new Foo<>(1){}; //new Foo created - Foo p7 = new Foo<>(1){}; //new Foo created - Foo p8 = new Foo<>(1){}; //new Foo created - - Foo p9 = new Foo<>(1, ""); //new Foo created - Foo p10 = new Foo<>(1, ""); //new Foo created - Foo p11 = new Foo<>(1, ""); //new Foo created - Foo p12 = new Foo<>(1, ""); //new Foo created - - Foo p13 = new Foo<>(1, ""){}; //new Foo created - Foo p14 = new Foo<>(1, ""){}; //new Foo created - Foo p15 = new Foo<>(1, ""){}; //new Foo created - Foo p16 = new Foo<>(1, ""){}; //new Foo created - } - - public static void main(String[] args) { - Pos04 p4 = new Pos04<>(); - p4.test(); - } -} diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java --- a/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java Fri Apr 09 15:39:39 2010 -0700 +++ b/langtools/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java Wed Apr 14 12:23:29 2010 +0100 @@ -89,7 +89,7 @@ // Verify that the annotation information is as // expected. - Set expectedNames = new HashSet<>(Arrays.asList(annotatedElementInfo.names())); + Set expectedNames = new HashSet(Arrays.asList(annotatedElementInfo.names())); resultsMeta = roundEnvironment. diff -r 63dc7f367a37 -r e2aaa958b02d langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java --- a/langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java Fri Apr 09 15:39:39 2010 -0700 +++ b/langtools/test/tools/javac/processing/model/element/TestAnonClassNames.java Wed Apr 14 12:23:29 2010 +0100 @@ -113,10 +113,10 @@ */ static void testClassName(String className) { JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler(); - List classNames = new ArrayList<>(); + List classNames = new ArrayList(); classNames.add(className); - List options = new ArrayList<>(); + List options = new ArrayList(); options.add("-proc:only"); options.add("-classpath"); options.add(System.getProperty("test.classes")); @@ -128,7 +128,7 @@ options, classNames, null); // Sources - List processors = new ArrayList<>(); + List processors = new ArrayList(); processors.add(new ClassNameProber()); compileTask.setProcessors(processors); Boolean goodResult = compileTask.call();