Wed, 14 Apr 2010 12:23:29 +0100
6939618: Revert 'simple' diamond implementation
Summary: backout changeset for 6840638
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/javac/code/Source.java Fri Apr 09 15:39:39 2010 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Source.java Wed Apr 14 12:23:29 2010 +0100 1.3 @@ -122,9 +122,6 @@ 1.4 public boolean allowGenerics() { 1.5 return compareTo(JDK1_5) >= 0; 1.6 } 1.7 - public boolean allowDiamond() { 1.8 - return compareTo(JDK1_7) >= 0; 1.9 - } 1.10 public boolean allowEnums() { 1.11 return compareTo(JDK1_5) >= 0; 1.12 }
2.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Fri Apr 09 15:39:39 2010 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed Apr 14 12:23:29 2010 +0100 2.3 @@ -207,21 +207,6 @@ 2.4 return owntype; 2.5 } 2.6 2.7 - Type checkReturn(JCTree tree, Type owntype, int ownkind, int pkind, Type pt) { 2.8 - if (owntype.tag != ERROR && pt.tag != METHOD && pt.tag != FORALL) { 2.9 - if ((ownkind & ~pkind) == 0) { 2.10 - owntype = chk.checkReturnType(tree.pos(), owntype, pt); 2.11 - } else { 2.12 - log.error(tree.pos(), "unexpected.type", 2.13 - kindNames(pkind), 2.14 - kindName(ownkind)); 2.15 - owntype = types.createErrorType(owntype); 2.16 - } 2.17 - } 2.18 - tree.type = owntype; 2.19 - return owntype; 2.20 - } 2.21 - 2.22 /** Is given blank final variable assignable, i.e. in a scope where it 2.23 * may be assigned to even though it is final? 2.24 * @param v The blank final variable. 2.25 @@ -440,14 +425,7 @@ 2.26 /** Derived visitor method: attribute a type tree. 2.27 */ 2.28 Type attribType(JCTree tree, Env<AttrContext> env) { 2.29 - Type result = attribType(tree, env, Type.noType); 2.30 - return result; 2.31 - } 2.32 - 2.33 - /** Derived visitor method: attribute a type tree. 2.34 - */ 2.35 - Type attribType(JCTree tree, Env<AttrContext> env, Type pt) { 2.36 - Type result = attribTree(tree, env, TYP, pt); 2.37 + Type result = attribTree(tree, env, TYP, Type.noType); 2.38 return result; 2.39 } 2.40 2.41 @@ -1400,7 +1378,7 @@ 2.42 2.43 // Check that value of resulting type is admissible in the 2.44 // current context. Also, capture the return type 2.45 - result = checkReturn(tree, capture(restype), VAL, pkind, pt); 2.46 + result = check(tree, capture(restype), VAL, pkind, pt); 2.47 } 2.48 chk.validate(tree.typeargs, localEnv); 2.49 } 2.50 @@ -1475,9 +1453,9 @@ 2.51 2.52 // Attribute clazz expression and store 2.53 // symbol + type back into the attributed tree. 2.54 - Type clazztype = attribType(clazz, env); 2.55 + Type clazztype = chk.checkClassType( 2.56 + tree.clazz.pos(), attribType(clazz, env), true); 2.57 chk.validate(clazz, localEnv); 2.58 - clazztype = chk.checkNewClassType(clazz.pos(), clazztype, true, pt); 2.59 if (tree.encl != null) { 2.60 // We have to work in this case to store 2.61 // symbol + type back into the attributed tree. 2.62 @@ -1582,9 +1560,7 @@ 2.63 // ... 2.64 // } 2.65 if (Resolve.isStatic(env)) cdef.mods.flags |= STATIC; 2.66 - clazz = TreeInfo.isDiamond(tree) ? 2.67 - make.Type(clazztype) 2.68 - : clazz; 2.69 + 2.70 if (clazztype.tsym.isInterface()) { 2.71 cdef.implementing = List.of(clazz); 2.72 } else { 2.73 @@ -2571,7 +2547,7 @@ 2.74 if (clazztype.tag == CLASS) { 2.75 List<Type> formals = clazztype.tsym.type.getTypeArguments(); 2.76 2.77 - if (actuals.length() == formals.length() || actuals.isEmpty()) { 2.78 + if (actuals.length() == formals.length()) { 2.79 List<Type> a = actuals; 2.80 List<Type> f = formals; 2.81 while (a.nonEmpty()) { 2.82 @@ -2597,18 +2573,7 @@ 2.83 clazzOuter = site; 2.84 } 2.85 } 2.86 - if (actuals.nonEmpty()) { 2.87 - owntype = new ClassType(clazzOuter, actuals, clazztype.tsym); 2.88 - } 2.89 - else if (TreeInfo.isDiamond(tree)) { 2.90 - //a type apply with no explicit type arguments - diamond operator 2.91 - //the result type is a forall F where F's tvars are the type-variables 2.92 - //that will be inferred when F is checked against the expected type 2.93 - List<Type> ftvars = clazztype.tsym.type.getTypeArguments(); 2.94 - List<Type> new_tvars = types.newInstances(ftvars); 2.95 - clazztype = new ClassType(clazzOuter, new_tvars, clazztype.tsym); 2.96 - owntype = new ForAll(new_tvars, clazztype); 2.97 - } 2.98 + owntype = new ClassType(clazzOuter, actuals, clazztype.tsym); 2.99 } else { 2.100 if (formals.length() != 0) { 2.101 log.error(tree.pos(), "wrong.number.type.args",
3.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Fri Apr 09 15:39:39 2010 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Wed Apr 14 12:23:29 2010 +0100 3.3 @@ -375,6 +375,8 @@ 3.4 Type checkType(DiagnosticPosition pos, Type found, Type req) { 3.5 if (req.tag == ERROR) 3.6 return req; 3.7 + if (found.tag == FORALL) 3.8 + return instantiatePoly(pos, (ForAll)found, req, convertWarner(pos, found, req)); 3.9 if (req.tag == NONE) 3.10 return found; 3.11 if (types.isAssignable(found, req, convertWarner(pos, found, req))) 3.12 @@ -392,33 +394,6 @@ 3.13 return typeError(pos, diags.fragment("incompatible.types"), found, req); 3.14 } 3.15 3.16 - Type checkReturnType(DiagnosticPosition pos, Type found, Type req) { 3.17 - if (found.tag == FORALL) { 3.18 - try { 3.19 - return instantiatePoly(pos, (ForAll) found, req, convertWarner(pos, found, req)); 3.20 - } catch (Infer.NoInstanceException ex) { 3.21 - if (ex.isAmbiguous) { 3.22 - JCDiagnostic d = ex.getDiagnostic(); 3.23 - log.error(pos, 3.24 - "undetermined.type" + (d != null ? ".1" : ""), 3.25 - found, d); 3.26 - return types.createErrorType(req); 3.27 - } else { 3.28 - JCDiagnostic d = ex.getDiagnostic(); 3.29 - return typeError(pos, 3.30 - diags.fragment("incompatible.types" + (d != null ? ".1" : ""), d), 3.31 - found, req); 3.32 - } 3.33 - } catch (Infer.InvalidInstanceException ex) { 3.34 - JCDiagnostic d = ex.getDiagnostic(); 3.35 - log.error(pos, "invalid.inferred.types", ((ForAll)found).tvars, d); 3.36 - return types.createErrorType(req); 3.37 - } 3.38 - } else { 3.39 - return checkType(pos, found, req); 3.40 - } 3.41 - } 3.42 - 3.43 /** Instantiate polymorphic type to some prototype, unless 3.44 * prototype is `anyPoly' in which case polymorphic type 3.45 * is returned unchanged. 3.46 @@ -432,9 +407,28 @@ 3.47 } else if (pt.tag == ERROR) { 3.48 return pt; 3.49 } else { 3.50 - return infer.instantiateExpr(t, pt, warn); 3.51 + try { 3.52 + return infer.instantiateExpr(t, pt, warn); 3.53 + } catch (Infer.NoInstanceException ex) { 3.54 + if (ex.isAmbiguous) { 3.55 + JCDiagnostic d = ex.getDiagnostic(); 3.56 + log.error(pos, 3.57 + "undetermined.type" + (d!=null ? ".1" : ""), 3.58 + t, d); 3.59 + return types.createErrorType(pt); 3.60 + } else { 3.61 + JCDiagnostic d = ex.getDiagnostic(); 3.62 + return typeError(pos, 3.63 + diags.fragment("incompatible.types" + (d!=null ? ".1" : ""), d), 3.64 + t, pt); 3.65 + } 3.66 + } catch (Infer.InvalidInstanceException ex) { 3.67 + JCDiagnostic d = ex.getDiagnostic(); 3.68 + log.error(pos, "invalid.inferred.types", t.tvars, d); 3.69 + return types.createErrorType(pt); 3.70 + } 3.71 } 3.72 - } 3.73 + } 3.74 3.75 /** Check that a given type can be cast to a given target type. 3.76 * Return the result of the cast. 3.77 @@ -557,29 +551,6 @@ 3.78 return t; 3.79 } 3.80 3.81 - /** Check that type is a valid type for a new expression. If the type contains 3.82 - * some uninferred type variables, instantiate them exploiting the expected 3.83 - * type. 3.84 - * 3.85 - * @param pos Position to be used for error reporting. 3.86 - * @param t The type to be checked. 3.87 - * @param noBounds True if type bounds are illegal here. 3.88 - * @param pt Expected type (used with diamond operator) 3.89 - */ 3.90 - Type checkNewClassType(DiagnosticPosition pos, Type t, boolean noBounds, Type pt) { 3.91 - if (t.tag == FORALL) { 3.92 - try { 3.93 - t = instantiatePoly(pos, (ForAll)t, pt, Warner.noWarnings); 3.94 - } 3.95 - catch (Infer.NoInstanceException ex) { 3.96 - JCDiagnostic d = ex.getDiagnostic(); 3.97 - log.error(pos, "cant.apply.diamond", t.getTypeArguments(), d); 3.98 - return types.createErrorType(pt); 3.99 - } 3.100 - } 3.101 - return checkClassType(pos, t, noBounds); 3.102 - } 3.103 - 3.104 /** Check that type is a reifiable class, interface or array type. 3.105 * @param pos Position to be used for error reporting. 3.106 * @param t The type to be checked. 3.107 @@ -936,8 +907,7 @@ 3.108 } 3.109 3.110 checkCapture(tree); 3.111 - } 3.112 - if (tree.type.tag == CLASS || tree.type.tag == FORALL) { 3.113 + 3.114 // Check that this type is either fully parameterized, or 3.115 // not parameterized at all. 3.116 if (tree.type.getEnclosingType().isRaw())
4.1 --- a/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Fri Apr 09 15:39:39 2010 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/parser/JavacParser.java Wed Apr 14 12:23:29 2010 +0100 4.3 @@ -131,7 +131,6 @@ 4.4 this.allowForeach = source.allowForeach(); 4.5 this.allowStaticImport = source.allowStaticImport(); 4.6 this.allowAnnotations = source.allowAnnotations(); 4.7 - this.allowDiamond = source.allowDiamond(); 4.8 this.allowTypeAnnotations = source.allowTypeAnnotations(); 4.9 this.keepDocComments = keepDocComments; 4.10 if (keepDocComments) 4.11 @@ -149,10 +148,6 @@ 4.12 */ 4.13 boolean allowGenerics; 4.14 4.15 - /** Switch: Should diamond operator be recognized? 4.16 - */ 4.17 - boolean allowDiamond; 4.18 - 4.19 /** Switch: Should varargs be recognized? 4.20 */ 4.21 boolean allowVarargs; 4.22 @@ -199,7 +194,6 @@ 4.23 static final int TYPE = 2; 4.24 static final int NOPARAMS = 4; 4.25 static final int TYPEARG = 8; 4.26 - static final int DIAMOND = 16; 4.27 4.28 /** The current mode. 4.29 */ 4.30 @@ -1349,11 +1343,6 @@ 4.31 ListBuffer<JCExpression> args = lb(); 4.32 if (S.token() == LT) { 4.33 S.nextToken(); 4.34 - if (S.token() == GT && (mode & DIAMOND) != 0) { 4.35 - checkDiamond(); 4.36 - S.nextToken(); 4.37 - return List.nil(); 4.38 - } 4.39 args.append(((mode & EXPR) == 0) ? typeArgument() : parseType()); 4.40 while (S.token() == COMMA) { 4.41 S.nextToken(); 4.42 @@ -1527,7 +1516,7 @@ 4.43 t = F.AnnotatedType(newAnnotations, t); 4.44 4.45 int oldmode = mode; 4.46 - mode = TYPE | DIAMOND; 4.47 + mode = TYPE; 4.48 if (S.token() == LT) { 4.49 checkGenerics(); 4.50 t = typeArguments(t); 4.51 @@ -1580,11 +1569,8 @@ 4.52 JCExpression innerCreator(int newpos, List<JCExpression> typeArgs, JCExpression encl) { 4.53 JCExpression t = toP(F.at(S.pos()).Ident(ident())); 4.54 if (S.token() == LT) { 4.55 - int oldmode = mode; 4.56 - mode |= DIAMOND; 4.57 checkGenerics(); 4.58 t = typeArguments(t); 4.59 - mode = oldmode; 4.60 } 4.61 return classCreatorRest(newpos, encl, typeArgs, t); 4.62 } 4.63 @@ -3151,12 +3137,6 @@ 4.64 } 4.65 } 4.66 4.67 - void checkDiamond() { 4.68 - if (!allowDiamond) { 4.69 - log.error(S.pos(), "diamond.not.supported.in.source", source.name); 4.70 - allowDiamond = true; 4.71 - } 4.72 - } 4.73 void checkGenerics() { 4.74 if (!allowGenerics) { 4.75 log.error(S.pos(), "generics.not.supported.in.source", source.name);
5.1 --- a/src/share/classes/com/sun/tools/javac/resources/compiler.properties Fri Apr 09 15:39:39 2010 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/resources/compiler.properties Wed Apr 14 12:23:29 2010 +0100 5.3 @@ -1082,10 +1082,6 @@ 5.4 symbol: {0} <{2}>{1}({3})\n\ 5.5 location: {4} {5} 5.6 5.7 -compiler.err.cant.apply.diamond=\ 5.8 - diamond operator cannot infer types for {0};\n\ 5.9 - reason: {1} 5.10 - 5.11 ## The following are all possible string for "kindname". 5.12 ## They should be called whatever the JLS calls them after it been translated 5.13 ## to the appropriate language. 5.14 @@ -1227,10 +1223,6 @@ 5.15 enums are not supported in -source {0}\n\ 5.16 (use -source 5 or higher to enable enums) 5.17 5.18 -compiler.err.diamond.not.supported.in.source=\ 5.19 - diamond operator is not supported in -source {0}\n\ 5.20 -(use -source 7 or higher to enable diamond operator) 5.21 - 5.22 compiler.err.string.switch.not.supported.in.source=\ 5.23 strings in switch are not supported in -source {0}\n\ 5.24 (use -source 7 or higher to enable strings in switch)
6.1 --- a/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Fri Apr 09 15:39:39 2010 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javac/tree/TreeInfo.java Wed Apr 14 12:23:29 2010 +0100 6.3 @@ -204,15 +204,6 @@ 6.4 return (JCMethodInvocation)exec.expr; 6.5 } 6.6 6.7 - /** Return true if a tree represents a diamond new expr. */ 6.8 - public static boolean isDiamond(JCTree tree) { 6.9 - switch(tree.getTag()) { 6.10 - case JCTree.TYPEAPPLY: return ((JCTypeApply)tree).getTypeArguments().isEmpty(); 6.11 - case JCTree.NEWCLASS: return isDiamond(((JCNewClass)tree).clazz); 6.12 - default: return false; 6.13 - } 6.14 - } 6.15 - 6.16 /** Return true if a tree represents the null literal. */ 6.17 public static boolean isNull(JCTree tree) { 6.18 if (tree.getTag() != JCTree.LITERAL)
7.1 --- a/test/tools/javac/generics/diamond/neg/Neg01.java Fri Apr 09 15:39:39 2010 -0700 7.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 7.3 @@ -1,38 +0,0 @@ 7.4 -/* 7.5 - * @test /nodynamiccopyright/ 7.6 - * @bug 6840638 7.7 - * 7.8 - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') 7.9 - * @author mcimadamore 7.10 - * @compile/fail/ref=Neg01.out Neg01.java -source 1.7 -XDrawDiagnostics 7.11 - * 7.12 - */ 7.13 - 7.14 -class Neg01<X extends Number> { 7.15 - 7.16 - Neg01(X x) {} 7.17 - 7.18 - <Z> Neg01(X x, Z z) {} 7.19 - 7.20 - void test() { 7.21 - Neg01<String> n1 = new Neg01<>(""); //new Foo<Integer> created 7.22 - Neg01<? extends String> n2 = new Neg01<>(""); //new Foo<Integer> created 7.23 - Neg01<?> n3 = new Neg01<>(""); //new Foo<Object> created 7.24 - Neg01<? super String> n4 = new Neg01<>(""); //new Foo<Object> created 7.25 - 7.26 - Neg01<String> n5 = new Neg01<>(""){}; //new Foo<Integer> created 7.27 - Neg01<? extends String> n6 = new Neg01<>(""){}; //new Foo<Integer> created 7.28 - Neg01<?> n7 = new Neg01<>(""){}; //new Foo<Object> created 7.29 - Neg01<? super String> n8 = new Neg01<>(""){}; //new Foo<Object> created 7.30 - 7.31 - Neg01<String> n9 = new Neg01<>("", ""); //new Foo<Integer> created 7.32 - Neg01<? extends String> n10 = new Neg01<>("", ""); //new Foo<Integer> created 7.33 - Neg01<?> n11 = new Neg01<>("", ""); //new Foo<Object> created 7.34 - Foo<? super String> n12 = new Neg01<>("", ""); //new Foo<Object> created 7.35 - 7.36 - Neg01<String> n13 = new Neg01<>("", ""){}; //new Foo<Integer> created 7.37 - Neg01<? extends String> n14 = new Neg01<>("", ""){}; //new Foo<Integer> created 7.38 - Neg01<?> n15 = new Neg01<>("", ""){}; //new Foo<Object> created 7.39 - Neg01<? super String> n16 = new Neg01<>("", ""){}; //new Foo<Object> created 7.40 - } 7.41 -}
8.1 --- a/test/tools/javac/generics/diamond/neg/Neg01.out Fri Apr 09 15:39:39 2010 -0700 8.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 8.3 @@ -1,31 +0,0 @@ 8.4 -Neg01.java:18:15: compiler.err.not.within.bounds: java.lang.String 8.5 -Neg01.java:18:37: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<java.lang.String>) 8.6 -Neg01.java:19:15: compiler.err.not.within.bounds: ? extends java.lang.String 8.7 -Neg01.java:19:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 8.8 -Neg01.java:20:23: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String, kindname.class, Neg01<java.lang.Number> 8.9 -Neg01.java:21:15: compiler.err.not.within.bounds: ? super java.lang.String 8.10 -Neg01.java:21:45: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<? super java.lang.String>) 8.11 -Neg01.java:23:15: compiler.err.not.within.bounds: java.lang.String 8.12 -Neg01.java:23:37: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<java.lang.String>) 8.13 -Neg01.java:24:15: compiler.err.not.within.bounds: ? extends java.lang.String 8.14 -Neg01.java:24:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 8.15 -Neg01.java:25:23: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String, kindname.class, Neg01<java.lang.Number> 8.16 -Neg01.java:25:38: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , , kindname.class, Neg01<java.lang.Number> 8.17 -Neg01.java:26:15: compiler.err.not.within.bounds: ? super java.lang.String 8.18 -Neg01.java:26:45: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<? super java.lang.String>) 8.19 -Neg01.java:28:15: compiler.err.not.within.bounds: java.lang.String 8.20 -Neg01.java:28:37: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<java.lang.String>) 8.21 -Neg01.java:29:15: compiler.err.not.within.bounds: ? extends java.lang.String 8.22 -Neg01.java:29:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 8.23 -Neg01.java:30:24: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String,java.lang.String, kindname.class, Neg01<java.lang.Number> 8.24 -Neg01.java:31:9: compiler.err.cant.resolve.location: kindname.class, Foo, , , kindname.class, Neg01<X> 8.25 -Neg01.java:31:35: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String,java.lang.String, kindname.class, Neg01<java.lang.Number> 8.26 -Neg01.java:33:15: compiler.err.not.within.bounds: java.lang.String 8.27 -Neg01.java:33:38: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<java.lang.String>) 8.28 -Neg01.java:34:15: compiler.err.not.within.bounds: ? extends java.lang.String 8.29 -Neg01.java:34:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 8.30 -Neg01.java:35:24: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , java.lang.String,java.lang.String, kindname.class, Neg01<java.lang.Number> 8.31 -Neg01.java:35:43: compiler.err.cant.resolve.location.args: kindname.constructor, Neg01, , , kindname.class, Neg01<java.lang.Number> 8.32 -Neg01.java:36:15: compiler.err.not.within.bounds: ? super java.lang.String 8.33 -Neg01.java:36:46: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg01<X>, Neg01<? super java.lang.String>) 8.34 -30 errors
9.1 --- a/test/tools/javac/generics/diamond/neg/Neg02.java Fri Apr 09 15:39:39 2010 -0700 9.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 9.3 @@ -1,61 +0,0 @@ 9.4 -/* 9.5 - * @test /nodynamiccopyright/ 9.6 - * @bug 6840638 9.7 - * 9.8 - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') 9.9 - * @author mcimadamore 9.10 - * @compile/fail/ref=Neg02.out Neg02.java -source 1.7 -XDrawDiagnostics 9.11 - * 9.12 - */ 9.13 - 9.14 -class Neg02 { 9.15 - 9.16 - static class Foo<X extends Number> { 9.17 - Foo(X x) {} 9.18 - <Z> Foo(X x, Z z) {} 9.19 - } 9.20 - 9.21 - void testSimple() { 9.22 - Foo<String> f1 = new Foo<>(""); //new Foo<Integer> created 9.23 - Foo<? extends String> f2 = new Foo<>(""); //new Foo<Integer> created 9.24 - Foo<?> f3 = new Foo<>(""); //new Foo<Object> created 9.25 - Foo<? super String> f4 = new Foo<>(""); //new Foo<Object> created 9.26 - 9.27 - Foo<String> f5 = new Foo<>(""){}; //new Foo<Integer> created 9.28 - Foo<? extends String> f6 = new Foo<>(""){}; //new Foo<Integer> created 9.29 - Foo<?> f7 = new Foo<>(""){}; //new Foo<Object> created 9.30 - Foo<? super String> f8 = new Foo<>(""){}; //new Foo<Object> created 9.31 - 9.32 - Foo<String> f9 = new Foo<>("", ""); //new Foo<Integer> created 9.33 - Foo<? extends String> f10 = new Foo<>("", ""); //new Foo<Integer> created 9.34 - Foo<?> f11 = new Foo<>("", ""); //new Foo<Object> created 9.35 - Foo<? super String> f12 = new Foo<>("", ""); //new Foo<Object> created 9.36 - 9.37 - Foo<String> f13 = new Foo<>("", ""){}; //new Foo<Integer> created 9.38 - Foo<? extends String> f14 = new Foo<>("", ""){}; //new Foo<Integer> created 9.39 - Foo<?> f15 = new Foo<>("", ""){}; //new Foo<Object> created 9.40 - Foo<? super String> f16 = new Foo<>("", ""){}; //new Foo<Object> created 9.41 - } 9.42 - 9.43 - void testQualified() { 9.44 - Foo<String> f1 = new Neg02.Foo<>(""); //new Foo<Integer> created 9.45 - Foo<? extends String> f2 = new Neg02.Foo<>(""); //new Foo<Integer> created 9.46 - Foo<?> f3 = new Neg02.Foo<>(""); //new Foo<Object> created 9.47 - Foo<? super String> f4 = new Neg02.Foo<>(""); //new Foo<Object> created 9.48 - 9.49 - Foo<String> f5 = new Neg02.Foo<>(""){}; //new Foo<Integer> created 9.50 - Foo<? extends String> f6 = new Neg02.Foo<>(""){}; //new Foo<Integer> created 9.51 - Foo<?> f7 = new Neg02.Foo<>(""){}; //new Foo<Object> created 9.52 - Foo<? super String> f8 = new Neg02.Foo<>(""){}; //new Foo<Object> created 9.53 - 9.54 - Foo<String> f9 = new Neg02.Foo<>("", ""); //new Foo<Integer> created 9.55 - Foo<? extends String> f10 = new Neg02.Foo<>("", ""); //new Foo<Integer> created 9.56 - Foo<?> f11 = new Neg02.Foo<>("", ""); //new Foo<Object> created 9.57 - Foo<? super String> f12 = new Neg02.Foo<>("", ""); //new Foo<Object> created 9.58 - 9.59 - Foo<String> f13 = new Neg02.Foo<>("", ""){}; //new Foo<Integer> created 9.60 - Foo<? extends String> f14 = new Neg02.Foo<>("", ""){}; //new Foo<Integer> created 9.61 - Foo<?> f15 = new Neg02.Foo<>("", ""){}; //new Foo<Object> created 9.62 - Foo<? super String> f16 = new Neg02.Foo<>("", ""){}; //new Foo<Object> created 9.63 - } 9.64 -}
10.1 --- a/test/tools/javac/generics/diamond/neg/Neg02.out Fri Apr 09 15:39:39 2010 -0700 10.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 10.3 @@ -1,61 +0,0 @@ 10.4 -Neg02.java:19:13: compiler.err.not.within.bounds: java.lang.String 10.5 -Neg02.java:19:33: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>) 10.6 -Neg02.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String 10.7 -Neg02.java:20:43: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 10.8 -Neg02.java:21:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo<java.lang.Number> 10.9 -Neg02.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String 10.10 -Neg02.java:22:41: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>) 10.11 -Neg02.java:24:13: compiler.err.not.within.bounds: java.lang.String 10.12 -Neg02.java:24:33: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>) 10.13 -Neg02.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String 10.14 -Neg02.java:25:43: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 10.15 -Neg02.java:26:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo<java.lang.Number> 10.16 -Neg02.java:26:34: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo<java.lang.Number> 10.17 -Neg02.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String 10.18 -Neg02.java:27:41: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>) 10.19 -Neg02.java:29:13: compiler.err.not.within.bounds: java.lang.String 10.20 -Neg02.java:29:33: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>) 10.21 -Neg02.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String 10.22 -Neg02.java:30:44: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 10.23 -Neg02.java:31:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo<java.lang.Number> 10.24 -Neg02.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String 10.25 -Neg02.java:32:42: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>) 10.26 -Neg02.java:34:13: compiler.err.not.within.bounds: java.lang.String 10.27 -Neg02.java:34:34: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>) 10.28 -Neg02.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String 10.29 -Neg02.java:35:44: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 10.30 -Neg02.java:36:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo<java.lang.Number> 10.31 -Neg02.java:36:39: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo<java.lang.Number> 10.32 -Neg02.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String 10.33 -Neg02.java:37:42: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>) 10.34 -Neg02.java:41:13: compiler.err.not.within.bounds: java.lang.String 10.35 -Neg02.java:41:39: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>) 10.36 -Neg02.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String 10.37 -Neg02.java:42:49: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 10.38 -Neg02.java:43:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo<java.lang.Number> 10.39 -Neg02.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String 10.40 -Neg02.java:44:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>) 10.41 -Neg02.java:46:13: compiler.err.not.within.bounds: java.lang.String 10.42 -Neg02.java:46:39: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>) 10.43 -Neg02.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String 10.44 -Neg02.java:47:49: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 10.45 -Neg02.java:48:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg02.Foo<java.lang.Number> 10.46 -Neg02.java:48:40: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo<java.lang.Number> 10.47 -Neg02.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String 10.48 -Neg02.java:49:47: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>) 10.49 -Neg02.java:51:13: compiler.err.not.within.bounds: java.lang.String 10.50 -Neg02.java:51:39: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>) 10.51 -Neg02.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String 10.52 -Neg02.java:52:50: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 10.53 -Neg02.java:53:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo<java.lang.Number> 10.54 -Neg02.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String 10.55 -Neg02.java:54:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>) 10.56 -Neg02.java:56:13: compiler.err.not.within.bounds: java.lang.String 10.57 -Neg02.java:56:40: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<java.lang.String>) 10.58 -Neg02.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String 10.59 -Neg02.java:57:50: compiler.err.cant.apply.diamond: X, (compiler.misc.no.unique.maximal.instance.exists: X, java.lang.String,java.lang.Number) 10.60 -Neg02.java:58:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg02.Foo<java.lang.Number> 10.61 -Neg02.java:58:45: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg02.Foo<java.lang.Number> 10.62 -Neg02.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String 10.63 -Neg02.java:59:48: compiler.err.cant.apply.diamond: X, (compiler.misc.no.conforming.instance.exists: X, Neg02.Foo<X>, Neg02.Foo<? super java.lang.String>) 10.64 -60 errors
11.1 --- a/test/tools/javac/generics/diamond/neg/Neg03.java Fri Apr 09 15:39:39 2010 -0700 11.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 11.3 @@ -1,83 +0,0 @@ 11.4 -/* 11.5 - * @test /nodynamiccopyright/ 11.6 - * @bug 6840638 11.7 - * 11.8 - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') 11.9 - * @author mcimadamore 11.10 - * @compile/fail/ref=Neg03.out Neg03.java -source 1.7 -XDrawDiagnostics 11.11 - * 11.12 - */ 11.13 - 11.14 -class Neg03<U> { 11.15 - 11.16 - class Foo<V extends Number> { 11.17 - Foo(V x) {} 11.18 - <Z> Foo(V x, Z z) {} 11.19 - } 11.20 - 11.21 - void testSimple() { 11.22 - Foo<String> f1 = new Foo<>(""); //new Foo<Integer> created 11.23 - Foo<? extends String> f2 = new Foo<>(""); //new Foo<Integer> created 11.24 - Foo<?> f3 = new Foo<>(""); //new Foo<Object> created 11.25 - Foo<? super String> f4 = new Foo<>(""); //new Foo<Object> created 11.26 - 11.27 - Foo<String> f5 = new Foo<>(""){}; //new Foo<Integer> created 11.28 - Foo<? extends String> f6 = new Foo<>(""){}; //new Foo<Integer> created 11.29 - Foo<?> f7 = new Foo<>(""){}; //new Foo<Object> created 11.30 - Foo<? super String> f8 = new Foo<>(""){}; //new Foo<Object> created 11.31 - 11.32 - Foo<String> f9 = new Foo<>("", ""); //new Foo<Integer> created 11.33 - Foo<? extends String> f10 = new Foo<>("", ""); //new Foo<Integer> created 11.34 - Foo<?> f11 = new Foo<>("", ""); //new Foo<Object> created 11.35 - Foo<? super String> f12 = new Foo<>("", ""); //new Foo<Object> created 11.36 - 11.37 - Foo<String> f13 = new Foo<>("", ""){}; //new Foo<Integer> created 11.38 - Foo<? extends String> f14 = new Foo<>("", ""){}; //new Foo<Integer> created 11.39 - Foo<?> f15 = new Foo<>("", ""){}; //new Foo<Object> created 11.40 - Foo<? super String> f16 = new Foo<>("", ""){}; //new Foo<Object> created 11.41 - } 11.42 - 11.43 - void testQualified_1() { 11.44 - Foo<String> f1 = new Neg03<U>.Foo<>(""); //new Foo<Integer> created 11.45 - Foo<? extends String> f2 = new Neg03<U>.Foo<>(""); //new Foo<Integer> created 11.46 - Foo<?> f3 = new Neg03<U>.Foo<>(""); //new Foo<Object> created 11.47 - Foo<? super String> f4 = new Neg03<U>.Foo<>(""); //new Foo<Object> created 11.48 - 11.49 - Foo<String> f5 = new Neg03<U>.Foo<>(""){}; //new Foo<Integer> created 11.50 - Foo<? extends String> f6 = new Neg03<U>.Foo<>(""){}; //new Foo<Integer> created 11.51 - Foo<?> f7 = new Neg03<U>.Foo<>(""){}; //new Foo<Object> created 11.52 - Foo<? super String> f8 = new Neg03<U>.Foo<>(""){}; //new Foo<Object> created 11.53 - 11.54 - Foo<String> f9 = new Neg03<U>.Foo<>("", ""); //new Foo<Integer> created 11.55 - Foo<? extends String> f10 = new Neg03<U>.Foo<>("", ""); //new Foo<Integer> created 11.56 - Foo<?> f11 = new Neg03<U>.Foo<>("", ""); //new Foo<Object> created 11.57 - Foo<? super String> f12 = new Neg03<U>.Foo<>("", ""); //new Foo<Object> created 11.58 - 11.59 - Foo<String> f13 = new Neg03<U>.Foo<>("", ""){}; //new Foo<Integer> created 11.60 - Foo<? extends String> f14 = new Neg03<U>.Foo<>("", ""){}; //new Foo<Integer> created 11.61 - Foo<?> f15 = new Neg03<U>.Foo<>("", ""){}; //new Foo<Object> created 11.62 - Foo<? super String> f16 = new Neg03<U>.Foo<>("", ""){}; //new Foo<Object> created 11.63 - } 11.64 - 11.65 - void testQualified_2(Neg03<U> n) { 11.66 - Foo<String> f1 = n.new Foo<>(""); //new Foo<Integer> created 11.67 - Foo<? extends String> f2 = n.new Foo<>(""); //new Foo<Integer> created 11.68 - Foo<?> f3 = n.new Foo<>(""); //new Foo<Integer> created 11.69 - Foo<? super String> f4 = n.new Foo<>(""); //new Foo<Integer> created 11.70 - 11.71 - Foo<String> f5 = n.new Foo<>(""){}; //new Foo<Integer> created 11.72 - Foo<? extends String> f6 = n.new Foo<>(""){}; //new Foo<Integer> created 11.73 - Foo<?> f7 = n.new Foo<>(""){}; //new Foo<Integer> created 11.74 - Foo<? super String> f8 = n.new Foo<>(""){}; //new Foo<Integer> created 11.75 - 11.76 - Foo<String> f9 = n.new Foo<>("", ""); //new Foo<Integer> created 11.77 - Foo<? extends String> f10 = n.new Foo<>("", ""); //new Foo<Integer> created 11.78 - Foo<?> f11 = n.new Foo<>("", ""); //new Foo<Integer> created 11.79 - Foo<? super String> f12 = n.new Foo<>("", ""); //new Foo<Integer> created 11.80 - 11.81 - Foo<String> f13 = n.new Foo<>("", ""){}; //new Foo<Integer> created 11.82 - Foo<? extends String> f14 = n.new Foo<>("", ""){}; //new Foo<Integer> created 11.83 - Foo<?> f15 = n.new Foo<>("", ""){}; //new Foo<Integer> created 11.84 - Foo<? super String> f16 = n.new Foo<>("", ""){}; //new Foo<Integer> created 11.85 - } 11.86 -}
12.1 --- a/test/tools/javac/generics/diamond/neg/Neg03.out Fri Apr 09 15:39:39 2010 -0700 12.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 12.3 @@ -1,91 +0,0 @@ 12.4 -Neg03.java:19:13: compiler.err.not.within.bounds: java.lang.String 12.5 -Neg03.java:19:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.6 -Neg03.java:20:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.7 -Neg03.java:20:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.8 -Neg03.java:21:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.9 -Neg03.java:22:13: compiler.err.not.within.bounds: ? super java.lang.String 12.10 -Neg03.java:22:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.11 -Neg03.java:24:13: compiler.err.not.within.bounds: java.lang.String 12.12 -Neg03.java:24:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.13 -Neg03.java:25:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.14 -Neg03.java:25:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.15 -Neg03.java:26:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.16 -Neg03.java:26:34: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number> 12.17 -Neg03.java:27:13: compiler.err.not.within.bounds: ? super java.lang.String 12.18 -Neg03.java:27:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.19 -Neg03.java:29:13: compiler.err.not.within.bounds: java.lang.String 12.20 -Neg03.java:29:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.21 -Neg03.java:30:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.22 -Neg03.java:30:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.23 -Neg03.java:31:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.24 -Neg03.java:32:13: compiler.err.not.within.bounds: ? super java.lang.String 12.25 -Neg03.java:32:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.26 -Neg03.java:34:13: compiler.err.not.within.bounds: java.lang.String 12.27 -Neg03.java:34:34: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.28 -Neg03.java:35:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.29 -Neg03.java:35:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.30 -Neg03.java:36:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.31 -Neg03.java:36:39: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number> 12.32 -Neg03.java:37:13: compiler.err.not.within.bounds: ? super java.lang.String 12.33 -Neg03.java:37:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.34 -Neg03.java:41:13: compiler.err.not.within.bounds: java.lang.String 12.35 -Neg03.java:41:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.36 -Neg03.java:42:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.37 -Neg03.java:42:52: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.38 -Neg03.java:43:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.39 -Neg03.java:44:13: compiler.err.not.within.bounds: ? super java.lang.String 12.40 -Neg03.java:44:50: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.41 -Neg03.java:46:13: compiler.err.not.within.bounds: java.lang.String 12.42 -Neg03.java:46:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.43 -Neg03.java:47:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.44 -Neg03.java:47:52: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.45 -Neg03.java:48:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.46 -Neg03.java:48:43: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number> 12.47 -Neg03.java:49:13: compiler.err.not.within.bounds: ? super java.lang.String 12.48 -Neg03.java:49:50: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.49 -Neg03.java:51:13: compiler.err.not.within.bounds: java.lang.String 12.50 -Neg03.java:51:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.51 -Neg03.java:52:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.52 -Neg03.java:52:53: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.53 -Neg03.java:53:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.54 -Neg03.java:54:13: compiler.err.not.within.bounds: ? super java.lang.String 12.55 -Neg03.java:54:51: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.56 -Neg03.java:56:13: compiler.err.not.within.bounds: java.lang.String 12.57 -Neg03.java:56:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.58 -Neg03.java:57:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.59 -Neg03.java:57:53: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.60 -Neg03.java:58:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.61 -Neg03.java:58:48: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number> 12.62 -Neg03.java:59:13: compiler.err.not.within.bounds: ? super java.lang.String 12.63 -Neg03.java:59:51: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.64 -Neg03.java:63:13: compiler.err.not.within.bounds: java.lang.String 12.65 -Neg03.java:63:28: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.66 -Neg03.java:64:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.67 -Neg03.java:64:38: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.68 -Neg03.java:65:23: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.69 -Neg03.java:66:13: compiler.err.not.within.bounds: ? super java.lang.String 12.70 -Neg03.java:66:36: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.71 -Neg03.java:68:13: compiler.err.not.within.bounds: java.lang.String 12.72 -Neg03.java:68:28: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.73 -Neg03.java:69:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.74 -Neg03.java:69:38: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.75 -Neg03.java:70:23: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.76 -Neg03.java:70:36: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number> 12.77 -Neg03.java:71:13: compiler.err.not.within.bounds: ? super java.lang.String 12.78 -Neg03.java:71:36: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.79 -Neg03.java:73:13: compiler.err.not.within.bounds: java.lang.String 12.80 -Neg03.java:73:28: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.81 -Neg03.java:74:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.82 -Neg03.java:74:39: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.83 -Neg03.java:75:24: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.84 -Neg03.java:76:13: compiler.err.not.within.bounds: ? super java.lang.String 12.85 -Neg03.java:76:37: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.86 -Neg03.java:78:13: compiler.err.not.within.bounds: java.lang.String 12.87 -Neg03.java:78:29: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<java.lang.String>) 12.88 -Neg03.java:79:13: compiler.err.not.within.bounds: ? extends java.lang.String 12.89 -Neg03.java:79:39: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 12.90 -Neg03.java:80:24: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Neg03<U>.Foo<java.lang.Number> 12.91 -Neg03.java:80:41: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Neg03<U>.Foo<java.lang.Number> 12.92 -Neg03.java:81:13: compiler.err.not.within.bounds: ? super java.lang.String 12.93 -Neg03.java:81:37: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Neg03<U>.Foo<V>, Neg03<U>.Foo<? super java.lang.String>) 12.94 -90 errors
13.1 --- a/test/tools/javac/generics/diamond/neg/Neg04.java Fri Apr 09 15:39:39 2010 -0700 13.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 13.3 @@ -1,38 +0,0 @@ 13.4 -/* 13.5 - * @test /nodynamiccopyright/ 13.6 - * @bug 6840638 13.7 - * 13.8 - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') 13.9 - * @author mcimadamore 13.10 - * @compile/fail/ref=Neg04.out Neg04.java -source 1.7 -XDrawDiagnostics 13.11 - * 13.12 - */ 13.13 - 13.14 -class Neg04 { 13.15 - 13.16 - void test() { 13.17 - class Foo<V extends Number> { 13.18 - Foo(V x) {} 13.19 - <Z> Foo(V x, Z z) {} 13.20 - } 13.21 - Foo<String> n1 = new Foo<>(""); //new Foo<Integer> created 13.22 - Foo<? extends String> n2 = new Foo<>(""); //new Foo<Integer> created 13.23 - Foo<?> n3 = new Foo<>(""); //new Foo<Object> created 13.24 - Foo<? super String> n4 = new Foo<>(""); //new Foo<Object> created 13.25 - 13.26 - Foo<String> n5 = new Foo<>(""){}; //new Foo<Integer> created 13.27 - Foo<? extends String> n6 = new Foo<>(""){}; //new Foo<Integer> created 13.28 - Foo<?> n7 = new Foo<>(""){}; //new Foo<Object> created 13.29 - Foo<? super String> n8 = new Foo<>(""){}; //new Foo<Object> created 13.30 - 13.31 - Foo<String> n9 = new Foo<>("", ""); //new Foo<Integer> created 13.32 - Foo<? extends String> n10 = new Foo<>("", ""); //new Foo<Integer> created 13.33 - Foo<?> n11 = new Foo<>("", ""); //new Foo<Object> created 13.34 - Foo<? super String> n12 = new Foo<>("", ""); //new Foo<Object> created 13.35 - 13.36 - Foo<String> n13 = new Foo<>("", ""){}; //new Foo<Integer> created 13.37 - Foo<? extends String> n14 = new Foo<>("", ""){}; //new Foo<Integer> created 13.38 - Foo<?> n15 = new Foo<>("", ""){}; //new Foo<Object> created 13.39 - Foo<? super String> n16 = new Foo<>("", ""){}; //new Foo<Object> created 13.40 - } 13.41 -}
14.1 --- a/test/tools/javac/generics/diamond/neg/Neg04.out Fri Apr 09 15:39:39 2010 -0700 14.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 14.3 @@ -1,31 +0,0 @@ 14.4 -Neg04.java:18:13: compiler.err.not.within.bounds: java.lang.String 14.5 -Neg04.java:18:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<java.lang.String>) 14.6 -Neg04.java:19:13: compiler.err.not.within.bounds: ? extends java.lang.String 14.7 -Neg04.java:19:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 14.8 -Neg04.java:20:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Foo<java.lang.Number> 14.9 -Neg04.java:21:13: compiler.err.not.within.bounds: ? super java.lang.String 14.10 -Neg04.java:21:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<? super java.lang.String>) 14.11 -Neg04.java:23:13: compiler.err.not.within.bounds: java.lang.String 14.12 -Neg04.java:23:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<java.lang.String>) 14.13 -Neg04.java:24:13: compiler.err.not.within.bounds: ? extends java.lang.String 14.14 -Neg04.java:24:43: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 14.15 -Neg04.java:25:21: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String, kindname.class, Foo<java.lang.Number> 14.16 -Neg04.java:25:34: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Foo<java.lang.Number> 14.17 -Neg04.java:26:13: compiler.err.not.within.bounds: ? super java.lang.String 14.18 -Neg04.java:26:41: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<? super java.lang.String>) 14.19 -Neg04.java:28:13: compiler.err.not.within.bounds: java.lang.String 14.20 -Neg04.java:28:33: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<java.lang.String>) 14.21 -Neg04.java:29:13: compiler.err.not.within.bounds: ? extends java.lang.String 14.22 -Neg04.java:29:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 14.23 -Neg04.java:30:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Foo<java.lang.Number> 14.24 -Neg04.java:31:13: compiler.err.not.within.bounds: ? super java.lang.String 14.25 -Neg04.java:31:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<? super java.lang.String>) 14.26 -Neg04.java:33:13: compiler.err.not.within.bounds: java.lang.String 14.27 -Neg04.java:33:34: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<java.lang.String>) 14.28 -Neg04.java:34:13: compiler.err.not.within.bounds: ? extends java.lang.String 14.29 -Neg04.java:34:44: compiler.err.cant.apply.diamond: V, (compiler.misc.no.unique.maximal.instance.exists: V, java.lang.String,java.lang.Number) 14.30 -Neg04.java:35:22: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , java.lang.String,java.lang.String, kindname.class, Foo<java.lang.Number> 14.31 -Neg04.java:35:39: compiler.err.cant.resolve.location.args: kindname.constructor, Foo, , , kindname.class, Foo<java.lang.Number> 14.32 -Neg04.java:36:13: compiler.err.not.within.bounds: ? super java.lang.String 14.33 -Neg04.java:36:42: compiler.err.cant.apply.diamond: V, (compiler.misc.no.conforming.instance.exists: V, Foo<V>, Foo<? super java.lang.String>) 14.34 -30 errors
15.1 --- a/test/tools/javac/generics/diamond/neg/Neg05.java Fri Apr 09 15:39:39 2010 -0700 15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 15.3 @@ -1,61 +0,0 @@ 15.4 -/* 15.5 - * @test /nodynamiccopyright/ 15.6 - * @bug 6840638 15.7 - * 15.8 - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') 15.9 - * @author mcimadamore 15.10 - * @compile/fail/ref=Neg05.out Neg05.java -source 1.7 -XDrawDiagnostics 15.11 - * 15.12 - */ 15.13 - 15.14 -class Neg05<U> { 15.15 - 15.16 - class Foo<V> { 15.17 - Foo(V x) {} 15.18 - <Z> Foo(V x, Z z) {} 15.19 - } 15.20 - 15.21 - void testRare_1() { 15.22 - Neg05<?>.Foo<String> f1 = new Neg05.Foo<>(""); //new Foo<Integer> created 15.23 - Neg05<?>.Foo<? extends String> f2 = new Neg05.Foo<>(""); //new Foo<Integer> created 15.24 - Neg05<?>.Foo<?> f3 = new Neg05.Foo<>(""); //new Foo<Object> created 15.25 - Neg05<?>.Foo<? super String> f4 = new Neg05.Foo<>(""); //new Foo<Object> created 15.26 - 15.27 - Neg05<?>.Foo<String> f5 = new Neg05.Foo<>(""){}; //new Foo<Integer> created 15.28 - Neg05<?>.Foo<? extends String> f6 = new Neg05.Foo<>(""){}; //new Foo<Integer> created 15.29 - Neg05<?>.Foo<?> f7 = new Neg05.Foo<>(""){}; //new Foo<Object> created 15.30 - Neg05<?>.Foo<? super String> f8 = new Neg05.Foo<>(""){}; //new Foo<Object> created 15.31 - 15.32 - Neg05<?>.Foo<String> f9 = new Neg05.Foo<>("", ""); //new Foo<Integer> created 15.33 - Neg05<?>.Foo<? extends String> f10 = new Neg05.Foo<>("", ""); //new Foo<Integer> created 15.34 - Neg05<?>.Foo<?> f11 = new Neg05.Foo<>("", ""); //new Foo<Object> created 15.35 - Neg05<?>.Foo<? super String> f12 = new Neg05.Foo<>("", ""); //new Foo<Object> created 15.36 - 15.37 - Neg05<?>.Foo<String> f13 = new Neg05.Foo<>("", ""){}; //new Foo<Integer> created 15.38 - Neg05<?>.Foo<? extends String> f14 = new Neg05.Foo<>("", ""){}; //new Foo<Integer> created 15.39 - Neg05<?>.Foo<?> f15 = new Neg05.Foo<>("", ""){}; //new Foo<Object> created 15.40 - Neg05<?>.Foo<? super String> f16 = new Neg05.Foo<>("", ""){}; //new Foo<Object> created 15.41 - } 15.42 - 15.43 - void testRare_2(Neg05 n) { 15.44 - Neg05<?>.Foo<String> f1 = n.new Foo<>(""); //new Foo<Integer> created 15.45 - Neg05<?>.Foo<? extends String> f2 = n.new Foo<>(""); //new Foo<Integer> created 15.46 - Neg05<?>.Foo<?> f3 = n.new Foo<>(""); //new Foo<Integer> created 15.47 - Neg05<?>.Foo<? super String> f4 = n.new Foo<>(""); //new Foo<Integer> created 15.48 - 15.49 - Neg05<?>.Foo<String> f5 = n.new Foo<>(""){}; //new Foo<Integer> created 15.50 - Neg05<?>.Foo<? extends String> f6 = n.new Foo<>(""){}; //new Foo<Integer> created 15.51 - Neg05<?>.Foo<?> f7 = n.new Foo<>(""){}; //new Foo<Integer> created 15.52 - Neg05<?>.Foo<? super String> f8 = n.new Foo<>(""){}; //new Foo<Integer> created 15.53 - 15.54 - Neg05<?>.Foo<String> f9 = n.new Foo<>("", ""); //new Foo<Integer> created 15.55 - Neg05<?>.Foo<? extends String> f10 = n.new Foo<>("", ""); //new Foo<Integer> created 15.56 - Neg05<?>.Foo<?> f11 = n.new Foo<>("", ""); //new Foo<Integer> created 15.57 - Neg05<?>.Foo<? super String> f12 = n.new Foo<>("", ""); //new Foo<Integer> created 15.58 - 15.59 - Neg05<?>.Foo<String> f13 = n.new Foo<>("", ""){}; //new Foo<Integer> created 15.60 - Neg05<?>.Foo<? extends String> f14 = n.new Foo<>("", ""){}; //new Foo<Integer> created 15.61 - Neg05<?>.Foo<?> f15 = n.new Foo<>("", ""){}; //new Foo<Integer> created 15.62 - Neg05<?>.Foo<? super String> f16 = n.new Foo<>("", ""){}; //new Foo<Integer> created 15.63 - } 15.64 -}
16.1 --- a/test/tools/javac/generics/diamond/neg/Neg05.out Fri Apr 09 15:39:39 2010 -0700 16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 16.3 @@ -1,33 +0,0 @@ 16.4 -Neg05.java:19:48: compiler.err.improperly.formed.type.inner.raw.param 16.5 -Neg05.java:20:58: compiler.err.improperly.formed.type.inner.raw.param 16.6 -Neg05.java:21:43: compiler.err.improperly.formed.type.inner.raw.param 16.7 -Neg05.java:22:56: compiler.err.improperly.formed.type.inner.raw.param 16.8 -Neg05.java:24:48: compiler.err.improperly.formed.type.inner.raw.param 16.9 -Neg05.java:25:58: compiler.err.improperly.formed.type.inner.raw.param 16.10 -Neg05.java:26:43: compiler.err.improperly.formed.type.inner.raw.param 16.11 -Neg05.java:27:56: compiler.err.improperly.formed.type.inner.raw.param 16.12 -Neg05.java:29:48: compiler.err.improperly.formed.type.inner.raw.param 16.13 -Neg05.java:30:59: compiler.err.improperly.formed.type.inner.raw.param 16.14 -Neg05.java:31:44: compiler.err.improperly.formed.type.inner.raw.param 16.15 -Neg05.java:32:57: compiler.err.improperly.formed.type.inner.raw.param 16.16 -Neg05.java:34:49: compiler.err.improperly.formed.type.inner.raw.param 16.17 -Neg05.java:35:59: compiler.err.improperly.formed.type.inner.raw.param 16.18 -Neg05.java:36:44: compiler.err.improperly.formed.type.inner.raw.param 16.19 -Neg05.java:37:57: compiler.err.improperly.formed.type.inner.raw.param 16.20 -Neg05.java:41:37: compiler.err.improperly.formed.type.inner.raw.param 16.21 -Neg05.java:42:47: compiler.err.improperly.formed.type.inner.raw.param 16.22 -Neg05.java:43:32: compiler.err.improperly.formed.type.inner.raw.param 16.23 -Neg05.java:44:45: compiler.err.improperly.formed.type.inner.raw.param 16.24 -Neg05.java:46:37: compiler.err.improperly.formed.type.inner.raw.param 16.25 -Neg05.java:47:47: compiler.err.improperly.formed.type.inner.raw.param 16.26 -Neg05.java:48:32: compiler.err.improperly.formed.type.inner.raw.param 16.27 -Neg05.java:49:45: compiler.err.improperly.formed.type.inner.raw.param 16.28 -Neg05.java:51:37: compiler.err.improperly.formed.type.inner.raw.param 16.29 -Neg05.java:52:48: compiler.err.improperly.formed.type.inner.raw.param 16.30 -Neg05.java:53:33: compiler.err.improperly.formed.type.inner.raw.param 16.31 -Neg05.java:54:46: compiler.err.improperly.formed.type.inner.raw.param 16.32 -Neg05.java:56:38: compiler.err.improperly.formed.type.inner.raw.param 16.33 -Neg05.java:57:48: compiler.err.improperly.formed.type.inner.raw.param 16.34 -Neg05.java:58:33: compiler.err.improperly.formed.type.inner.raw.param 16.35 -Neg05.java:59:46: compiler.err.improperly.formed.type.inner.raw.param 16.36 -32 errors
17.1 --- a/test/tools/javac/generics/diamond/pos/Pos01.java Fri Apr 09 15:39:39 2010 -0700 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,44 +0,0 @@ 17.4 -/* 17.5 - * @test /nodynamiccopyright/ 17.6 - * @bug 6840638 17.7 - * 17.8 - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') 17.9 - * @author mcimadamore 17.10 - * @compile Pos01.java -source 1.7 17.11 - * @run main Pos01 17.12 - * 17.13 - */ 17.14 - 17.15 -public class Pos01<X> { 17.16 - 17.17 - Pos01(X x) {} 17.18 - 17.19 - <Z> Pos01(X x, Z z) {} 17.20 - 17.21 - void test() { 17.22 - Pos01<Integer> p1 = new Pos01<>(1); //new Foo<Integer> created 17.23 - Pos01<? extends Integer> p2 = new Pos01<>(1); //new Foo<Integer> created 17.24 - Pos01<?> p3 = new Pos01<>(1); //new Foo<Object> created 17.25 - Pos01<? super Integer> p4 = new Pos01<>(1); //new Foo<Object> created 17.26 - 17.27 - Pos01<Integer> p5 = new Pos01<>(1){}; //new Foo<Integer> created 17.28 - Pos01<? extends Integer> p6 = new Pos01<>(1){}; //new Foo<Integer> created 17.29 - Pos01<?> p7 = new Pos01<>(1){}; //new Foo<Object> created 17.30 - Pos01<? super Integer> p8 = new Pos01<>(1){}; //new Foo<Object> created 17.31 - 17.32 - Pos01<Integer> p9 = new Pos01<>(1, ""); //new Foo<Integer> created 17.33 - Pos01<? extends Integer> p10 = new Pos01<>(1, ""); //new Foo<Integer> created 17.34 - Pos01<?> p11 = new Pos01<>(1, ""); //new Foo<Object> created 17.35 - Pos01<? super Integer> p12 = new Pos01<>(1, ""); //new Foo<Object> created 17.36 - 17.37 - Pos01<Integer> p13 = new Pos01<>(1, ""){}; //new Foo<Integer> created 17.38 - Pos01<? extends Integer> p14= new Pos01<>(1, ""){}; //new Foo<Integer> created 17.39 - Pos01<?> p15 = new Pos01<>(1, ""){}; //new Foo<Object> created 17.40 - Pos01<? super Integer> p16 = new Pos01<>(1, ""){}; //new Foo<Object> created 17.41 - } 17.42 - 17.43 - public static void main(String[] args) { 17.44 - Pos01<String> p1 = new Pos01<>(""); 17.45 - p1.test(); 17.46 - } 17.47 -}
18.1 --- a/test/tools/javac/generics/diamond/pos/Pos02.java Fri Apr 09 15:39:39 2010 -0700 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,67 +0,0 @@ 18.4 -/* 18.5 - * @test /nodynamiccopyright/ 18.6 - * @bug 6840638 18.7 - * 18.8 - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') 18.9 - * @author mcimadamore 18.10 - * @compile Pos02.java -source 1.7 18.11 - * @run main Pos02 18.12 - */ 18.13 - 18.14 -public class Pos02 { 18.15 - 18.16 - static class Foo<X> { 18.17 - Foo(X x) {} 18.18 - <Z> Foo(X x, Z z) {} 18.19 - } 18.20 - 18.21 - void testSimple() { 18.22 - Foo<Integer> f1 = new Foo<>(1); //new Foo<Integer> created 18.23 - Foo<? extends Integer> f2 = new Foo<>(1); //new Foo<Integer> created 18.24 - Foo<?> f3 = new Foo<>(1); //new Foo<Object> created 18.25 - Foo<? super Integer> f4 = new Foo<>(1); //new Foo<Object> created 18.26 - 18.27 - Foo<Integer> f5 = new Foo<>(1){}; //new Foo<Integer> created 18.28 - Foo<? extends Integer> f6 = new Foo<>(1){}; //new Foo<Integer> created 18.29 - Foo<?> f7 = new Foo<>(1){}; //new Foo<Object> created 18.30 - Foo<? super Integer> f8 = new Foo<>(1){}; //new Foo<Object> created 18.31 - 18.32 - Foo<Integer> f9 = new Foo<>(1, ""); //new Foo<Integer> created 18.33 - Foo<? extends Integer> f10 = new Foo<>(1, ""); //new Foo<Integer> created 18.34 - Foo<?> f11 = new Foo<>(1, ""); //new Foo<Object> created 18.35 - Foo<? super Integer> f12 = new Foo<>(1, ""); //new Foo<Object> created 18.36 - 18.37 - Foo<Integer> f13 = new Foo<>(1, ""){}; //new Foo<Integer> created 18.38 - Foo<? extends Integer> f14 = new Foo<>(1, ""){}; //new Foo<Integer> created 18.39 - Foo<?> f15 = new Foo<>(1, ""){}; //new Foo<Object> created 18.40 - Foo<? super Integer> f16 = new Foo<>(1, ""){}; //new Foo<Object> created 18.41 - } 18.42 - 18.43 - void testQualified() { 18.44 - Foo<Integer> f1 = new Pos02.Foo<>(1); //new Foo<Integer> created 18.45 - Foo<? extends Integer> f2 = new Pos02.Foo<>(1); //new Foo<Integer> created 18.46 - Foo<?> f3 = new Pos02.Foo<>(1); //new Foo<Object> created 18.47 - Foo<? super Integer> f4 = new Pos02.Foo<>(1); //new Foo<Object> created 18.48 - 18.49 - Foo<Integer> f5 = new Pos02.Foo<>(1){}; //new Foo<Integer> created 18.50 - Foo<? extends Integer> f6 = new Pos02.Foo<>(1){}; //new Foo<Integer> created 18.51 - Foo<?> f7 = new Pos02.Foo<>(1){}; //new Foo<Object> created 18.52 - Foo<? super Integer> f8 = new Pos02.Foo<>(1){}; //new Foo<Object> created 18.53 - 18.54 - Foo<Integer> f9 = new Pos02.Foo<>(1, ""); //new Foo<Integer> created 18.55 - Foo<? extends Integer> f10 = new Pos02.Foo<>(1, ""); //new Foo<Integer> created 18.56 - Foo<?> f11 = new Pos02.Foo<>(1, ""); //new Foo<Object> created 18.57 - Foo<? super Integer> f12 = new Pos02.Foo<>(1, ""); //new Foo<Object> created 18.58 - 18.59 - Foo<Integer> f13 = new Pos02.Foo<>(1, ""){}; //new Foo<Integer> created 18.60 - Foo<? extends Integer> f14 = new Pos02.Foo<>(1, ""){}; //new Foo<Integer> created 18.61 - Foo<?> f15 = new Pos02.Foo<>(1, ""){}; //new Foo<Object> created 18.62 - Foo<? super Integer> f16 = new Pos02.Foo<>(1, ""){}; //new Foo<Object> created 18.63 - } 18.64 - 18.65 - public static void main(String[] args) { 18.66 - Pos02 p2 = new Pos02(); 18.67 - p2.testSimple(); 18.68 - p2.testQualified(); 18.69 - } 18.70 -}
19.1 --- a/test/tools/javac/generics/diamond/pos/Pos03.java Fri Apr 09 15:39:39 2010 -0700 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,91 +0,0 @@ 19.4 -/* 19.5 - * @test /nodynamiccopyright/ 19.6 - * @bug 6840638 19.7 - * 19.8 - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') 19.9 - * @author mcimadamore 19.10 - * @compile Pos03.java -source 1.7 19.11 - * @run main Pos03 19.12 - * 19.13 - */ 19.14 - 19.15 -public class Pos03<U> { 19.16 - 19.17 - class Foo<V> { 19.18 - Foo(V x) {} 19.19 - <Z> Foo(V x, Z z) {} 19.20 - } 19.21 - 19.22 - void testSimple() { 19.23 - Foo<Integer> f1 = new Foo<>(1); //new Foo<Integer> created 19.24 - Foo<? extends Integer> f2 = new Foo<>(1); //new Foo<Integer> created 19.25 - Foo<?> f3 = new Foo<>(1); //new Foo<Object> created 19.26 - Foo<? super Integer> f4 = new Foo<>(1); //new Foo<Object> created 19.27 - 19.28 - Foo<Integer> f5 = new Foo<>(1){}; //new Foo<Integer> created 19.29 - Foo<? extends Integer> f6 = new Foo<>(1){}; //new Foo<Integer> created 19.30 - Foo<?> f7 = new Foo<>(1){}; //new Foo<Object> created 19.31 - Foo<? super Integer> f8 = new Foo<>(1){}; //new Foo<Object> created 19.32 - 19.33 - Foo<Integer> f9 = new Foo<>(1, ""); //new Foo<Integer> created 19.34 - Foo<? extends Integer> f10 = new Foo<>(1, ""); //new Foo<Integer> created 19.35 - Foo<?> f11 = new Foo<>(1, ""); //new Foo<Object> created 19.36 - Foo<? super Integer> f12 = new Foo<>(1, ""); //new Foo<Object> created 19.37 - 19.38 - Foo<Integer> f13 = new Foo<>(1, ""){}; //new Foo<Integer> created 19.39 - Foo<? extends Integer> f14 = new Foo<>(1, ""){}; //new Foo<Integer> created 19.40 - Foo<?> f15 = new Foo<>(1, ""){}; //new Foo<Object> created 19.41 - Foo<? super Integer> f16 = new Foo<>(1, ""){}; //new Foo<Object> created 19.42 - } 19.43 - 19.44 - void testQualified_1() { 19.45 - Foo<Integer> f1 = new Pos03<U>.Foo<>(1); //new Foo<Integer> created 19.46 - Foo<? extends Integer> f2 = new Pos03<U>.Foo<>(1); //new Foo<Integer> created 19.47 - Foo<?> f3 = new Pos03<U>.Foo<>(1); //new Foo<Object> created 19.48 - Foo<? super Integer> f4 = new Pos03<U>.Foo<>(1); //new Foo<Object> created 19.49 - 19.50 - Foo<Integer> f5 = new Pos03<U>.Foo<>(1){}; //new Foo<Integer> created 19.51 - Foo<? extends Integer> f6 = new Pos03<U>.Foo<>(1){}; //new Foo<Integer> created 19.52 - Foo<?> f7 = new Pos03<U>.Foo<>(1){}; //new Foo<Object> created 19.53 - Foo<? super Integer> f8 = new Pos03<U>.Foo<>(1){}; //new Foo<Object> created 19.54 - 19.55 - Foo<Integer> f9 = new Pos03<U>.Foo<>(1, ""); //new Foo<Integer> created 19.56 - Foo<? extends Integer> f10 = new Pos03<U>.Foo<>(1, ""); //new Foo<Integer> created 19.57 - Foo<?> f11 = new Pos03<U>.Foo<>(1, ""); //new Foo<Object> created 19.58 - Foo<? super Integer> f12 = new Pos03<U>.Foo<>(1, ""); //new Foo<Object> created 19.59 - 19.60 - Foo<Integer> f13 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Integer> created 19.61 - Foo<? extends Integer> f14 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Integer> created 19.62 - Foo<?> f15 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Object> created 19.63 - Foo<? super Integer> f16 = new Pos03<U>.Foo<>(1, ""){}; //new Foo<Object> created 19.64 - } 19.65 - 19.66 - void testQualified_2(Pos03<U> p) { 19.67 - Foo<Integer> f1 = p.new Foo<>(1); //new Foo<Integer> created 19.68 - Foo<? extends Integer> f2 = p.new Foo<>(1); //new Foo<Integer> created 19.69 - Foo<?> f3 = p.new Foo<>(1); //new Foo<Object> created 19.70 - Foo<? super Integer> f4 = p.new Foo<>(1); //new Foo<Object> created 19.71 - 19.72 - Foo<Integer> f5 = p.new Foo<>(1){}; //new Foo<Integer> created 19.73 - Foo<? extends Integer> f6 = p.new Foo<>(1){}; //new Foo<Integer> created 19.74 - Foo<?> f7 = p.new Foo<>(1){}; //new Foo<Object> created 19.75 - Foo<? super Integer> f8 = p.new Foo<>(1){}; //new Foo<Object> created 19.76 - 19.77 - Foo<Integer> f9 = p.new Foo<>(1, ""); //new Foo<Integer> created 19.78 - Foo<? extends Integer> f10 = p.new Foo<>(1, ""); //new Foo<Integer> created 19.79 - Foo<?> f11 = p.new Foo<>(1, ""); //new Foo<Object> created 19.80 - Foo<? super Integer> f12 = p.new Foo<>(1, ""); //new Foo<Object> created 19.81 - 19.82 - Foo<Integer> f13 = p.new Foo<>(1, ""){}; //new Foo<Integer> created 19.83 - Foo<? extends Integer> f14 = p.new Foo<>(1, ""){}; //new Foo<Integer> created 19.84 - Foo<?> f15 = p.new Foo<>(1, ""){}; //new Foo<Object> created 19.85 - Foo<? super Integer> f16 = p.new Foo<>(1, ""){}; //new Foo<Object> created 19.86 - } 19.87 - 19.88 - public static void main(String[] args) { 19.89 - Pos03<String> p3 = new Pos03<>(); 19.90 - p3.testSimple(); 19.91 - p3.testQualified_1(); 19.92 - p3.testQualified_2(p3); 19.93 - } 19.94 -}
20.1 --- a/test/tools/javac/generics/diamond/pos/Pos04.java Fri Apr 09 15:39:39 2010 -0700 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,44 +0,0 @@ 20.4 -/* 20.5 - * @test /nodynamiccopyright/ 20.6 - * @bug 6840638 20.7 - * 20.8 - * @summary Project Coin: Improved Type Inference for Generic Instance Creation (aka 'diamond') 20.9 - * @author mcimadamore 20.10 - * @compile Pos04.java -source 1.7 20.11 - * @run main Pos04 20.12 - * 20.13 - */ 20.14 - 20.15 -public class Pos04<U> { 20.16 - 20.17 - void test() { 20.18 - class Foo<V> { 20.19 - Foo(V x) {} 20.20 - <Z> Foo(V x, Z z) {} 20.21 - } 20.22 - Foo<Integer> p1 = new Foo<>(1); //new Foo<Integer> created 20.23 - Foo<? extends Integer> p2 = new Foo<>(1); //new Foo<Integer> created 20.24 - Foo<?> p3 = new Foo<>(1); //new Foo<Object> created 20.25 - Foo<? super Integer> p4 = new Foo<>(1); //new Foo<Object> created 20.26 - 20.27 - Foo<Integer> p5 = new Foo<>(1){}; //new Foo<Integer> created 20.28 - Foo<? extends Integer> p6 = new Foo<>(1){}; //new Foo<Integer> created 20.29 - Foo<?> p7 = new Foo<>(1){}; //new Foo<Object> created 20.30 - Foo<? super Integer> p8 = new Foo<>(1){}; //new Foo<Object> created 20.31 - 20.32 - Foo<Integer> p9 = new Foo<>(1, ""); //new Foo<Integer> created 20.33 - Foo<? extends Integer> p10 = new Foo<>(1, ""); //new Foo<Integer> created 20.34 - Foo<?> p11 = new Foo<>(1, ""); //new Foo<Object> created 20.35 - Foo<? super Integer> p12 = new Foo<>(1, ""); //new Foo<Object> created 20.36 - 20.37 - Foo<Integer> p13 = new Foo<>(1, ""){}; //new Foo<Integer> created 20.38 - Foo<? extends Integer> p14 = new Foo<>(1, ""){}; //new Foo<Integer> created 20.39 - Foo<?> p15 = new Foo<>(1, ""){}; //new Foo<Object> created 20.40 - Foo<? super Integer> p16 = new Foo<>(1, ""){}; //new Foo<Object> created 20.41 - } 20.42 - 20.43 - public static void main(String[] args) { 20.44 - Pos04<String> p4 = new Pos04<>(); 20.45 - p4.test(); 20.46 - } 20.47 -}
21.1 --- a/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java Fri Apr 09 15:39:39 2010 -0700 21.2 +++ b/test/tools/javac/processing/environment/round/TestElementsAnnotatedWith.java Wed Apr 14 12:23:29 2010 +0100 21.3 @@ -89,7 +89,7 @@ 21.4 // Verify that the annotation information is as 21.5 // expected. 21.6 21.7 - Set<String> expectedNames = new HashSet<>(Arrays.asList(annotatedElementInfo.names())); 21.8 + Set<String> expectedNames = new HashSet<String>(Arrays.asList(annotatedElementInfo.names())); 21.9 21.10 resultsMeta = 21.11 roundEnvironment.
22.1 --- a/test/tools/javac/processing/model/element/TestAnonClassNames.java Fri Apr 09 15:39:39 2010 -0700 22.2 +++ b/test/tools/javac/processing/model/element/TestAnonClassNames.java Wed Apr 14 12:23:29 2010 +0100 22.3 @@ -113,10 +113,10 @@ 22.4 */ 22.5 static void testClassName(String className) { 22.6 JavaCompiler javaCompiler = ToolProvider.getSystemJavaCompiler(); 22.7 - List<String> classNames = new ArrayList<>(); 22.8 + List<String> classNames = new ArrayList<String>(); 22.9 classNames.add(className); 22.10 22.11 - List<String> options = new ArrayList<>(); 22.12 + List<String> options = new ArrayList<String>(); 22.13 options.add("-proc:only"); 22.14 options.add("-classpath"); 22.15 options.add(System.getProperty("test.classes")); 22.16 @@ -128,7 +128,7 @@ 22.17 options, 22.18 classNames, 22.19 null); // Sources 22.20 - List<Processor> processors = new ArrayList<>(); 22.21 + List<Processor> processors = new ArrayList<Processor>(); 22.22 processors.add(new ClassNameProber()); 22.23 compileTask.setProcessors(processors); 22.24 Boolean goodResult = compileTask.call();