Wed, 28 May 2014 11:07:07 -0700
Merge
1.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Wed May 28 02:28:07 2014 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Wed May 28 11:07:07 2014 -0700 1.3 @@ -407,7 +407,7 @@ 1.4 paramTypes = lb.toList(); 1.5 } 1.6 1.7 - ClassSymbol sym = (ClassSymbol) types.upperBound(tsym.type).tsym; 1.8 + ClassSymbol sym = (ClassSymbol) types.cvarUpperBound(tsym.type).tsym; 1.9 1.10 Symbol msym = (memberName == sym.name) 1.11 ? findConstructor(sym, paramTypes)
2.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Wed May 28 02:28:07 2014 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Wed May 28 11:07:07 2014 -0700 2.3 @@ -122,37 +122,34 @@ 2.4 } 2.5 // </editor-fold> 2.6 2.7 - // <editor-fold defaultstate="collapsed" desc="upperBound"> 2.8 - /** 2.9 - * The "rvalue conversion".<br> 2.10 - * The upper bound of most types is the type 2.11 - * itself. Wildcards, on the other hand have upper 2.12 - * and lower bounds. 2.13 - * @param t a type 2.14 - * @return the upper bound of the given type 2.15 - */ 2.16 - public Type upperBound(Type t) { 2.17 - return upperBound.visit(t).unannotatedType(); 2.18 - } 2.19 - // where 2.20 - private final MapVisitor<Void> upperBound = new MapVisitor<Void>() { 2.21 - 2.22 - @Override 2.23 - public Type visitWildcardType(WildcardType t, Void ignored) { 2.24 - if (t.isSuperBound()) 2.25 - return t.bound == null ? syms.objectType : t.bound.bound; 2.26 - else 2.27 - return visit(t.type); 2.28 - } 2.29 - 2.30 - @Override 2.31 - public Type visitCapturedType(CapturedType t, Void ignored) { 2.32 - return visit(t.bound); 2.33 - } 2.34 - }; 2.35 - // </editor-fold> 2.36 - 2.37 - // <editor-fold defaultstate="collapsed" desc="wildLowerBound"> 2.38 + // <editor-fold defaultstate="collapsed" desc="bounds"> 2.39 + /** 2.40 + * Get a wildcard's upper bound, returning non-wildcards unchanged. 2.41 + * @param t a type argument, either a wildcard or a type 2.42 + */ 2.43 + public Type wildUpperBound(Type t) { 2.44 + if (t.hasTag(WILDCARD)) { 2.45 + WildcardType w = (WildcardType) t.unannotatedType(); 2.46 + if (w.isSuperBound()) 2.47 + return w.bound == null ? syms.objectType : w.bound.bound; 2.48 + else 2.49 + return wildUpperBound(w.type); 2.50 + } 2.51 + else return t; 2.52 + } 2.53 + 2.54 + /** 2.55 + * Get a capture variable's upper bound, returning other types unchanged. 2.56 + * @param t a type 2.57 + */ 2.58 + public Type cvarUpperBound(Type t) { 2.59 + if (t.hasTag(TYPEVAR)) { 2.60 + TypeVar v = (TypeVar) t.unannotatedType(); 2.61 + return v.isCaptured() ? cvarUpperBound(v.bound) : v; 2.62 + } 2.63 + else return t; 2.64 + } 2.65 + 2.66 /** 2.67 * Get a wildcard's lower bound, returning non-wildcards unchanged. 2.68 * @param t a type argument, either a wildcard or a type 2.69 @@ -164,9 +161,7 @@ 2.70 } 2.71 else return t; 2.72 } 2.73 - // </editor-fold> 2.74 - 2.75 - // <editor-fold defaultstate="collapsed" desc="cvarLowerBound"> 2.76 + 2.77 /** 2.78 * Get a capture variable's lower bound, returning other types unchanged. 2.79 * @param t a type 2.80 @@ -904,7 +899,7 @@ 2.81 syms.boundClass); 2.82 changed = true; 2.83 } else if (s != orig) { 2.84 - s = new WildcardType(upperBound(s), 2.85 + s = new WildcardType(wildUpperBound(s), 2.86 BoundKind.EXTENDS, 2.87 syms.boundClass); 2.88 changed = true; 2.89 @@ -1113,7 +1108,7 @@ 2.90 //check that u == t, where u has been set by Type.withTypeVar 2.91 return s.isSuperBound() && 2.92 !s.isExtendsBound() && 2.93 - visit(t, upperBound(s)); 2.94 + visit(t, wildUpperBound(s)); 2.95 } 2.96 } 2.97 default: 2.98 @@ -1140,7 +1135,7 @@ 2.99 return visit(s, t); 2.100 2.101 if (s.isSuperBound() && !s.isExtendsBound()) 2.102 - return visit(t, upperBound(s)) && visit(t, wildLowerBound(s)); 2.103 + return visit(t, wildUpperBound(s)) && visit(t, wildLowerBound(s)); 2.104 2.105 if (t.isCompound() && s.isCompound()) { 2.106 if (!visit(supertype(t), supertype(s))) 2.107 @@ -1290,7 +1285,7 @@ 2.108 switch(wt.kind) { 2.109 case UNBOUND: //similar to ? extends Object 2.110 case EXTENDS: { 2.111 - Type bound = upperBound(s); 2.112 + Type bound = wildUpperBound(s); 2.113 undetvar.addBound(InferenceBound.UPPER, bound, this); 2.114 break; 2.115 } 2.116 @@ -1351,28 +1346,6 @@ 2.117 // where 2.118 private TypeRelation containsType = new TypeRelation() { 2.119 2.120 - private Type U(Type t) { 2.121 - while (t.hasTag(WILDCARD)) { 2.122 - WildcardType w = (WildcardType)t.unannotatedType(); 2.123 - if (w.isSuperBound()) 2.124 - return w.bound == null ? syms.objectType : w.bound.bound; 2.125 - else 2.126 - t = w.type; 2.127 - } 2.128 - return t; 2.129 - } 2.130 - 2.131 - private Type L(Type t) { 2.132 - while (t.hasTag(WILDCARD)) { 2.133 - WildcardType w = (WildcardType)t.unannotatedType(); 2.134 - if (w.isExtendsBound()) 2.135 - return syms.botType; 2.136 - else 2.137 - t = w.type; 2.138 - } 2.139 - return t; 2.140 - } 2.141 - 2.142 public Boolean visitType(Type t, Type s) { 2.143 if (s.isPartial()) 2.144 return containedBy(s, t); 2.145 @@ -1384,13 +1357,13 @@ 2.146 // System.err.println(); 2.147 // System.err.format(" does %s contain %s?%n", t, s); 2.148 // System.err.format(" %s U(%s) <: U(%s) %s = %s%n", 2.149 -// upperBound(s), s, t, U(t), 2.150 +// wildUpperBound(s), s, t, wildUpperBound(t), 2.151 // t.isSuperBound() 2.152 -// || isSubtypeNoCapture(upperBound(s), U(t))); 2.153 +// || isSubtypeNoCapture(wildUpperBound(s), wildUpperBound(t))); 2.154 // System.err.format(" %s L(%s) <: L(%s) %s = %s%n", 2.155 -// L(t), t, s, wildLowerBound(s), 2.156 +// wildLowerBound(t), t, s, wildLowerBound(s), 2.157 // t.isExtendsBound() 2.158 -// || isSubtypeNoCapture(L(t), wildLowerBound(s))); 2.159 +// || isSubtypeNoCapture(wildLowerBound(t), wildLowerBound(s))); 2.160 // System.err.println(); 2.161 // } 2.162 2.163 @@ -1402,8 +1375,9 @@ 2.164 // debugContainsType(t, s); 2.165 return isSameWildcard(t, s) 2.166 || isCaptureOf(s, t) 2.167 - || ((t.isExtendsBound() || isSubtypeNoCapture(L(t), wildLowerBound(s))) && 2.168 - (t.isSuperBound() || isSubtypeNoCapture(upperBound(s), U(t)))); 2.169 + || ((t.isExtendsBound() || isSubtypeNoCapture(wildLowerBound(t), wildLowerBound(s))) && 2.170 + // TODO: JDK-8039214, cvarUpperBound call here is incorrect 2.171 + (t.isSuperBound() || isSubtypeNoCapture(cvarUpperBound(wildUpperBound(s)), wildUpperBound(t)))); 2.172 } 2.173 } 2.174 2.175 @@ -1521,7 +1495,7 @@ 2.176 2.177 @Override 2.178 public Boolean visitWildcardType(WildcardType t, Type s) { 2.179 - return isCastable(upperBound(t), s, warnStack.head); 2.180 + return isCastable(wildUpperBound(t), s, warnStack.head); 2.181 } 2.182 2.183 @Override 2.184 @@ -1762,12 +1736,12 @@ 2.185 2.186 if (t.isExtendsBound()) { 2.187 if (s.isExtendsBound()) 2.188 - return !isCastableRecursive(t.type, upperBound(s)); 2.189 + return !isCastableRecursive(t.type, wildUpperBound(s)); 2.190 else if (s.isSuperBound()) 2.191 return notSoftSubtypeRecursive(wildLowerBound(s), t.type); 2.192 } else if (t.isSuperBound()) { 2.193 if (s.isExtendsBound()) 2.194 - return notSoftSubtypeRecursive(t.type, upperBound(s)); 2.195 + return notSoftSubtypeRecursive(t.type, wildUpperBound(s)); 2.196 } 2.197 return false; 2.198 } 2.199 @@ -1803,7 +1777,7 @@ 2.200 noWarnings); 2.201 } 2.202 if (!s.hasTag(WILDCARD)) 2.203 - s = upperBound(s); 2.204 + s = cvarUpperBound(s); 2.205 2.206 return !isSubtype(t, relaxBound(s)); 2.207 } 2.208 @@ -1860,7 +1834,7 @@ 2.209 // <editor-fold defaultstate="collapsed" desc="Array Utils"> 2.210 public boolean isArray(Type t) { 2.211 while (t.hasTag(WILDCARD)) 2.212 - t = upperBound(t); 2.213 + t = wildUpperBound(t); 2.214 return t.hasTag(ARRAY); 2.215 } 2.216 2.217 @@ -1870,7 +1844,7 @@ 2.218 public Type elemtype(Type t) { 2.219 switch (t.getTag()) { 2.220 case WILDCARD: 2.221 - return elemtype(upperBound(t)); 2.222 + return elemtype(wildUpperBound(t)); 2.223 case ARRAY: 2.224 t = t.unannotatedType(); 2.225 return ((ArrayType)t).elemtype; 2.226 @@ -2073,7 +2047,7 @@ 2.227 2.228 @Override 2.229 public Type visitWildcardType(WildcardType t, Symbol sym) { 2.230 - return memberType(upperBound(t), sym); 2.231 + return memberType(wildUpperBound(t), sym); 2.232 } 2.233 2.234 @Override 2.235 @@ -2192,7 +2166,7 @@ 2.236 2.237 @Override 2.238 public Type visitWildcardType(WildcardType t, Boolean recurse) { 2.239 - return erasure(upperBound(t), recurse); 2.240 + return erasure(wildUpperBound(t), recurse); 2.241 } 2.242 2.243 @Override 2.244 @@ -2401,8 +2375,7 @@ 2.245 if (t.hasErasedSupertypes()) { 2.246 t.interfaces_field = erasureRecursive(interfaces); 2.247 } else if (formals.nonEmpty()) { 2.248 - t.interfaces_field = 2.249 - upperBounds(subst(interfaces, formals, actuals)); 2.250 + t.interfaces_field = subst(interfaces, formals, actuals); 2.251 } 2.252 else { 2.253 t.interfaces_field = interfaces; 2.254 @@ -2971,7 +2944,7 @@ 2.255 return new ClassType(outer1, typarams1, t.tsym); 2.256 } else { 2.257 Type st = subst(supertype(t)); 2.258 - List<Type> is = upperBounds(subst(interfaces(t))); 2.259 + List<Type> is = subst(interfaces(t)); 2.260 if (st == supertype(t) && is == interfaces(t)) 2.261 return t; 2.262 else 2.263 @@ -2988,7 +2961,7 @@ 2.264 return t; 2.265 } else { 2.266 if (t.isExtendsBound() && bound.isExtendsBound()) 2.267 - bound = upperBound(bound); 2.268 + bound = wildUpperBound(bound); 2.269 return new WildcardType(bound, t.kind, syms.boundClass, t.bound); 2.270 } 2.271 } 2.272 @@ -3438,8 +3411,8 @@ 2.273 TypePair pair = new TypePair(c1, c2); 2.274 Type m; 2.275 if (mergeCache.add(pair)) { 2.276 - m = new WildcardType(lub(upperBound(act1.head), 2.277 - upperBound(act2.head)), 2.278 + m = new WildcardType(lub(wildUpperBound(act1.head), 2.279 + wildUpperBound(act2.head)), 2.280 BoundKind.EXTENDS, 2.281 syms.boundClass); 2.282 mergeCache.remove(pair); 2.283 @@ -3972,8 +3945,13 @@ 2.284 Si.lower = Ti.getSuperBound(); 2.285 break; 2.286 } 2.287 - if (Si.bound == Si.lower) 2.288 + Type tmpBound = Si.bound.hasTag(UNDETVAR) ? ((UndetVar)Si.bound).qtype : Si.bound; 2.289 + Type tmpLower = Si.lower.hasTag(UNDETVAR) ? ((UndetVar)Si.lower).qtype : Si.lower; 2.290 + if (!Si.bound.hasTag(ERROR) && 2.291 + !Si.lower.hasTag(ERROR) && 2.292 + isSameType(tmpBound, tmpLower, false)) { 2.293 currentS.head = Si.bound; 2.294 + } 2.295 } 2.296 currentA = currentA.tail; 2.297 currentT = currentT.tail; 2.298 @@ -4010,16 +3988,6 @@ 2.299 // </editor-fold> 2.300 2.301 // <editor-fold defaultstate="collapsed" desc="Internal utility methods"> 2.302 - private List<Type> upperBounds(List<Type> ss) { 2.303 - if (ss.isEmpty()) return ss; 2.304 - Type head = upperBound(ss.head); 2.305 - List<Type> tail = upperBounds(ss.tail); 2.306 - if (head != ss.head || tail != ss.tail) 2.307 - return tail.prepend(head); 2.308 - else 2.309 - return ss; 2.310 - } 2.311 - 2.312 private boolean sideCast(Type from, Type to, Warner warn) { 2.313 // We are casting from type $from$ to type $to$, which are 2.314 // non-final unrelated types. This method 2.315 @@ -4176,7 +4144,7 @@ 2.316 @Override 2.317 public Void visitWildcardType(WildcardType source, Type target) throws AdaptFailure { 2.318 if (source.isExtendsBound()) 2.319 - adaptRecursive(upperBound(source), upperBound(target)); 2.320 + adaptRecursive(wildUpperBound(source), wildUpperBound(target)); 2.321 else if (source.isSuperBound()) 2.322 adaptRecursive(wildLowerBound(source), wildLowerBound(target)); 2.323 return null; 2.324 @@ -4193,7 +4161,7 @@ 2.325 val = isSubtype(wildLowerBound(val), wildLowerBound(target)) 2.326 ? target : val; 2.327 } else if (val.isExtendsBound() && target.isExtendsBound()) { 2.328 - val = isSubtype(upperBound(val), upperBound(target)) 2.329 + val = isSubtype(wildUpperBound(val), wildUpperBound(target)) 2.330 ? val : target; 2.331 } else if (!isSameType(val, target)) { 2.332 throw new AdaptFailure(); 2.333 @@ -4304,7 +4272,7 @@ 2.334 } 2.335 2.336 public Type visitType(Type t, Void s) { 2.337 - return high ? upperBound(t) : t; 2.338 + return t; 2.339 } 2.340 2.341 @Override
3.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed May 28 02:28:07 2014 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Wed May 28 11:07:07 2014 -0700 3.3 @@ -1175,7 +1175,7 @@ 3.4 //the Formal Parameter of a for-each loop is not in the scope when 3.5 //attributing the for-each expression; we mimick this by attributing 3.6 //the for-each expression first (against original scope). 3.7 - Type exprType = types.upperBound(attribExpr(tree.expr, loopEnv)); 3.8 + Type exprType = types.cvarUpperBound(attribExpr(tree.expr, loopEnv)); 3.9 attribStat(tree.var, loopEnv); 3.10 chk.checkNonVoid(tree.pos(), exprType); 3.11 Type elemtype = types.elemtype(exprType); // perhaps expr is an array? 3.12 @@ -1192,7 +1192,7 @@ 3.13 List<Type> iterableParams = base.allparams(); 3.14 elemtype = iterableParams.isEmpty() 3.15 ? syms.objectType 3.16 - : types.upperBound(iterableParams.head); 3.17 + : types.wildUpperBound(iterableParams.head); 3.18 } 3.19 } 3.20 chk.checkType(tree.expr.pos(), elemtype, tree.var.sym.type); 3.21 @@ -4671,16 +4671,30 @@ 3.22 private void initTypeIfNeeded(JCTree that) { 3.23 if (that.type == null) { 3.24 if (that.hasTag(METHODDEF)) { 3.25 - that.type = dummyMethodType(); 3.26 + that.type = dummyMethodType((JCMethodDecl)that); 3.27 } else { 3.28 that.type = syms.unknownType; 3.29 } 3.30 } 3.31 } 3.32 3.33 + /* Construct a dummy method type. If we have a method declaration, 3.34 + * and the declared return type is void, then use that return type 3.35 + * instead of UNKNOWN to avoid spurious error messages in lambda 3.36 + * bodies (see:JDK-8041704). 3.37 + */ 3.38 + private Type dummyMethodType(JCMethodDecl md) { 3.39 + Type restype = syms.unknownType; 3.40 + if (md != null && md.restype.hasTag(TYPEIDENT)) { 3.41 + JCPrimitiveTypeTree prim = (JCPrimitiveTypeTree)md.restype; 3.42 + if (prim.typetag == VOID) 3.43 + restype = syms.voidType; 3.44 + } 3.45 + return new MethodType(List.<Type>nil(), restype, 3.46 + List.<Type>nil(), syms.methodClass); 3.47 + } 3.48 private Type dummyMethodType() { 3.49 - return new MethodType(List.<Type>nil(), syms.unknownType, 3.50 - List.<Type>nil(), syms.methodClass); 3.51 + return dummyMethodType(null); 3.52 } 3.53 3.54 @Override
4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Wed May 28 02:28:07 2014 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Wed May 28 11:07:07 2014 -0700 4.3 @@ -618,10 +618,10 @@ 4.4 if (a.isUnbound()) { 4.5 return true; 4.6 } else if (!a.hasTag(WILDCARD)) { 4.7 - a = types.upperBound(a); 4.8 + a = types.cvarUpperBound(a); 4.9 return types.isSubtype(a, bound); 4.10 } else if (a.isExtendsBound()) { 4.11 - return types.isCastable(bound, types.upperBound(a), types.noWarnings); 4.12 + return types.isCastable(bound, types.wildUpperBound(a), types.noWarnings); 4.13 } else if (a.isSuperBound()) { 4.14 return !types.notSoftSubtype(types.wildLowerBound(a), bound); 4.15 }
5.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed May 28 02:28:07 2014 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Wed May 28 11:07:07 2014 -0700 5.3 @@ -3472,7 +3472,7 @@ 5.4 private void visitIterableForeachLoop(JCEnhancedForLoop tree) { 5.5 make_at(tree.expr.pos()); 5.6 Type iteratorTarget = syms.objectType; 5.7 - Type iterableType = types.asSuper(types.upperBound(tree.expr.type), 5.8 + Type iterableType = types.asSuper(types.cvarUpperBound(tree.expr.type), 5.9 syms.iterableType.tsym); 5.10 if (iterableType.getTypeArguments().nonEmpty()) 5.11 iteratorTarget = types.erasure(iterableType.getTypeArguments().head); 5.12 @@ -3506,7 +3506,7 @@ 5.13 List.<Type>nil()); 5.14 JCExpression vardefinit = make.App(make.Select(make.Ident(itvar), next)); 5.15 if (tree.var.type.isPrimitive()) 5.16 - vardefinit = make.TypeCast(types.upperBound(iteratorTarget), vardefinit); 5.17 + vardefinit = make.TypeCast(types.cvarUpperBound(iteratorTarget), vardefinit); 5.18 else 5.19 vardefinit = make.TypeCast(tree.var.type, vardefinit); 5.20 JCVariableDecl indexDef = (JCVariableDecl)make.VarDef(tree.var.mods,
6.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed May 28 02:28:07 2014 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Wed May 28 11:07:07 2014 -0700 6.3 @@ -348,7 +348,7 @@ 6.4 6.5 boolean isAccessible(Env<AttrContext> env, Type t, boolean checkInner) { 6.6 return (t.hasTag(ARRAY)) 6.7 - ? isAccessible(env, types.upperBound(types.elemtype(t))) 6.8 + ? isAccessible(env, types.cvarUpperBound(types.elemtype(t))) 6.9 : isAccessible(env, t.tsym, checkInner); 6.10 } 6.11 6.12 @@ -1011,7 +1011,7 @@ 6.13 */ 6.14 private Type U(Type found) { 6.15 return found == pt ? 6.16 - found : types.upperBound(found); 6.17 + found : types.cvarUpperBound(found); 6.18 } 6.19 6.20 @Override
7.1 --- a/test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out Wed May 28 02:28:07 2014 -0700 7.2 +++ b/test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out Wed May 28 11:07:07 2014 -0700 7.3 @@ -1,3 +1,2 @@ 7.4 -CrashLambdaExpressionWithNonAccessibleIdTest.java:15:35: compiler.err.missing.ret.stmt 7.5 CrashLambdaExpressionWithNonAccessibleIdTest.java:14:17: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, CrashLambdaExpressionWithNonAccessibleIdTest, null) 7.6 -2 errors 7.7 +1 error
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java Wed May 28 11:07:07 2014 -0700 8.3 @@ -0,0 +1,78 @@ 8.4 +/* 8.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 8.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 8.7 + * 8.8 + * This code is free software; you can redistribute it and/or modify it 8.9 + * under the terms of the GNU General Public License version 2 only, as 8.10 + * published by the Free Software Foundation. Oracle designates this 8.11 + * particular file as subject to the "Classpath" exception as provided 8.12 + * by Oracle in the LICENSE file that accompanied this code. 8.13 + * 8.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 8.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 8.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 8.17 + * version 2 for more details (a copy is included in the LICENSE file that 8.18 + * accompanied this code). 8.19 + * 8.20 + * You should have received a copy of the GNU General Public License version 8.21 + * 2 along with this work; if not, write to the Free Software Foundation, 8.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 8.23 + * 8.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 8.25 + * or visit www.oracle.com if you need additional information or have any 8.26 + * questions. 8.27 + */ 8.28 + 8.29 +/* 8.30 + * @test 8.31 + * @bug 8030741 8.32 + * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 8.33 + * @compile EagerReturnTypeResolutionTesta.java 8.34 + */ 8.35 + 8.36 +public class EagerReturnTypeResolutionTesta { 8.37 + 8.38 + abstract class Test1<T>{ 8.39 + abstract <S> S foo(S x, S y); 8.40 + <S extends Number & Comparable<? extends Number>> void baz(Test1<S> a){} 8.41 + 8.42 + void bar(Test1<Long> x, Test1<Integer> y){ 8.43 + baz(foo(x, y)); 8.44 + } 8.45 + } 8.46 + 8.47 + abstract class Test2<T>{ 8.48 + abstract <S> S foo(S x, S y); 8.49 + abstract <S1> void baz(Test2<S1> a); 8.50 + 8.51 + void bar(Test2<Integer> y, Test2<Long> x){ 8.52 + baz(foo(x, y)); 8.53 + } 8.54 + } 8.55 + 8.56 + abstract class Test3<T>{ 8.57 + abstract <S> S foo(S x, S y); 8.58 + <T extends Number & Comparable<?>, 8.59 + S extends Number & Comparable<? extends T>> void baz(Test3<S> a){} 8.60 + 8.61 + void bar(Test3<Long> x, Test3<Integer> y){ 8.62 + baz(foo(x, y)); 8.63 + } 8.64 + } 8.65 + 8.66 + abstract class Test4 { 8.67 + abstract class A0<T> {} 8.68 + 8.69 + abstract class A1<T> extends A0<T> {} 8.70 + 8.71 + abstract class A2<T> extends A0<T> {} 8.72 + 8.73 + abstract <S> S foo(S x, S y); 8.74 + abstract <S1> void baz(A0<S1> a); 8.75 + 8.76 + void bar(A2<Integer> y, A1<Long> x){ 8.77 + baz(foo(x, y)); 8.78 + } 8.79 + } 8.80 + 8.81 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java Wed May 28 11:07:07 2014 -0700 9.3 @@ -0,0 +1,182 @@ 9.4 +/* 9.5 + * @test /nodynamiccopyright/ 9.6 + * @bug 8030741 9.7 + * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 9.8 + * @compile/fail/ref=EagerReturnTypeResolutionTestb.out -XDrawDiagnostics EagerReturnTypeResolutionTestb.java 9.9 + * @author Dan Smith 9.10 + */ 9.11 + 9.12 +import java.util.List; 9.13 + 9.14 +public class EagerReturnTypeResolutionTestb { 9.15 + interface I<S> {} 9.16 + interface J<S> extends I<S> {} 9.17 + interface K extends I<String> {} 9.18 + interface L<S> extends I {} 9.19 + 9.20 + <T> T lower(List<? extends T> l) { return null; } 9.21 + <T> T lower2(List<? extends T> l1, List<? extends T> l2) { return null; } 9.22 + 9.23 + <T> T upper(List<? super T> l) { return null; } 9.24 + <T> T upper2(List<? super T> l1, List<? super T> l2) { return null; } 9.25 + 9.26 + <T> T eq(List<T> l) { return null; } 9.27 + <T> T eq2(List<T> l1, List<T> l2) { return null; } 9.28 + 9.29 + <X> void takeI(I<X> i) {} 9.30 + void takeIString(I<String> i) {} 9.31 + I<String> iStringField; 9.32 + 9.33 + void takeLong(long arg) {} 9.34 + long longField; 9.35 + 9.36 + void testSimpleCaptureOK(List<I<?>> i1) { 9.37 + takeI(lower(i1)); // ok* 9.38 + takeI(eq(i1)); // ok* 9.39 + takeI(upper(i1)); // ok, no capture 9.40 + takeIString(upper(i1)); // ok 9.41 + iStringField = upper(i1); // ok 9.42 + } 9.43 + 9.44 + void testSimpleCaptureKO(List<I<?>> i1) { 9.45 + takeIString(lower(i1)); // ERROR 9.46 + takeIString(eq(i1)); // ERROR 9.47 + iStringField = lower(i1); // ERROR 9.48 + iStringField = eq(i1); // ERROR 9.49 + } 9.50 + 9.51 + void testMultiCaptureOK(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3, 9.52 + List<J<String>> j1, List<J<Integer>> j2, List<K> k1) { 9.53 + /* Lines marked with JDK-8029002 should be uncommented once this bug is 9.54 + * fixed 9.55 + */ 9.56 + takeI(lower2(i1, i2)); // ok* 9.57 + takeI(lower2(i1, i3)); // ok* 9.58 + takeI(upper2(i1, i3)); // ok, no capture* JDK-8029002 9.59 + 9.60 + takeIString(upper2(i1, i3)); // ok, no capture 9.61 + iStringField = upper2(i1, i3); // ok, no capture 9.62 + 9.63 + takeI(lower2(j1, j2)); // ok* 9.64 + takeI(lower2(j1, k1)); // ok, no capture 9.65 + takeI(upper2(j1, k1)); // ok, no capture* JDK-8029002 9.66 + 9.67 + takeIString(lower2(j1, k1)); // ok, no capture 9.68 + takeIString(upper2(j1, k1)); // ok, no capture 9.69 + 9.70 + iStringField = lower2(j1, k1); // ok, no capture 9.71 + iStringField = upper2(j1, k1); // ok, no capture 9.72 + takeI(lower2(j2, k1)); // ok* 9.73 + } 9.74 + 9.75 + void testMultiCaptureKO(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3, 9.76 + List<J<String>> j1, List<J<Integer>> j2, List<K> k1) { 9.77 + takeI(eq2(i1, i2)); // ERROR, bad bounds 9.78 + takeI(upper2(i1, i2)); // ERROR, bad bounds 9.79 + 9.80 + takeIString(lower2(i1, i2)); // ERROR 9.81 + takeIString(eq2(i1, i2)); // ERROR, bad bounds 9.82 + takeIString(upper2(i1, i2)); // ERROR, bad bounds 9.83 + 9.84 + iStringField = lower2(i1, i2); // ERROR 9.85 + iStringField = eq2(i1, i2); // ERROR, bad bounds 9.86 + iStringField = upper2(i1, i2); // ERROR, bad bounds 9.87 + 9.88 + takeI(eq2(i1, i3)); // ERROR, bad bounds 9.89 + takeIString(lower2(i1, i3)); // ERROR 9.90 + takeIString(eq2(i1, i3)); // ERROR, bad bounds 9.91 + 9.92 + iStringField = lower2(i1, i3); // ERROR 9.93 + iStringField = eq2(i1, i3); // ERROR, bad bounds 9.94 + takeI(eq2(j1, j2)); // ERROR, bad bounds 9.95 + takeI(upper2(j1, j2)); // ERROR, bad bounds 9.96 + 9.97 + takeIString(lower2(j1, j2)); // ERROR 9.98 + takeIString(eq2(j1, j2)); // ERROR, bad bounds 9.99 + takeIString(upper2(j1, j2)); // ERROR, bad bounds 9.100 + 9.101 + iStringField = lower2(j1, j2); // ERROR 9.102 + iStringField = eq2(j1, j2); // ERROR, bad bounds 9.103 + iStringField = upper2(j1, j2); // ERROR, bad bounds 9.104 + 9.105 + takeI(eq2(j1, k1)); // ERROR, bad bounds 9.106 + takeIString(eq2(j1, k1)); // ERROR, bad bounds 9.107 + iStringField = eq2(j1, k1); // ERROR, bad bounds 9.108 + takeI(eq2(j2, k1)); // ERROR, bad bounds 9.109 + takeI(upper2(j2, k1)); // ERROR, bad bounds; actual: no error, see JDK-8037474 9.110 + 9.111 + takeIString(lower2(j2, k1)); // ERROR 9.112 + takeIString(eq2(j2, k1)); // ERROR, bad bounds 9.113 + takeIString(upper2(j2, k1)); // ERROR, bad bounds 9.114 + 9.115 + iStringField = lower2(j2, k1); // ERROR 9.116 + iStringField = eq2(j2, k1); // ERROR, bad bounds 9.117 + iStringField = upper2(j2, k1); // ERROR, bad bounds 9.118 + } 9.119 + 9.120 + void testRawOK(List<I> i1, List<J> j1, List<L<String>> l1) { 9.121 + takeI(lower(i1)); // ok, unchecked 9.122 + takeI(eq(i1)); // ok, unchecked 9.123 + takeI(upper(i1)); // ok, no capture, not unchecked 9.124 + 9.125 + takeIString(lower(i1)); // ok, unchecked 9.126 + takeIString(eq(i1)); // ok, unchecked 9.127 + takeIString(upper(i1)); // ok, no capture, not unchecked 9.128 + 9.129 + iStringField = lower(i1); // ok, unchecked 9.130 + iStringField = eq(i1); // ok, unchecked 9.131 + iStringField = upper(i1); // ok, no capture, not unchecked 9.132 + 9.133 + takeI(lower(j1)); // ok, unchecked 9.134 + takeI(eq(j1)); // ok, unchecked 9.135 + takeI(upper(j1)); // bad bounds? -- spec is unclear 9.136 + 9.137 + takeIString(lower(j1)); // ok, unchecked 9.138 + takeIString(eq(j1)); // ok, unchecked 9.139 + takeIString(upper(j1)); // bad bounds? -- spec is unclear 9.140 + 9.141 + iStringField = lower(j1); // ok, unchecked 9.142 + iStringField = eq(j1); // ok, unchecked 9.143 + iStringField = upper(j1); // bad bounds? -- spec is unclear 9.144 + 9.145 + takeI(lower(l1)); // ok, unchecked 9.146 + takeI(eq(l1)); // ok, unchecked 9.147 + takeI(upper(l1)); // bad bounds? -- spec is unclear 9.148 + 9.149 + takeIString(lower(l1)); // ok, unchecked 9.150 + takeIString(eq(l1)); // ok, unchecked 9.151 + takeIString(upper(l1)); // bad bounds? -- spec is unclear 9.152 + 9.153 + iStringField = lower(l1); // ok, unchecked 9.154 + iStringField = eq(l1); // ok, unchecked 9.155 + iStringField = upper(l1); // bad bounds? -- spec is unclear 9.156 + } 9.157 + 9.158 + void testPrimOK(List<Integer> i1, List<Long> l1, List<Double> d1) { 9.159 + takeLong(lower(i1)); // ok 9.160 + takeLong(eq(i1)); // ok 9.161 + takeLong(upper(i1)); // ok* 9.162 + 9.163 + longField = lower(i1); // ok 9.164 + longField = eq(i1); // ok 9.165 + longField = upper(i1); // ok* 9.166 + 9.167 + takeLong(lower(l1)); // ok 9.168 + takeLong(eq(l1)); // ok 9.169 + takeLong(upper(l1)); // ok 9.170 + 9.171 + longField = lower(l1); // ok 9.172 + longField = eq(l1); // ok 9.173 + longField = upper(l1); // ok 9.174 + } 9.175 + 9.176 + void testPrimKO(List<Integer> i1, List<Long> l1, List<Double> d1) { 9.177 + takeLong(lower(d1)); // ERROR 9.178 + takeLong(eq(d1)); // ERROR 9.179 + takeLong(upper(d1)); // ERROR 9.180 + 9.181 + longField = lower(d1); // ERROR 9.182 + longField = eq(d1); // ERROR 9.183 + longField = upper(d1); // ERROR 9.184 + } 9.185 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out Wed May 28 11:07:07 2014 -0700 10.3 @@ -0,0 +1,45 @@ 10.4 +EagerReturnTypeResolutionTestb.java:42:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 10.5 +EagerReturnTypeResolutionTestb.java:43:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 10.6 +EagerReturnTypeResolutionTestb.java:44:29: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 10.7 +EagerReturnTypeResolutionTestb.java:45:26: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 10.8 +EagerReturnTypeResolutionTestb.java:74:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 10.9 +EagerReturnTypeResolutionTestb.java:75:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 10.10 +EagerReturnTypeResolutionTestb.java:77:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 10.11 +EagerReturnTypeResolutionTestb.java:78:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 10.12 +EagerReturnTypeResolutionTestb.java:79:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 10.13 +EagerReturnTypeResolutionTestb.java:81:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 10.14 +EagerReturnTypeResolutionTestb.java:82:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 10.15 +EagerReturnTypeResolutionTestb.java:83:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 10.16 +EagerReturnTypeResolutionTestb.java:85:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 10.17 +EagerReturnTypeResolutionTestb.java:86:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 10.18 +EagerReturnTypeResolutionTestb.java:87:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 10.19 +EagerReturnTypeResolutionTestb.java:89:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 10.20 +EagerReturnTypeResolutionTestb.java:90:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 10.21 +EagerReturnTypeResolutionTestb.java:91:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>) 10.22 +EagerReturnTypeResolutionTestb.java:92:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object) 10.23 +EagerReturnTypeResolutionTestb.java:94:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.J<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 10.24 +EagerReturnTypeResolutionTestb.java:95:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>) 10.25 +EagerReturnTypeResolutionTestb.java:96:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object) 10.26 +EagerReturnTypeResolutionTestb.java:98:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 10.27 +EagerReturnTypeResolutionTestb.java:99:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>) 10.28 +EagerReturnTypeResolutionTestb.java:100:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object) 10.29 +EagerReturnTypeResolutionTestb.java:102:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>) 10.30 +EagerReturnTypeResolutionTestb.java:103:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>) 10.31 +EagerReturnTypeResolutionTestb.java:104:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>) 10.32 +EagerReturnTypeResolutionTestb.java:105:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>) 10.33 +EagerReturnTypeResolutionTestb.java:106:9: compiler.err.cant.apply.symbol: kindname.method, takeI, EagerReturnTypeResolutionTestb.I<X>, java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.Integer, java.lang.Integer,java.lang.String) 10.34 +EagerReturnTypeResolutionTestb.java:108:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 10.35 +EagerReturnTypeResolutionTestb.java:109:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>) 10.36 +EagerReturnTypeResolutionTestb.java:110:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.I<java.lang.String>,EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)) 10.37 +EagerReturnTypeResolutionTestb.java:112:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 10.38 +EagerReturnTypeResolutionTestb.java:113:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>) 10.39 +EagerReturnTypeResolutionTestb.java:114:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.I<java.lang.String>,EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object) 10.40 +EagerReturnTypeResolutionTestb.java:174:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long)) 10.41 +EagerReturnTypeResolutionTestb.java:175:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long)) 10.42 +EagerReturnTypeResolutionTestb.java:176:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long)) 10.43 +EagerReturnTypeResolutionTestb.java:178:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 10.44 +EagerReturnTypeResolutionTestb.java:179:23: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 10.45 +EagerReturnTypeResolutionTestb.java:180:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 10.46 +- compiler.note.unchecked.filename: EagerReturnTypeResolutionTestb.java 10.47 +- compiler.note.unchecked.recompile 10.48 +42 errors
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/test/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java Wed May 28 11:07:07 2014 -0700 11.3 @@ -0,0 +1,25 @@ 11.4 +/* 11.5 + * @test /nodynamiccopyright/ 11.6 + * @bug 8030741 11.7 + * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 11.8 + * @compile/fail/ref=PrimitiveTypeBoxingTest.out -XDrawDiagnostics PrimitiveTypeBoxingTest.java 11.9 + */ 11.10 + 11.11 +public class PrimitiveTypeBoxingTest { 11.12 + 11.13 + static void foo(long arg) {} 11.14 + static void bar(int arg) {} 11.15 + 11.16 + interface F<X> { void get(X arg); } 11.17 + 11.18 + <Z> void m1(F<Z> f, Z arg) {} 11.19 + <Z> void m2(Z arg, F<Z> f) {} 11.20 + 11.21 + void test() { 11.22 + m1(PrimitiveTypeBoxingTest::foo, 23); // expected: error 11.23 + m2(23, PrimitiveTypeBoxingTest::foo); // expected: error 11.24 + 11.25 + m1(PrimitiveTypeBoxingTest::bar, 23); // expected: success 11.26 + m2(23, PrimitiveTypeBoxingTest::bar); // expected: success 11.27 + } 11.28 +}
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/test/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out Wed May 28 11:07:07 2014 -0700 12.3 @@ -0,0 +1,3 @@ 12.4 +PrimitiveTypeBoxingTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, m1, PrimitiveTypeBoxingTest.F<Z>,Z, @490,int, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.Long,java.lang.Object) 12.5 +PrimitiveTypeBoxingTest.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m2, Z,PrimitiveTypeBoxingTest.F<Z>, int,@559, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.Long,java.lang.Object) 12.6 +2 errors
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/test/tools/javac/generics/wildcards/RefQueue.java Wed May 28 11:07:07 2014 -0700 13.3 @@ -0,0 +1,24 @@ 13.4 +/* 13.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 13.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 13.7 + * 13.8 + * This code is free software; you can redistribute it and/or modify it 13.9 + * under the terms of the GNU General Public License version 2 only, as 13.10 + * published by the Free Software Foundation. 13.11 + * 13.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 13.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 13.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 13.15 + * version 2 for more details (a copy is included in the LICENSE file that 13.16 + * accompanied this code). 13.17 + * 13.18 + * You should have received a copy of the GNU General Public License version 13.19 + * 2 along with this work; if not, write to the Free Software Foundation, 13.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 13.21 + * 13.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 13.23 + * or visit www.oracle.com if you need additional information or have any 13.24 + * questions. 13.25 + */ 13.26 + 13.27 +public class RefQueue<S> { }
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/test/tools/javac/generics/wildcards/RefQueueBug.java Wed May 28 11:07:07 2014 -0700 14.3 @@ -0,0 +1,38 @@ 14.4 +/* 14.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 14.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 14.7 + * 14.8 + * This code is free software; you can redistribute it and/or modify it 14.9 + * under the terms of the GNU General Public License version 2 only, as 14.10 + * published by the Free Software Foundation. 14.11 + * 14.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 14.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 14.15 + * version 2 for more details (a copy is included in the LICENSE file that 14.16 + * accompanied this code). 14.17 + * 14.18 + * You should have received a copy of the GNU General Public License version 14.19 + * 2 along with this work; if not, write to the Free Software Foundation, 14.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 14.21 + * 14.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 14.23 + * or visit www.oracle.com if you need additional information or have any 14.24 + * questions. 14.25 + */ 14.26 + 14.27 +/* 14.28 + * @test 14.29 + * @bug 8033437 14.30 + * @summary inconsistent generic types behaviour when compiling together vs. separate 14.31 + * @compile RefQueue.java 14.32 + * @compile RefQueueBug.java 14.33 + */ 14.34 + 14.35 +public class RefQueueBug<T> { 14.36 + final RefQueue<? super T> queue = new RefQueue<>(); 14.37 + public static void main(String[] args) { 14.38 + RefQueueBug<Object> r = new RefQueueBug<>(); 14.39 + RefQueue<Object> q = r.queue; 14.40 + } 14.41 +}
15.1 --- a/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java Wed May 28 02:28:07 2014 -0700 15.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 15.3 @@ -1,78 +0,0 @@ 15.4 -/* 15.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 15.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 15.7 - * 15.8 - * This code is free software; you can redistribute it and/or modify it 15.9 - * under the terms of the GNU General Public License version 2 only, as 15.10 - * published by the Free Software Foundation. Oracle designates this 15.11 - * particular file as subject to the "Classpath" exception as provided 15.12 - * by Oracle in the LICENSE file that accompanied this code. 15.13 - * 15.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 15.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.17 - * version 2 for more details (a copy is included in the LICENSE file that 15.18 - * accompanied this code). 15.19 - * 15.20 - * You should have received a copy of the GNU General Public License version 15.21 - * 2 along with this work; if not, write to the Free Software Foundation, 15.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.23 - * 15.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 15.25 - * or visit www.oracle.com if you need additional information or have any 15.26 - * questions. 15.27 - */ 15.28 - 15.29 -/* 15.30 - * @test 15.31 - * @bug 8030741 15.32 - * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 15.33 - * @compile EagerReturnTypeResolutionTesta.java 15.34 - */ 15.35 - 15.36 -public class EagerReturnTypeResolutionTesta { 15.37 - 15.38 - abstract class Test1<T>{ 15.39 - abstract <S> S foo(S x, S y); 15.40 - <S extends Number & Comparable<? extends Number>> void baz(Test1<S> a){} 15.41 - 15.42 - void bar(Test1<Long> x, Test1<Integer> y){ 15.43 - baz(foo(x, y)); 15.44 - } 15.45 - } 15.46 - 15.47 - abstract class Test2<T>{ 15.48 - abstract <S> S foo(S x, S y); 15.49 - abstract <S1> void baz(Test2<S1> a); 15.50 - 15.51 - void bar(Test2<Integer> y, Test2<Long> x){ 15.52 - baz(foo(x, y)); 15.53 - } 15.54 - } 15.55 - 15.56 - abstract class Test3<T>{ 15.57 - abstract <S> S foo(S x, S y); 15.58 - <T extends Number & Comparable<?>, 15.59 - S extends Number & Comparable<? extends T>> void baz(Test3<S> a){} 15.60 - 15.61 - void bar(Test3<Long> x, Test3<Integer> y){ 15.62 - baz(foo(x, y)); 15.63 - } 15.64 - } 15.65 - 15.66 - abstract class Test4 { 15.67 - abstract class A0<T> {} 15.68 - 15.69 - abstract class A1<T> extends A0<T> {} 15.70 - 15.71 - abstract class A2<T> extends A0<T> {} 15.72 - 15.73 - abstract <S> S foo(S x, S y); 15.74 - abstract <S1> void baz(A0<S1> a); 15.75 - 15.76 - void bar(A2<Integer> y, A1<Long> x){ 15.77 - baz(foo(x, y)); 15.78 - } 15.79 - } 15.80 - 15.81 -}
16.1 --- a/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java Wed May 28 02:28:07 2014 -0700 16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 16.3 @@ -1,182 +0,0 @@ 16.4 -/* 16.5 - * @test /nodynamiccopyright/ 16.6 - * @bug 8030741 16.7 - * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 16.8 - * @compile/fail/ref=EagerReturnTypeResolutionTestb.out -XDrawDiagnostics EagerReturnTypeResolutionTestb.java 16.9 - * @author Dan Smith 16.10 - */ 16.11 - 16.12 -import java.util.List; 16.13 - 16.14 -public class EagerReturnTypeResolutionTestb { 16.15 - interface I<S> {} 16.16 - interface J<S> extends I<S> {} 16.17 - interface K extends I<String> {} 16.18 - interface L<S> extends I {} 16.19 - 16.20 - <T> T lower(List<? extends T> l) { return null; } 16.21 - <T> T lower2(List<? extends T> l1, List<? extends T> l2) { return null; } 16.22 - 16.23 - <T> T upper(List<? super T> l) { return null; } 16.24 - <T> T upper2(List<? super T> l1, List<? super T> l2) { return null; } 16.25 - 16.26 - <T> T eq(List<T> l) { return null; } 16.27 - <T> T eq2(List<T> l1, List<T> l2) { return null; } 16.28 - 16.29 - <X> void takeI(I<X> i) {} 16.30 - void takeIString(I<String> i) {} 16.31 - I<String> iStringField; 16.32 - 16.33 - void takeLong(long arg) {} 16.34 - long longField; 16.35 - 16.36 - void testSimpleCaptureOK(List<I<?>> i1) { 16.37 - takeI(lower(i1)); // ok* 16.38 - takeI(eq(i1)); // ok* 16.39 - takeI(upper(i1)); // ok, no capture 16.40 - takeIString(upper(i1)); // ok 16.41 - iStringField = upper(i1); // ok 16.42 - } 16.43 - 16.44 - void testSimpleCaptureKO(List<I<?>> i1) { 16.45 - takeIString(lower(i1)); // ERROR 16.46 - takeIString(eq(i1)); // ERROR 16.47 - iStringField = lower(i1); // ERROR 16.48 - iStringField = eq(i1); // ERROR 16.49 - } 16.50 - 16.51 - void testMultiCaptureOK(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3, 16.52 - List<J<String>> j1, List<J<Integer>> j2, List<K> k1) { 16.53 - /* Lines marked with JDK-8029002 should be uncommented once this bug is 16.54 - * fixed 16.55 - */ 16.56 - takeI(lower2(i1, i2)); // ok* 16.57 - takeI(lower2(i1, i3)); // ok* 16.58 - takeI(upper2(i1, i3)); // ok, no capture* JDK-8029002 16.59 - 16.60 - takeIString(upper2(i1, i3)); // ok, no capture 16.61 - iStringField = upper2(i1, i3); // ok, no capture 16.62 - 16.63 - takeI(lower2(j1, j2)); // ok* 16.64 - takeI(lower2(j1, k1)); // ok, no capture 16.65 - takeI(upper2(j1, k1)); // ok, no capture* JDK-8029002 16.66 - 16.67 - takeIString(lower2(j1, k1)); // ok, no capture 16.68 - takeIString(upper2(j1, k1)); // ok, no capture 16.69 - 16.70 - iStringField = lower2(j1, k1); // ok, no capture 16.71 - iStringField = upper2(j1, k1); // ok, no capture 16.72 - takeI(lower2(j2, k1)); // ok* 16.73 - } 16.74 - 16.75 - void testMultiCaptureKO(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3, 16.76 - List<J<String>> j1, List<J<Integer>> j2, List<K> k1) { 16.77 - takeI(eq2(i1, i2)); // ERROR, bad bounds 16.78 - takeI(upper2(i1, i2)); // ERROR, bad bounds 16.79 - 16.80 - takeIString(lower2(i1, i2)); // ERROR 16.81 - takeIString(eq2(i1, i2)); // ERROR, bad bounds 16.82 - takeIString(upper2(i1, i2)); // ERROR, bad bounds 16.83 - 16.84 - iStringField = lower2(i1, i2); // ERROR 16.85 - iStringField = eq2(i1, i2); // ERROR, bad bounds 16.86 - iStringField = upper2(i1, i2); // ERROR, bad bounds 16.87 - 16.88 - takeI(eq2(i1, i3)); // ERROR, bad bounds 16.89 - takeIString(lower2(i1, i3)); // ERROR 16.90 - takeIString(eq2(i1, i3)); // ERROR, bad bounds 16.91 - 16.92 - iStringField = lower2(i1, i3); // ERROR 16.93 - iStringField = eq2(i1, i3); // ERROR, bad bounds 16.94 - takeI(eq2(j1, j2)); // ERROR, bad bounds 16.95 - takeI(upper2(j1, j2)); // ERROR, bad bounds 16.96 - 16.97 - takeIString(lower2(j1, j2)); // ERROR 16.98 - takeIString(eq2(j1, j2)); // ERROR, bad bounds 16.99 - takeIString(upper2(j1, j2)); // ERROR, bad bounds 16.100 - 16.101 - iStringField = lower2(j1, j2); // ERROR 16.102 - iStringField = eq2(j1, j2); // ERROR, bad bounds 16.103 - iStringField = upper2(j1, j2); // ERROR, bad bounds 16.104 - 16.105 - takeI(eq2(j1, k1)); // ERROR, bad bounds 16.106 - takeIString(eq2(j1, k1)); // ERROR, bad bounds 16.107 - iStringField = eq2(j1, k1); // ERROR, bad bounds 16.108 - takeI(eq2(j2, k1)); // ERROR, bad bounds 16.109 - takeI(upper2(j2, k1)); // ERROR, bad bounds; actual: no error, see JDK-8037474 16.110 - 16.111 - takeIString(lower2(j2, k1)); // ERROR 16.112 - takeIString(eq2(j2, k1)); // ERROR, bad bounds 16.113 - takeIString(upper2(j2, k1)); // ERROR, bad bounds 16.114 - 16.115 - iStringField = lower2(j2, k1); // ERROR 16.116 - iStringField = eq2(j2, k1); // ERROR, bad bounds 16.117 - iStringField = upper2(j2, k1); // ERROR, bad bounds 16.118 - } 16.119 - 16.120 - void testRawOK(List<I> i1, List<J> j1, List<L<String>> l1) { 16.121 - takeI(lower(i1)); // ok, unchecked 16.122 - takeI(eq(i1)); // ok, unchecked 16.123 - takeI(upper(i1)); // ok, no capture, not unchecked 16.124 - 16.125 - takeIString(lower(i1)); // ok, unchecked 16.126 - takeIString(eq(i1)); // ok, unchecked 16.127 - takeIString(upper(i1)); // ok, no capture, not unchecked 16.128 - 16.129 - iStringField = lower(i1); // ok, unchecked 16.130 - iStringField = eq(i1); // ok, unchecked 16.131 - iStringField = upper(i1); // ok, no capture, not unchecked 16.132 - 16.133 - takeI(lower(j1)); // ok, unchecked 16.134 - takeI(eq(j1)); // ok, unchecked 16.135 - takeI(upper(j1)); // bad bounds? -- spec is unclear 16.136 - 16.137 - takeIString(lower(j1)); // ok, unchecked 16.138 - takeIString(eq(j1)); // ok, unchecked 16.139 - takeIString(upper(j1)); // bad bounds? -- spec is unclear 16.140 - 16.141 - iStringField = lower(j1); // ok, unchecked 16.142 - iStringField = eq(j1); // ok, unchecked 16.143 - iStringField = upper(j1); // bad bounds? -- spec is unclear 16.144 - 16.145 - takeI(lower(l1)); // ok, unchecked 16.146 - takeI(eq(l1)); // ok, unchecked 16.147 - takeI(upper(l1)); // bad bounds? -- spec is unclear 16.148 - 16.149 - takeIString(lower(l1)); // ok, unchecked 16.150 - takeIString(eq(l1)); // ok, unchecked 16.151 - takeIString(upper(l1)); // bad bounds? -- spec is unclear 16.152 - 16.153 - iStringField = lower(l1); // ok, unchecked 16.154 - iStringField = eq(l1); // ok, unchecked 16.155 - iStringField = upper(l1); // bad bounds? -- spec is unclear 16.156 - } 16.157 - 16.158 - void testPrimOK(List<Integer> i1, List<Long> l1, List<Double> d1) { 16.159 - takeLong(lower(i1)); // ok 16.160 - takeLong(eq(i1)); // ok 16.161 - takeLong(upper(i1)); // ok* 16.162 - 16.163 - longField = lower(i1); // ok 16.164 - longField = eq(i1); // ok 16.165 - longField = upper(i1); // ok* 16.166 - 16.167 - takeLong(lower(l1)); // ok 16.168 - takeLong(eq(l1)); // ok 16.169 - takeLong(upper(l1)); // ok 16.170 - 16.171 - longField = lower(l1); // ok 16.172 - longField = eq(l1); // ok 16.173 - longField = upper(l1); // ok 16.174 - } 16.175 - 16.176 - void testPrimKO(List<Integer> i1, List<Long> l1, List<Double> d1) { 16.177 - takeLong(lower(d1)); // ERROR 16.178 - takeLong(eq(d1)); // ERROR 16.179 - takeLong(upper(d1)); // ERROR 16.180 - 16.181 - longField = lower(d1); // ERROR 16.182 - longField = eq(d1); // ERROR 16.183 - longField = upper(d1); // ERROR 16.184 - } 16.185 -}
17.1 --- a/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out Wed May 28 02:28:07 2014 -0700 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,45 +0,0 @@ 17.4 -EagerReturnTypeResolutionTestb.java:42:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 17.5 -EagerReturnTypeResolutionTestb.java:43:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 17.6 -EagerReturnTypeResolutionTestb.java:44:29: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 17.7 -EagerReturnTypeResolutionTestb.java:45:26: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 17.8 -EagerReturnTypeResolutionTestb.java:74:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 17.9 -EagerReturnTypeResolutionTestb.java:75:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 17.10 -EagerReturnTypeResolutionTestb.java:77:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 17.11 -EagerReturnTypeResolutionTestb.java:78:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 17.12 -EagerReturnTypeResolutionTestb.java:79:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 17.13 -EagerReturnTypeResolutionTestb.java:81:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 17.14 -EagerReturnTypeResolutionTestb.java:82:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 17.15 -EagerReturnTypeResolutionTestb.java:83:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<java.lang.Integer>, EagerReturnTypeResolutionTestb.I<java.lang.Integer>,EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 17.16 -EagerReturnTypeResolutionTestb.java:85:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 17.17 -EagerReturnTypeResolutionTestb.java:86:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ?>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 17.18 -EagerReturnTypeResolutionTestb.java:87:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 17.19 -EagerReturnTypeResolutionTestb.java:89:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 17.20 -EagerReturnTypeResolutionTestb.java:90:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.I<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.I<?>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.I<?>, EagerReturnTypeResolutionTestb.I<?>,EagerReturnTypeResolutionTestb.I<java.lang.String>) 17.21 -EagerReturnTypeResolutionTestb.java:91:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>) 17.22 -EagerReturnTypeResolutionTestb.java:92:15: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object) 17.23 -EagerReturnTypeResolutionTestb.java:94:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.J<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 17.24 -EagerReturnTypeResolutionTestb.java:95:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>) 17.25 -EagerReturnTypeResolutionTestb.java:96:21: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object) 17.26 -EagerReturnTypeResolutionTestb.java:98:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 17.27 -EagerReturnTypeResolutionTestb.java:99:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>) 17.28 -EagerReturnTypeResolutionTestb.java:100:24: compiler.err.cant.apply.symbol: kindname.method, upper2, java.util.List<? super T>,java.util.List<? super T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.J<java.lang.Integer>, EagerReturnTypeResolutionTestb.J<java.lang.Integer>,EagerReturnTypeResolutionTestb.J<java.lang.String>,java.lang.Object) 17.29 -EagerReturnTypeResolutionTestb.java:102:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>) 17.30 -EagerReturnTypeResolutionTestb.java:103:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>) 17.31 -EagerReturnTypeResolutionTestb.java:104:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.String>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.String>) 17.32 -EagerReturnTypeResolutionTestb.java:105:15: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>) 17.33 -EagerReturnTypeResolutionTestb.java:106:9: compiler.err.cant.apply.symbol: kindname.method, takeI, EagerReturnTypeResolutionTestb.I<X>, java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: java.lang.Integer, java.lang.Integer,java.lang.String) 17.34 -EagerReturnTypeResolutionTestb.java:108:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, EagerReturnTypeResolutionTestb.I<compiler.misc.type.captureof: 1, ? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object)) 17.35 -EagerReturnTypeResolutionTestb.java:109:21: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>) 17.36 -EagerReturnTypeResolutionTestb.java:110:9: compiler.err.cant.apply.symbol: kindname.method, takeIString, EagerReturnTypeResolutionTestb.I<java.lang.String>, java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.I<java.lang.String>,EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object)) 17.37 -EagerReturnTypeResolutionTestb.java:112:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: EagerReturnTypeResolutionTestb.I<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<? extends java.lang.Object&java.io.Serializable&java.lang.Comparable<?>>>, EagerReturnTypeResolutionTestb.I<java.lang.String>,java.lang.Object) 17.38 -EagerReturnTypeResolutionTestb.java:113:24: compiler.err.cant.apply.symbol: kindname.method, eq2, java.util.List<T>,java.util.List<T>, java.util.List<EagerReturnTypeResolutionTestb.J<java.lang.Integer>>,java.util.List<EagerReturnTypeResolutionTestb.K>, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.inferred.do.not.conform.to.eq.bounds: EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>) 17.39 -EagerReturnTypeResolutionTestb.java:114:30: compiler.err.prob.found.req: (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Object&EagerReturnTypeResolutionTestb.J<java.lang.Integer>&EagerReturnTypeResolutionTestb.K, EagerReturnTypeResolutionTestb.I<java.lang.String>,EagerReturnTypeResolutionTestb.K,EagerReturnTypeResolutionTestb.J<java.lang.Integer>,java.lang.Object) 17.40 -EagerReturnTypeResolutionTestb.java:174:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long)) 17.41 -EagerReturnTypeResolutionTestb.java:175:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long)) 17.42 -EagerReturnTypeResolutionTestb.java:176:9: compiler.err.cant.apply.symbol: kindname.method, takeLong, long, java.lang.Double, kindname.class, EagerReturnTypeResolutionTestb, (compiler.misc.no.conforming.assignment.exists: (compiler.misc.infer.no.conforming.instance.exists: , T, long)) 17.43 -EagerReturnTypeResolutionTestb.java:178:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 17.44 -EagerReturnTypeResolutionTestb.java:179:23: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 17.45 -EagerReturnTypeResolutionTestb.java:180:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 17.46 -- compiler.note.unchecked.filename: EagerReturnTypeResolutionTestb.java 17.47 -- compiler.note.unchecked.recompile 17.48 -42 errors
18.1 --- a/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java Wed May 28 02:28:07 2014 -0700 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,25 +0,0 @@ 18.4 -/* 18.5 - * @test /nodynamiccopyright/ 18.6 - * @bug 8030741 18.7 - * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 18.8 - * @compile/fail/ref=PrimitiveTypeBoxingTest.out -XDrawDiagnostics PrimitiveTypeBoxingTest.java 18.9 - */ 18.10 - 18.11 -public class PrimitiveTypeBoxingTest { 18.12 - 18.13 - static void foo(long arg) {} 18.14 - static void bar(int arg) {} 18.15 - 18.16 - interface F<X> { void get(X arg); } 18.17 - 18.18 - <Z> void m1(F<Z> f, Z arg) {} 18.19 - <Z> void m2(Z arg, F<Z> f) {} 18.20 - 18.21 - void test() { 18.22 - m1(PrimitiveTypeBoxingTest::foo, 23); // expected: error 18.23 - m2(23, PrimitiveTypeBoxingTest::foo); // expected: error 18.24 - 18.25 - m1(PrimitiveTypeBoxingTest::bar, 23); // expected: success 18.26 - m2(23, PrimitiveTypeBoxingTest::bar); // expected: success 18.27 - } 18.28 -}
19.1 --- a/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out Wed May 28 02:28:07 2014 -0700 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,3 +0,0 @@ 19.4 -PrimitiveTypeBoxingTest.java:19:9: compiler.err.cant.apply.symbol: kindname.method, m1, PrimitiveTypeBoxingTest.F<Z>,Z, @490,int, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.Long,java.lang.Object) 19.5 -PrimitiveTypeBoxingTest.java:20:9: compiler.err.cant.apply.symbol: kindname.method, m2, Z,PrimitiveTypeBoxingTest.F<Z>, int,@559, kindname.class, PrimitiveTypeBoxingTest, (compiler.misc.inferred.do.not.conform.to.upper.bounds: java.lang.Integer, java.lang.Long,java.lang.Object) 19.6 -2 errors
20.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 20.2 +++ b/test/tools/javac/lambda/T8041704/ErrorMessageTest.java Wed May 28 11:07:07 2014 -0700 20.3 @@ -0,0 +1,12 @@ 20.4 +/** 20.5 + * @test /nodynamiccopyright/ 20.6 + * @bug 8041704 20.7 + * @summary wrong error message when mixing lambda expression and inner class 20.8 + * @compile/fail/ref=ErrorMessageTest.out -XDrawDiagnostics ErrorMessageTest.java 20.9 + */ 20.10 + 20.11 +public class ErrorMessageTest { 20.12 + void f(Runnable r) { 20.13 + f(() -> { f(new MISSING() { public void run() {} }); }); 20.14 + } 20.15 +}
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/test/tools/javac/lambda/T8041704/ErrorMessageTest.out Wed May 28 11:07:07 2014 -0700 21.3 @@ -0,0 +1,2 @@ 21.4 +ErrorMessageTest.java:10:25: compiler.err.cant.resolve.location: kindname.class, MISSING, , , (compiler.misc.location: kindname.class, ErrorMessageTest, null) 21.5 +1 error