Tue, 03 Jun 2014 08:36:09 -0700
Merge
1.1 --- a/.hgtags Thu May 29 13:46:36 2014 -0700 1.2 +++ b/.hgtags Tue Jun 03 08:36:09 2014 -0700 1.3 @@ -296,4 +296,6 @@ 1.4 e101a12a45a777268a2e729803499a7514255e5b jdk8u20-b12 1.5 b5c2375893e2bca1883e5571bd911b6f0b533bf4 jdk8u20-b13 1.6 5d39c29950f4d65e737f99e468427ae6454fa586 jdk8u20-b14 1.7 +9c577131ffa6aa0720c756232ae6e69bdff1c7ab jdk8u20-b15 1.8 +d9e6bb92751956ab7f0a469e2f3228a4dc5bb05f jdk8u20-b16 1.9 f491f1581f196950c2cb858508dd06601968c417 jdk8u25-b00
2.1 --- a/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Thu May 29 13:46:36 2014 -0700 2.2 +++ b/src/share/classes/com/sun/tools/javac/api/JavacTrees.java Tue Jun 03 08:36:09 2014 -0700 2.3 @@ -407,7 +407,7 @@ 2.4 paramTypes = lb.toList(); 2.5 } 2.6 2.7 - ClassSymbol sym = (ClassSymbol) types.upperBound(tsym.type).tsym; 2.8 + ClassSymbol sym = (ClassSymbol) types.cvarUpperBound(tsym.type).tsym; 2.9 2.10 Symbol msym = (memberName == sym.name) 2.11 ? findConstructor(sym, paramTypes)
3.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Thu May 29 13:46:36 2014 -0700 3.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Tue Jun 03 08:36:09 2014 -0700 3.3 @@ -122,37 +122,34 @@ 3.4 } 3.5 // </editor-fold> 3.6 3.7 - // <editor-fold defaultstate="collapsed" desc="upperBound"> 3.8 - /** 3.9 - * The "rvalue conversion".<br> 3.10 - * The upper bound of most types is the type 3.11 - * itself. Wildcards, on the other hand have upper 3.12 - * and lower bounds. 3.13 - * @param t a type 3.14 - * @return the upper bound of the given type 3.15 - */ 3.16 - public Type upperBound(Type t) { 3.17 - return upperBound.visit(t).unannotatedType(); 3.18 - } 3.19 - // where 3.20 - private final MapVisitor<Void> upperBound = new MapVisitor<Void>() { 3.21 - 3.22 - @Override 3.23 - public Type visitWildcardType(WildcardType t, Void ignored) { 3.24 - if (t.isSuperBound()) 3.25 - return t.bound == null ? syms.objectType : t.bound.bound; 3.26 - else 3.27 - return visit(t.type); 3.28 - } 3.29 - 3.30 - @Override 3.31 - public Type visitCapturedType(CapturedType t, Void ignored) { 3.32 - return visit(t.bound); 3.33 - } 3.34 - }; 3.35 - // </editor-fold> 3.36 - 3.37 - // <editor-fold defaultstate="collapsed" desc="wildLowerBound"> 3.38 + // <editor-fold defaultstate="collapsed" desc="bounds"> 3.39 + /** 3.40 + * Get a wildcard's upper bound, returning non-wildcards unchanged. 3.41 + * @param t a type argument, either a wildcard or a type 3.42 + */ 3.43 + public Type wildUpperBound(Type t) { 3.44 + if (t.hasTag(WILDCARD)) { 3.45 + WildcardType w = (WildcardType) t.unannotatedType(); 3.46 + if (w.isSuperBound()) 3.47 + return w.bound == null ? syms.objectType : w.bound.bound; 3.48 + else 3.49 + return wildUpperBound(w.type); 3.50 + } 3.51 + else return t; 3.52 + } 3.53 + 3.54 + /** 3.55 + * Get a capture variable's upper bound, returning other types unchanged. 3.56 + * @param t a type 3.57 + */ 3.58 + public Type cvarUpperBound(Type t) { 3.59 + if (t.hasTag(TYPEVAR)) { 3.60 + TypeVar v = (TypeVar) t.unannotatedType(); 3.61 + return v.isCaptured() ? cvarUpperBound(v.bound) : v; 3.62 + } 3.63 + else return t; 3.64 + } 3.65 + 3.66 /** 3.67 * Get a wildcard's lower bound, returning non-wildcards unchanged. 3.68 * @param t a type argument, either a wildcard or a type 3.69 @@ -164,9 +161,7 @@ 3.70 } 3.71 else return t; 3.72 } 3.73 - // </editor-fold> 3.74 - 3.75 - // <editor-fold defaultstate="collapsed" desc="cvarLowerBound"> 3.76 + 3.77 /** 3.78 * Get a capture variable's lower bound, returning other types unchanged. 3.79 * @param t a type 3.80 @@ -904,7 +899,7 @@ 3.81 syms.boundClass); 3.82 changed = true; 3.83 } else if (s != orig) { 3.84 - s = new WildcardType(upperBound(s), 3.85 + s = new WildcardType(wildUpperBound(s), 3.86 BoundKind.EXTENDS, 3.87 syms.boundClass); 3.88 changed = true; 3.89 @@ -1113,7 +1108,7 @@ 3.90 //check that u == t, where u has been set by Type.withTypeVar 3.91 return s.isSuperBound() && 3.92 !s.isExtendsBound() && 3.93 - visit(t, upperBound(s)); 3.94 + visit(t, wildUpperBound(s)); 3.95 } 3.96 } 3.97 default: 3.98 @@ -1140,7 +1135,7 @@ 3.99 return visit(s, t); 3.100 3.101 if (s.isSuperBound() && !s.isExtendsBound()) 3.102 - return visit(t, upperBound(s)) && visit(t, wildLowerBound(s)); 3.103 + return visit(t, wildUpperBound(s)) && visit(t, wildLowerBound(s)); 3.104 3.105 if (t.isCompound() && s.isCompound()) { 3.106 if (!visit(supertype(t), supertype(s))) 3.107 @@ -1290,7 +1285,7 @@ 3.108 switch(wt.kind) { 3.109 case UNBOUND: //similar to ? extends Object 3.110 case EXTENDS: { 3.111 - Type bound = upperBound(s); 3.112 + Type bound = wildUpperBound(s); 3.113 undetvar.addBound(InferenceBound.UPPER, bound, this); 3.114 break; 3.115 } 3.116 @@ -1351,28 +1346,6 @@ 3.117 // where 3.118 private TypeRelation containsType = new TypeRelation() { 3.119 3.120 - private Type U(Type t) { 3.121 - while (t.hasTag(WILDCARD)) { 3.122 - WildcardType w = (WildcardType)t.unannotatedType(); 3.123 - if (w.isSuperBound()) 3.124 - return w.bound == null ? syms.objectType : w.bound.bound; 3.125 - else 3.126 - t = w.type; 3.127 - } 3.128 - return t; 3.129 - } 3.130 - 3.131 - private Type L(Type t) { 3.132 - while (t.hasTag(WILDCARD)) { 3.133 - WildcardType w = (WildcardType)t.unannotatedType(); 3.134 - if (w.isExtendsBound()) 3.135 - return syms.botType; 3.136 - else 3.137 - t = w.type; 3.138 - } 3.139 - return t; 3.140 - } 3.141 - 3.142 public Boolean visitType(Type t, Type s) { 3.143 if (s.isPartial()) 3.144 return containedBy(s, t); 3.145 @@ -1384,13 +1357,13 @@ 3.146 // System.err.println(); 3.147 // System.err.format(" does %s contain %s?%n", t, s); 3.148 // System.err.format(" %s U(%s) <: U(%s) %s = %s%n", 3.149 -// upperBound(s), s, t, U(t), 3.150 +// wildUpperBound(s), s, t, wildUpperBound(t), 3.151 // t.isSuperBound() 3.152 -// || isSubtypeNoCapture(upperBound(s), U(t))); 3.153 +// || isSubtypeNoCapture(wildUpperBound(s), wildUpperBound(t))); 3.154 // System.err.format(" %s L(%s) <: L(%s) %s = %s%n", 3.155 -// L(t), t, s, wildLowerBound(s), 3.156 +// wildLowerBound(t), t, s, wildLowerBound(s), 3.157 // t.isExtendsBound() 3.158 -// || isSubtypeNoCapture(L(t), wildLowerBound(s))); 3.159 +// || isSubtypeNoCapture(wildLowerBound(t), wildLowerBound(s))); 3.160 // System.err.println(); 3.161 // } 3.162 3.163 @@ -1402,8 +1375,9 @@ 3.164 // debugContainsType(t, s); 3.165 return isSameWildcard(t, s) 3.166 || isCaptureOf(s, t) 3.167 - || ((t.isExtendsBound() || isSubtypeNoCapture(L(t), wildLowerBound(s))) && 3.168 - (t.isSuperBound() || isSubtypeNoCapture(upperBound(s), U(t)))); 3.169 + || ((t.isExtendsBound() || isSubtypeNoCapture(wildLowerBound(t), wildLowerBound(s))) && 3.170 + // TODO: JDK-8039214, cvarUpperBound call here is incorrect 3.171 + (t.isSuperBound() || isSubtypeNoCapture(cvarUpperBound(wildUpperBound(s)), wildUpperBound(t)))); 3.172 } 3.173 } 3.174 3.175 @@ -1521,7 +1495,7 @@ 3.176 3.177 @Override 3.178 public Boolean visitWildcardType(WildcardType t, Type s) { 3.179 - return isCastable(upperBound(t), s, warnStack.head); 3.180 + return isCastable(wildUpperBound(t), s, warnStack.head); 3.181 } 3.182 3.183 @Override 3.184 @@ -1762,12 +1736,12 @@ 3.185 3.186 if (t.isExtendsBound()) { 3.187 if (s.isExtendsBound()) 3.188 - return !isCastableRecursive(t.type, upperBound(s)); 3.189 + return !isCastableRecursive(t.type, wildUpperBound(s)); 3.190 else if (s.isSuperBound()) 3.191 return notSoftSubtypeRecursive(wildLowerBound(s), t.type); 3.192 } else if (t.isSuperBound()) { 3.193 if (s.isExtendsBound()) 3.194 - return notSoftSubtypeRecursive(t.type, upperBound(s)); 3.195 + return notSoftSubtypeRecursive(t.type, wildUpperBound(s)); 3.196 } 3.197 return false; 3.198 } 3.199 @@ -1803,7 +1777,7 @@ 3.200 noWarnings); 3.201 } 3.202 if (!s.hasTag(WILDCARD)) 3.203 - s = upperBound(s); 3.204 + s = cvarUpperBound(s); 3.205 3.206 return !isSubtype(t, relaxBound(s)); 3.207 } 3.208 @@ -1860,7 +1834,7 @@ 3.209 // <editor-fold defaultstate="collapsed" desc="Array Utils"> 3.210 public boolean isArray(Type t) { 3.211 while (t.hasTag(WILDCARD)) 3.212 - t = upperBound(t); 3.213 + t = wildUpperBound(t); 3.214 return t.hasTag(ARRAY); 3.215 } 3.216 3.217 @@ -1870,7 +1844,7 @@ 3.218 public Type elemtype(Type t) { 3.219 switch (t.getTag()) { 3.220 case WILDCARD: 3.221 - return elemtype(upperBound(t)); 3.222 + return elemtype(wildUpperBound(t)); 3.223 case ARRAY: 3.224 t = t.unannotatedType(); 3.225 return ((ArrayType)t).elemtype; 3.226 @@ -2073,7 +2047,7 @@ 3.227 3.228 @Override 3.229 public Type visitWildcardType(WildcardType t, Symbol sym) { 3.230 - return memberType(upperBound(t), sym); 3.231 + return memberType(wildUpperBound(t), sym); 3.232 } 3.233 3.234 @Override 3.235 @@ -2192,7 +2166,7 @@ 3.236 3.237 @Override 3.238 public Type visitWildcardType(WildcardType t, Boolean recurse) { 3.239 - return erasure(upperBound(t), recurse); 3.240 + return erasure(wildUpperBound(t), recurse); 3.241 } 3.242 3.243 @Override 3.244 @@ -2401,8 +2375,7 @@ 3.245 if (t.hasErasedSupertypes()) { 3.246 t.interfaces_field = erasureRecursive(interfaces); 3.247 } else if (formals.nonEmpty()) { 3.248 - t.interfaces_field = 3.249 - upperBounds(subst(interfaces, formals, actuals)); 3.250 + t.interfaces_field = subst(interfaces, formals, actuals); 3.251 } 3.252 else { 3.253 t.interfaces_field = interfaces; 3.254 @@ -2971,7 +2944,7 @@ 3.255 return new ClassType(outer1, typarams1, t.tsym); 3.256 } else { 3.257 Type st = subst(supertype(t)); 3.258 - List<Type> is = upperBounds(subst(interfaces(t))); 3.259 + List<Type> is = subst(interfaces(t)); 3.260 if (st == supertype(t) && is == interfaces(t)) 3.261 return t; 3.262 else 3.263 @@ -2988,7 +2961,7 @@ 3.264 return t; 3.265 } else { 3.266 if (t.isExtendsBound() && bound.isExtendsBound()) 3.267 - bound = upperBound(bound); 3.268 + bound = wildUpperBound(bound); 3.269 return new WildcardType(bound, t.kind, syms.boundClass, t.bound); 3.270 } 3.271 } 3.272 @@ -3438,8 +3411,8 @@ 3.273 TypePair pair = new TypePair(c1, c2); 3.274 Type m; 3.275 if (mergeCache.add(pair)) { 3.276 - m = new WildcardType(lub(upperBound(act1.head), 3.277 - upperBound(act2.head)), 3.278 + m = new WildcardType(lub(wildUpperBound(act1.head), 3.279 + wildUpperBound(act2.head)), 3.280 BoundKind.EXTENDS, 3.281 syms.boundClass); 3.282 mergeCache.remove(pair); 3.283 @@ -3972,8 +3945,13 @@ 3.284 Si.lower = Ti.getSuperBound(); 3.285 break; 3.286 } 3.287 - if (Si.bound == Si.lower) 3.288 + Type tmpBound = Si.bound.hasTag(UNDETVAR) ? ((UndetVar)Si.bound).qtype : Si.bound; 3.289 + Type tmpLower = Si.lower.hasTag(UNDETVAR) ? ((UndetVar)Si.lower).qtype : Si.lower; 3.290 + if (!Si.bound.hasTag(ERROR) && 3.291 + !Si.lower.hasTag(ERROR) && 3.292 + isSameType(tmpBound, tmpLower, false)) { 3.293 currentS.head = Si.bound; 3.294 + } 3.295 } 3.296 currentA = currentA.tail; 3.297 currentT = currentT.tail; 3.298 @@ -4010,16 +3988,6 @@ 3.299 // </editor-fold> 3.300 3.301 // <editor-fold defaultstate="collapsed" desc="Internal utility methods"> 3.302 - private List<Type> upperBounds(List<Type> ss) { 3.303 - if (ss.isEmpty()) return ss; 3.304 - Type head = upperBound(ss.head); 3.305 - List<Type> tail = upperBounds(ss.tail); 3.306 - if (head != ss.head || tail != ss.tail) 3.307 - return tail.prepend(head); 3.308 - else 3.309 - return ss; 3.310 - } 3.311 - 3.312 private boolean sideCast(Type from, Type to, Warner warn) { 3.313 // We are casting from type $from$ to type $to$, which are 3.314 // non-final unrelated types. This method 3.315 @@ -4176,7 +4144,7 @@ 3.316 @Override 3.317 public Void visitWildcardType(WildcardType source, Type target) throws AdaptFailure { 3.318 if (source.isExtendsBound()) 3.319 - adaptRecursive(upperBound(source), upperBound(target)); 3.320 + adaptRecursive(wildUpperBound(source), wildUpperBound(target)); 3.321 else if (source.isSuperBound()) 3.322 adaptRecursive(wildLowerBound(source), wildLowerBound(target)); 3.323 return null; 3.324 @@ -4193,7 +4161,7 @@ 3.325 val = isSubtype(wildLowerBound(val), wildLowerBound(target)) 3.326 ? target : val; 3.327 } else if (val.isExtendsBound() && target.isExtendsBound()) { 3.328 - val = isSubtype(upperBound(val), upperBound(target)) 3.329 + val = isSubtype(wildUpperBound(val), wildUpperBound(target)) 3.330 ? val : target; 3.331 } else if (!isSameType(val, target)) { 3.332 throw new AdaptFailure(); 3.333 @@ -4304,7 +4272,7 @@ 3.334 } 3.335 3.336 public Type visitType(Type t, Void s) { 3.337 - return high ? upperBound(t) : t; 3.338 + return t; 3.339 } 3.340 3.341 @Override
4.1 --- a/src/share/classes/com/sun/tools/javac/comp/Attr.java Thu May 29 13:46:36 2014 -0700 4.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Attr.java Tue Jun 03 08:36:09 2014 -0700 4.3 @@ -1175,7 +1175,7 @@ 4.4 //the Formal Parameter of a for-each loop is not in the scope when 4.5 //attributing the for-each expression; we mimick this by attributing 4.6 //the for-each expression first (against original scope). 4.7 - Type exprType = types.upperBound(attribExpr(tree.expr, loopEnv)); 4.8 + Type exprType = types.cvarUpperBound(attribExpr(tree.expr, loopEnv)); 4.9 attribStat(tree.var, loopEnv); 4.10 chk.checkNonVoid(tree.pos(), exprType); 4.11 Type elemtype = types.elemtype(exprType); // perhaps expr is an array? 4.12 @@ -1192,7 +1192,7 @@ 4.13 List<Type> iterableParams = base.allparams(); 4.14 elemtype = iterableParams.isEmpty() 4.15 ? syms.objectType 4.16 - : types.upperBound(iterableParams.head); 4.17 + : types.wildUpperBound(iterableParams.head); 4.18 } 4.19 } 4.20 chk.checkType(tree.expr.pos(), elemtype, tree.var.sym.type); 4.21 @@ -4671,16 +4671,30 @@ 4.22 private void initTypeIfNeeded(JCTree that) { 4.23 if (that.type == null) { 4.24 if (that.hasTag(METHODDEF)) { 4.25 - that.type = dummyMethodType(); 4.26 + that.type = dummyMethodType((JCMethodDecl)that); 4.27 } else { 4.28 that.type = syms.unknownType; 4.29 } 4.30 } 4.31 } 4.32 4.33 + /* Construct a dummy method type. If we have a method declaration, 4.34 + * and the declared return type is void, then use that return type 4.35 + * instead of UNKNOWN to avoid spurious error messages in lambda 4.36 + * bodies (see:JDK-8041704). 4.37 + */ 4.38 + private Type dummyMethodType(JCMethodDecl md) { 4.39 + Type restype = syms.unknownType; 4.40 + if (md != null && md.restype.hasTag(TYPEIDENT)) { 4.41 + JCPrimitiveTypeTree prim = (JCPrimitiveTypeTree)md.restype; 4.42 + if (prim.typetag == VOID) 4.43 + restype = syms.voidType; 4.44 + } 4.45 + return new MethodType(List.<Type>nil(), restype, 4.46 + List.<Type>nil(), syms.methodClass); 4.47 + } 4.48 private Type dummyMethodType() { 4.49 - return new MethodType(List.<Type>nil(), syms.unknownType, 4.50 - List.<Type>nil(), syms.methodClass); 4.51 + return dummyMethodType(null); 4.52 } 4.53 4.54 @Override
5.1 --- a/src/share/classes/com/sun/tools/javac/comp/Check.java Thu May 29 13:46:36 2014 -0700 5.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Check.java Tue Jun 03 08:36:09 2014 -0700 5.3 @@ -618,10 +618,10 @@ 5.4 if (a.isUnbound()) { 5.5 return true; 5.6 } else if (!a.hasTag(WILDCARD)) { 5.7 - a = types.upperBound(a); 5.8 + a = types.cvarUpperBound(a); 5.9 return types.isSubtype(a, bound); 5.10 } else if (a.isExtendsBound()) { 5.11 - return types.isCastable(bound, types.upperBound(a), types.noWarnings); 5.12 + return types.isCastable(bound, types.wildUpperBound(a), types.noWarnings); 5.13 } else if (a.isSuperBound()) { 5.14 return !types.notSoftSubtype(types.wildLowerBound(a), bound); 5.15 }
6.1 --- a/src/share/classes/com/sun/tools/javac/comp/Lower.java Thu May 29 13:46:36 2014 -0700 6.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Lower.java Tue Jun 03 08:36:09 2014 -0700 6.3 @@ -3472,7 +3472,7 @@ 6.4 private void visitIterableForeachLoop(JCEnhancedForLoop tree) { 6.5 make_at(tree.expr.pos()); 6.6 Type iteratorTarget = syms.objectType; 6.7 - Type iterableType = types.asSuper(types.upperBound(tree.expr.type), 6.8 + Type iterableType = types.asSuper(types.cvarUpperBound(tree.expr.type), 6.9 syms.iterableType.tsym); 6.10 if (iterableType.getTypeArguments().nonEmpty()) 6.11 iteratorTarget = types.erasure(iterableType.getTypeArguments().head); 6.12 @@ -3506,7 +3506,7 @@ 6.13 List.<Type>nil()); 6.14 JCExpression vardefinit = make.App(make.Select(make.Ident(itvar), next)); 6.15 if (tree.var.type.isPrimitive()) 6.16 - vardefinit = make.TypeCast(types.upperBound(iteratorTarget), vardefinit); 6.17 + vardefinit = make.TypeCast(types.cvarUpperBound(iteratorTarget), vardefinit); 6.18 else 6.19 vardefinit = make.TypeCast(tree.var.type, vardefinit); 6.20 JCVariableDecl indexDef = (JCVariableDecl)make.VarDef(tree.var.mods,
7.1 --- a/src/share/classes/com/sun/tools/javac/comp/Resolve.java Thu May 29 13:46:36 2014 -0700 7.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Jun 03 08:36:09 2014 -0700 7.3 @@ -348,7 +348,7 @@ 7.4 7.5 boolean isAccessible(Env<AttrContext> env, Type t, boolean checkInner) { 7.6 return (t.hasTag(ARRAY)) 7.7 - ? isAccessible(env, types.upperBound(types.elemtype(t))) 7.8 + ? isAccessible(env, types.cvarUpperBound(types.elemtype(t))) 7.9 : isAccessible(env, t.tsym, checkInner); 7.10 } 7.11 7.12 @@ -1011,7 +1011,7 @@ 7.13 */ 7.14 private Type U(Type found) { 7.15 return found == pt ? 7.16 - found : types.upperBound(found); 7.17 + found : types.cvarUpperBound(found); 7.18 } 7.19 7.20 @Override
8.1 --- a/test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out Thu May 29 13:46:36 2014 -0700 8.2 +++ b/test/tools/javac/T8030816/CrashLambdaExpressionWithNonAccessibleIdTest.out Tue Jun 03 08:36:09 2014 -0700 8.3 @@ -1,3 +1,2 @@ 8.4 -CrashLambdaExpressionWithNonAccessibleIdTest.java:15:35: compiler.err.missing.ret.stmt 8.5 CrashLambdaExpressionWithNonAccessibleIdTest.java:14:17: compiler.err.cant.resolve.location: kindname.class, A, , , (compiler.misc.location: kindname.class, CrashLambdaExpressionWithNonAccessibleIdTest, null) 8.6 -2 errors 8.7 +1 error
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java Tue Jun 03 08:36:09 2014 -0700 9.3 @@ -0,0 +1,78 @@ 9.4 +/* 9.5 + * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 9.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 9.7 + * 9.8 + * This code is free software; you can redistribute it and/or modify it 9.9 + * under the terms of the GNU General Public License version 2 only, as 9.10 + * published by the Free Software Foundation. Oracle designates this 9.11 + * particular file as subject to the "Classpath" exception as provided 9.12 + * by Oracle in the LICENSE file that accompanied this code. 9.13 + * 9.14 + * This code is distributed in the hope that it will be useful, but WITHOUT 9.15 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 9.16 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 9.17 + * version 2 for more details (a copy is included in the LICENSE file that 9.18 + * accompanied this code). 9.19 + * 9.20 + * You should have received a copy of the GNU General Public License version 9.21 + * 2 along with this work; if not, write to the Free Software Foundation, 9.22 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 9.23 + * 9.24 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 9.25 + * or visit www.oracle.com if you need additional information or have any 9.26 + * questions. 9.27 + */ 9.28 + 9.29 +/* 9.30 + * @test 9.31 + * @bug 8030741 9.32 + * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 9.33 + * @compile EagerReturnTypeResolutionTesta.java 9.34 + */ 9.35 + 9.36 +public class EagerReturnTypeResolutionTesta { 9.37 + 9.38 + abstract class Test1<T>{ 9.39 + abstract <S> S foo(S x, S y); 9.40 + <S extends Number & Comparable<? extends Number>> void baz(Test1<S> a){} 9.41 + 9.42 + void bar(Test1<Long> x, Test1<Integer> y){ 9.43 + baz(foo(x, y)); 9.44 + } 9.45 + } 9.46 + 9.47 + abstract class Test2<T>{ 9.48 + abstract <S> S foo(S x, S y); 9.49 + abstract <S1> void baz(Test2<S1> a); 9.50 + 9.51 + void bar(Test2<Integer> y, Test2<Long> x){ 9.52 + baz(foo(x, y)); 9.53 + } 9.54 + } 9.55 + 9.56 + abstract class Test3<T>{ 9.57 + abstract <S> S foo(S x, S y); 9.58 + <T extends Number & Comparable<?>, 9.59 + S extends Number & Comparable<? extends T>> void baz(Test3<S> a){} 9.60 + 9.61 + void bar(Test3<Long> x, Test3<Integer> y){ 9.62 + baz(foo(x, y)); 9.63 + } 9.64 + } 9.65 + 9.66 + abstract class Test4 { 9.67 + abstract class A0<T> {} 9.68 + 9.69 + abstract class A1<T> extends A0<T> {} 9.70 + 9.71 + abstract class A2<T> extends A0<T> {} 9.72 + 9.73 + abstract <S> S foo(S x, S y); 9.74 + abstract <S1> void baz(A0<S1> a); 9.75 + 9.76 + void bar(A2<Integer> y, A1<Long> x){ 9.77 + baz(foo(x, y)); 9.78 + } 9.79 + } 9.80 + 9.81 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java Tue Jun 03 08:36:09 2014 -0700 10.3 @@ -0,0 +1,182 @@ 10.4 +/* 10.5 + * @test /nodynamiccopyright/ 10.6 + * @bug 8030741 10.7 + * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 10.8 + * @compile/fail/ref=EagerReturnTypeResolutionTestb.out -XDrawDiagnostics EagerReturnTypeResolutionTestb.java 10.9 + * @author Dan Smith 10.10 + */ 10.11 + 10.12 +import java.util.List; 10.13 + 10.14 +public class EagerReturnTypeResolutionTestb { 10.15 + interface I<S> {} 10.16 + interface J<S> extends I<S> {} 10.17 + interface K extends I<String> {} 10.18 + interface L<S> extends I {} 10.19 + 10.20 + <T> T lower(List<? extends T> l) { return null; } 10.21 + <T> T lower2(List<? extends T> l1, List<? extends T> l2) { return null; } 10.22 + 10.23 + <T> T upper(List<? super T> l) { return null; } 10.24 + <T> T upper2(List<? super T> l1, List<? super T> l2) { return null; } 10.25 + 10.26 + <T> T eq(List<T> l) { return null; } 10.27 + <T> T eq2(List<T> l1, List<T> l2) { return null; } 10.28 + 10.29 + <X> void takeI(I<X> i) {} 10.30 + void takeIString(I<String> i) {} 10.31 + I<String> iStringField; 10.32 + 10.33 + void takeLong(long arg) {} 10.34 + long longField; 10.35 + 10.36 + void testSimpleCaptureOK(List<I<?>> i1) { 10.37 + takeI(lower(i1)); // ok* 10.38 + takeI(eq(i1)); // ok* 10.39 + takeI(upper(i1)); // ok, no capture 10.40 + takeIString(upper(i1)); // ok 10.41 + iStringField = upper(i1); // ok 10.42 + } 10.43 + 10.44 + void testSimpleCaptureKO(List<I<?>> i1) { 10.45 + takeIString(lower(i1)); // ERROR 10.46 + takeIString(eq(i1)); // ERROR 10.47 + iStringField = lower(i1); // ERROR 10.48 + iStringField = eq(i1); // ERROR 10.49 + } 10.50 + 10.51 + void testMultiCaptureOK(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3, 10.52 + List<J<String>> j1, List<J<Integer>> j2, List<K> k1) { 10.53 + /* Lines marked with JDK-8029002 should be uncommented once this bug is 10.54 + * fixed 10.55 + */ 10.56 + takeI(lower2(i1, i2)); // ok* 10.57 + takeI(lower2(i1, i3)); // ok* 10.58 + takeI(upper2(i1, i3)); // ok, no capture* JDK-8029002 10.59 + 10.60 + takeIString(upper2(i1, i3)); // ok, no capture 10.61 + iStringField = upper2(i1, i3); // ok, no capture 10.62 + 10.63 + takeI(lower2(j1, j2)); // ok* 10.64 + takeI(lower2(j1, k1)); // ok, no capture 10.65 + takeI(upper2(j1, k1)); // ok, no capture* JDK-8029002 10.66 + 10.67 + takeIString(lower2(j1, k1)); // ok, no capture 10.68 + takeIString(upper2(j1, k1)); // ok, no capture 10.69 + 10.70 + iStringField = lower2(j1, k1); // ok, no capture 10.71 + iStringField = upper2(j1, k1); // ok, no capture 10.72 + takeI(lower2(j2, k1)); // ok* 10.73 + } 10.74 + 10.75 + void testMultiCaptureKO(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3, 10.76 + List<J<String>> j1, List<J<Integer>> j2, List<K> k1) { 10.77 + takeI(eq2(i1, i2)); // ERROR, bad bounds 10.78 + takeI(upper2(i1, i2)); // ERROR, bad bounds 10.79 + 10.80 + takeIString(lower2(i1, i2)); // ERROR 10.81 + takeIString(eq2(i1, i2)); // ERROR, bad bounds 10.82 + takeIString(upper2(i1, i2)); // ERROR, bad bounds 10.83 + 10.84 + iStringField = lower2(i1, i2); // ERROR 10.85 + iStringField = eq2(i1, i2); // ERROR, bad bounds 10.86 + iStringField = upper2(i1, i2); // ERROR, bad bounds 10.87 + 10.88 + takeI(eq2(i1, i3)); // ERROR, bad bounds 10.89 + takeIString(lower2(i1, i3)); // ERROR 10.90 + takeIString(eq2(i1, i3)); // ERROR, bad bounds 10.91 + 10.92 + iStringField = lower2(i1, i3); // ERROR 10.93 + iStringField = eq2(i1, i3); // ERROR, bad bounds 10.94 + takeI(eq2(j1, j2)); // ERROR, bad bounds 10.95 + takeI(upper2(j1, j2)); // ERROR, bad bounds 10.96 + 10.97 + takeIString(lower2(j1, j2)); // ERROR 10.98 + takeIString(eq2(j1, j2)); // ERROR, bad bounds 10.99 + takeIString(upper2(j1, j2)); // ERROR, bad bounds 10.100 + 10.101 + iStringField = lower2(j1, j2); // ERROR 10.102 + iStringField = eq2(j1, j2); // ERROR, bad bounds 10.103 + iStringField = upper2(j1, j2); // ERROR, bad bounds 10.104 + 10.105 + takeI(eq2(j1, k1)); // ERROR, bad bounds 10.106 + takeIString(eq2(j1, k1)); // ERROR, bad bounds 10.107 + iStringField = eq2(j1, k1); // ERROR, bad bounds 10.108 + takeI(eq2(j2, k1)); // ERROR, bad bounds 10.109 + takeI(upper2(j2, k1)); // ERROR, bad bounds; actual: no error, see JDK-8037474 10.110 + 10.111 + takeIString(lower2(j2, k1)); // ERROR 10.112 + takeIString(eq2(j2, k1)); // ERROR, bad bounds 10.113 + takeIString(upper2(j2, k1)); // ERROR, bad bounds 10.114 + 10.115 + iStringField = lower2(j2, k1); // ERROR 10.116 + iStringField = eq2(j2, k1); // ERROR, bad bounds 10.117 + iStringField = upper2(j2, k1); // ERROR, bad bounds 10.118 + } 10.119 + 10.120 + void testRawOK(List<I> i1, List<J> j1, List<L<String>> l1) { 10.121 + takeI(lower(i1)); // ok, unchecked 10.122 + takeI(eq(i1)); // ok, unchecked 10.123 + takeI(upper(i1)); // ok, no capture, not unchecked 10.124 + 10.125 + takeIString(lower(i1)); // ok, unchecked 10.126 + takeIString(eq(i1)); // ok, unchecked 10.127 + takeIString(upper(i1)); // ok, no capture, not unchecked 10.128 + 10.129 + iStringField = lower(i1); // ok, unchecked 10.130 + iStringField = eq(i1); // ok, unchecked 10.131 + iStringField = upper(i1); // ok, no capture, not unchecked 10.132 + 10.133 + takeI(lower(j1)); // ok, unchecked 10.134 + takeI(eq(j1)); // ok, unchecked 10.135 + takeI(upper(j1)); // bad bounds? -- spec is unclear 10.136 + 10.137 + takeIString(lower(j1)); // ok, unchecked 10.138 + takeIString(eq(j1)); // ok, unchecked 10.139 + takeIString(upper(j1)); // bad bounds? -- spec is unclear 10.140 + 10.141 + iStringField = lower(j1); // ok, unchecked 10.142 + iStringField = eq(j1); // ok, unchecked 10.143 + iStringField = upper(j1); // bad bounds? -- spec is unclear 10.144 + 10.145 + takeI(lower(l1)); // ok, unchecked 10.146 + takeI(eq(l1)); // ok, unchecked 10.147 + takeI(upper(l1)); // bad bounds? -- spec is unclear 10.148 + 10.149 + takeIString(lower(l1)); // ok, unchecked 10.150 + takeIString(eq(l1)); // ok, unchecked 10.151 + takeIString(upper(l1)); // bad bounds? -- spec is unclear 10.152 + 10.153 + iStringField = lower(l1); // ok, unchecked 10.154 + iStringField = eq(l1); // ok, unchecked 10.155 + iStringField = upper(l1); // bad bounds? -- spec is unclear 10.156 + } 10.157 + 10.158 + void testPrimOK(List<Integer> i1, List<Long> l1, List<Double> d1) { 10.159 + takeLong(lower(i1)); // ok 10.160 + takeLong(eq(i1)); // ok 10.161 + takeLong(upper(i1)); // ok* 10.162 + 10.163 + longField = lower(i1); // ok 10.164 + longField = eq(i1); // ok 10.165 + longField = upper(i1); // ok* 10.166 + 10.167 + takeLong(lower(l1)); // ok 10.168 + takeLong(eq(l1)); // ok 10.169 + takeLong(upper(l1)); // ok 10.170 + 10.171 + longField = lower(l1); // ok 10.172 + longField = eq(l1); // ok 10.173 + longField = upper(l1); // ok 10.174 + } 10.175 + 10.176 + void testPrimKO(List<Integer> i1, List<Long> l1, List<Double> d1) { 10.177 + takeLong(lower(d1)); // ERROR 10.178 + takeLong(eq(d1)); // ERROR 10.179 + takeLong(upper(d1)); // ERROR 10.180 + 10.181 + longField = lower(d1); // ERROR 10.182 + longField = eq(d1); // ERROR 10.183 + longField = upper(d1); // ERROR 10.184 + } 10.185 +}
11.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 11.2 +++ b/test/tools/javac/generics/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out Tue Jun 03 08:36:09 2014 -0700 11.3 @@ -0,0 +1,45 @@ 11.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)) 11.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)) 11.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) 11.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) 11.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>) 11.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) 11.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)) 11.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>) 11.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) 11.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) 11.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>) 11.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) 11.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>) 11.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)) 11.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>) 11.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) 11.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>) 11.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>) 11.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) 11.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)) 11.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>) 11.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) 11.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) 11.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>) 11.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) 11.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>) 11.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>) 11.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>) 11.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>) 11.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) 11.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)) 11.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>) 11.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)) 11.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) 11.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>) 11.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) 11.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)) 11.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)) 11.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)) 11.43 +EagerReturnTypeResolutionTestb.java:178:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 11.44 +EagerReturnTypeResolutionTestb.java:179:23: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 11.45 +EagerReturnTypeResolutionTestb.java:180:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 11.46 +- compiler.note.unchecked.filename: EagerReturnTypeResolutionTestb.java 11.47 +- compiler.note.unchecked.recompile 11.48 +42 errors
12.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 12.2 +++ b/test/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java Tue Jun 03 08:36:09 2014 -0700 12.3 @@ -0,0 +1,25 @@ 12.4 +/* 12.5 + * @test /nodynamiccopyright/ 12.6 + * @bug 8030741 12.7 + * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 12.8 + * @compile/fail/ref=PrimitiveTypeBoxingTest.out -XDrawDiagnostics PrimitiveTypeBoxingTest.java 12.9 + */ 12.10 + 12.11 +public class PrimitiveTypeBoxingTest { 12.12 + 12.13 + static void foo(long arg) {} 12.14 + static void bar(int arg) {} 12.15 + 12.16 + interface F<X> { void get(X arg); } 12.17 + 12.18 + <Z> void m1(F<Z> f, Z arg) {} 12.19 + <Z> void m2(Z arg, F<Z> f) {} 12.20 + 12.21 + void test() { 12.22 + m1(PrimitiveTypeBoxingTest::foo, 23); // expected: error 12.23 + m2(23, PrimitiveTypeBoxingTest::foo); // expected: error 12.24 + 12.25 + m1(PrimitiveTypeBoxingTest::bar, 23); // expected: success 12.26 + m2(23, PrimitiveTypeBoxingTest::bar); // expected: success 12.27 + } 12.28 +}
13.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 13.2 +++ b/test/tools/javac/generics/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out Tue Jun 03 08:36:09 2014 -0700 13.3 @@ -0,0 +1,3 @@ 13.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) 13.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) 13.6 +2 errors
14.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 14.2 +++ b/test/tools/javac/generics/wildcards/RefQueue.java Tue Jun 03 08:36:09 2014 -0700 14.3 @@ -0,0 +1,24 @@ 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 +public class RefQueue<S> { }
15.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 15.2 +++ b/test/tools/javac/generics/wildcards/RefQueueBug.java Tue Jun 03 08:36:09 2014 -0700 15.3 @@ -0,0 +1,38 @@ 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. 15.11 + * 15.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 15.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 15.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 15.15 + * version 2 for more details (a copy is included in the LICENSE file that 15.16 + * accompanied this code). 15.17 + * 15.18 + * You should have received a copy of the GNU General Public License version 15.19 + * 2 along with this work; if not, write to the Free Software Foundation, 15.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 15.21 + * 15.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 15.23 + * or visit www.oracle.com if you need additional information or have any 15.24 + * questions. 15.25 + */ 15.26 + 15.27 +/* 15.28 + * @test 15.29 + * @bug 8033437 15.30 + * @summary inconsistent generic types behaviour when compiling together vs. separate 15.31 + * @compile RefQueue.java 15.32 + * @compile RefQueueBug.java 15.33 + */ 15.34 + 15.35 +public class RefQueueBug<T> { 15.36 + final RefQueue<? super T> queue = new RefQueue<>(); 15.37 + public static void main(String[] args) { 15.38 + RefQueueBug<Object> r = new RefQueueBug<>(); 15.39 + RefQueue<Object> q = r.queue; 15.40 + } 15.41 +}
16.1 --- a/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java Thu May 29 13:46:36 2014 -0700 16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 16.3 @@ -1,78 +0,0 @@ 16.4 -/* 16.5 - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 16.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 - * 16.8 - * This code is free software; you can redistribute it and/or modify it 16.9 - * under the terms of the GNU General Public License version 2 only, as 16.10 - * published by the Free Software Foundation. Oracle designates this 16.11 - * particular file as subject to the "Classpath" exception as provided 16.12 - * by Oracle in the LICENSE file that accompanied this code. 16.13 - * 16.14 - * This code is distributed in the hope that it will be useful, but WITHOUT 16.15 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.16 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.17 - * version 2 for more details (a copy is included in the LICENSE file that 16.18 - * accompanied this code). 16.19 - * 16.20 - * You should have received a copy of the GNU General Public License version 16.21 - * 2 along with this work; if not, write to the Free Software Foundation, 16.22 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.23 - * 16.24 - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 16.25 - * or visit www.oracle.com if you need additional information or have any 16.26 - * questions. 16.27 - */ 16.28 - 16.29 -/* 16.30 - * @test 16.31 - * @bug 8030741 16.32 - * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 16.33 - * @compile EagerReturnTypeResolutionTesta.java 16.34 - */ 16.35 - 16.36 -public class EagerReturnTypeResolutionTesta { 16.37 - 16.38 - abstract class Test1<T>{ 16.39 - abstract <S> S foo(S x, S y); 16.40 - <S extends Number & Comparable<? extends Number>> void baz(Test1<S> a){} 16.41 - 16.42 - void bar(Test1<Long> x, Test1<Integer> y){ 16.43 - baz(foo(x, y)); 16.44 - } 16.45 - } 16.46 - 16.47 - abstract class Test2<T>{ 16.48 - abstract <S> S foo(S x, S y); 16.49 - abstract <S1> void baz(Test2<S1> a); 16.50 - 16.51 - void bar(Test2<Integer> y, Test2<Long> x){ 16.52 - baz(foo(x, y)); 16.53 - } 16.54 - } 16.55 - 16.56 - abstract class Test3<T>{ 16.57 - abstract <S> S foo(S x, S y); 16.58 - <T extends Number & Comparable<?>, 16.59 - S extends Number & Comparable<? extends T>> void baz(Test3<S> a){} 16.60 - 16.61 - void bar(Test3<Long> x, Test3<Integer> y){ 16.62 - baz(foo(x, y)); 16.63 - } 16.64 - } 16.65 - 16.66 - abstract class Test4 { 16.67 - abstract class A0<T> {} 16.68 - 16.69 - abstract class A1<T> extends A0<T> {} 16.70 - 16.71 - abstract class A2<T> extends A0<T> {} 16.72 - 16.73 - abstract <S> S foo(S x, S y); 16.74 - abstract <S1> void baz(A0<S1> a); 16.75 - 16.76 - void bar(A2<Integer> y, A1<Long> x){ 16.77 - baz(foo(x, y)); 16.78 - } 16.79 - } 16.80 - 16.81 -}
17.1 --- a/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.java Thu May 29 13:46:36 2014 -0700 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,182 +0,0 @@ 17.4 -/* 17.5 - * @test /nodynamiccopyright/ 17.6 - * @bug 8030741 17.7 - * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 17.8 - * @compile/fail/ref=EagerReturnTypeResolutionTestb.out -XDrawDiagnostics EagerReturnTypeResolutionTestb.java 17.9 - * @author Dan Smith 17.10 - */ 17.11 - 17.12 -import java.util.List; 17.13 - 17.14 -public class EagerReturnTypeResolutionTestb { 17.15 - interface I<S> {} 17.16 - interface J<S> extends I<S> {} 17.17 - interface K extends I<String> {} 17.18 - interface L<S> extends I {} 17.19 - 17.20 - <T> T lower(List<? extends T> l) { return null; } 17.21 - <T> T lower2(List<? extends T> l1, List<? extends T> l2) { return null; } 17.22 - 17.23 - <T> T upper(List<? super T> l) { return null; } 17.24 - <T> T upper2(List<? super T> l1, List<? super T> l2) { return null; } 17.25 - 17.26 - <T> T eq(List<T> l) { return null; } 17.27 - <T> T eq2(List<T> l1, List<T> l2) { return null; } 17.28 - 17.29 - <X> void takeI(I<X> i) {} 17.30 - void takeIString(I<String> i) {} 17.31 - I<String> iStringField; 17.32 - 17.33 - void takeLong(long arg) {} 17.34 - long longField; 17.35 - 17.36 - void testSimpleCaptureOK(List<I<?>> i1) { 17.37 - takeI(lower(i1)); // ok* 17.38 - takeI(eq(i1)); // ok* 17.39 - takeI(upper(i1)); // ok, no capture 17.40 - takeIString(upper(i1)); // ok 17.41 - iStringField = upper(i1); // ok 17.42 - } 17.43 - 17.44 - void testSimpleCaptureKO(List<I<?>> i1) { 17.45 - takeIString(lower(i1)); // ERROR 17.46 - takeIString(eq(i1)); // ERROR 17.47 - iStringField = lower(i1); // ERROR 17.48 - iStringField = eq(i1); // ERROR 17.49 - } 17.50 - 17.51 - void testMultiCaptureOK(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3, 17.52 - List<J<String>> j1, List<J<Integer>> j2, List<K> k1) { 17.53 - /* Lines marked with JDK-8029002 should be uncommented once this bug is 17.54 - * fixed 17.55 - */ 17.56 - takeI(lower2(i1, i2)); // ok* 17.57 - takeI(lower2(i1, i3)); // ok* 17.58 - takeI(upper2(i1, i3)); // ok, no capture* JDK-8029002 17.59 - 17.60 - takeIString(upper2(i1, i3)); // ok, no capture 17.61 - iStringField = upper2(i1, i3); // ok, no capture 17.62 - 17.63 - takeI(lower2(j1, j2)); // ok* 17.64 - takeI(lower2(j1, k1)); // ok, no capture 17.65 - takeI(upper2(j1, k1)); // ok, no capture* JDK-8029002 17.66 - 17.67 - takeIString(lower2(j1, k1)); // ok, no capture 17.68 - takeIString(upper2(j1, k1)); // ok, no capture 17.69 - 17.70 - iStringField = lower2(j1, k1); // ok, no capture 17.71 - iStringField = upper2(j1, k1); // ok, no capture 17.72 - takeI(lower2(j2, k1)); // ok* 17.73 - } 17.74 - 17.75 - void testMultiCaptureKO(List<I<String>> i1, List<I<Integer>> i2, List<I<?>> i3, 17.76 - List<J<String>> j1, List<J<Integer>> j2, List<K> k1) { 17.77 - takeI(eq2(i1, i2)); // ERROR, bad bounds 17.78 - takeI(upper2(i1, i2)); // ERROR, bad bounds 17.79 - 17.80 - takeIString(lower2(i1, i2)); // ERROR 17.81 - takeIString(eq2(i1, i2)); // ERROR, bad bounds 17.82 - takeIString(upper2(i1, i2)); // ERROR, bad bounds 17.83 - 17.84 - iStringField = lower2(i1, i2); // ERROR 17.85 - iStringField = eq2(i1, i2); // ERROR, bad bounds 17.86 - iStringField = upper2(i1, i2); // ERROR, bad bounds 17.87 - 17.88 - takeI(eq2(i1, i3)); // ERROR, bad bounds 17.89 - takeIString(lower2(i1, i3)); // ERROR 17.90 - takeIString(eq2(i1, i3)); // ERROR, bad bounds 17.91 - 17.92 - iStringField = lower2(i1, i3); // ERROR 17.93 - iStringField = eq2(i1, i3); // ERROR, bad bounds 17.94 - takeI(eq2(j1, j2)); // ERROR, bad bounds 17.95 - takeI(upper2(j1, j2)); // ERROR, bad bounds 17.96 - 17.97 - takeIString(lower2(j1, j2)); // ERROR 17.98 - takeIString(eq2(j1, j2)); // ERROR, bad bounds 17.99 - takeIString(upper2(j1, j2)); // ERROR, bad bounds 17.100 - 17.101 - iStringField = lower2(j1, j2); // ERROR 17.102 - iStringField = eq2(j1, j2); // ERROR, bad bounds 17.103 - iStringField = upper2(j1, j2); // ERROR, bad bounds 17.104 - 17.105 - takeI(eq2(j1, k1)); // ERROR, bad bounds 17.106 - takeIString(eq2(j1, k1)); // ERROR, bad bounds 17.107 - iStringField = eq2(j1, k1); // ERROR, bad bounds 17.108 - takeI(eq2(j2, k1)); // ERROR, bad bounds 17.109 - takeI(upper2(j2, k1)); // ERROR, bad bounds; actual: no error, see JDK-8037474 17.110 - 17.111 - takeIString(lower2(j2, k1)); // ERROR 17.112 - takeIString(eq2(j2, k1)); // ERROR, bad bounds 17.113 - takeIString(upper2(j2, k1)); // ERROR, bad bounds 17.114 - 17.115 - iStringField = lower2(j2, k1); // ERROR 17.116 - iStringField = eq2(j2, k1); // ERROR, bad bounds 17.117 - iStringField = upper2(j2, k1); // ERROR, bad bounds 17.118 - } 17.119 - 17.120 - void testRawOK(List<I> i1, List<J> j1, List<L<String>> l1) { 17.121 - takeI(lower(i1)); // ok, unchecked 17.122 - takeI(eq(i1)); // ok, unchecked 17.123 - takeI(upper(i1)); // ok, no capture, not unchecked 17.124 - 17.125 - takeIString(lower(i1)); // ok, unchecked 17.126 - takeIString(eq(i1)); // ok, unchecked 17.127 - takeIString(upper(i1)); // ok, no capture, not unchecked 17.128 - 17.129 - iStringField = lower(i1); // ok, unchecked 17.130 - iStringField = eq(i1); // ok, unchecked 17.131 - iStringField = upper(i1); // ok, no capture, not unchecked 17.132 - 17.133 - takeI(lower(j1)); // ok, unchecked 17.134 - takeI(eq(j1)); // ok, unchecked 17.135 - takeI(upper(j1)); // bad bounds? -- spec is unclear 17.136 - 17.137 - takeIString(lower(j1)); // ok, unchecked 17.138 - takeIString(eq(j1)); // ok, unchecked 17.139 - takeIString(upper(j1)); // bad bounds? -- spec is unclear 17.140 - 17.141 - iStringField = lower(j1); // ok, unchecked 17.142 - iStringField = eq(j1); // ok, unchecked 17.143 - iStringField = upper(j1); // bad bounds? -- spec is unclear 17.144 - 17.145 - takeI(lower(l1)); // ok, unchecked 17.146 - takeI(eq(l1)); // ok, unchecked 17.147 - takeI(upper(l1)); // bad bounds? -- spec is unclear 17.148 - 17.149 - takeIString(lower(l1)); // ok, unchecked 17.150 - takeIString(eq(l1)); // ok, unchecked 17.151 - takeIString(upper(l1)); // bad bounds? -- spec is unclear 17.152 - 17.153 - iStringField = lower(l1); // ok, unchecked 17.154 - iStringField = eq(l1); // ok, unchecked 17.155 - iStringField = upper(l1); // bad bounds? -- spec is unclear 17.156 - } 17.157 - 17.158 - void testPrimOK(List<Integer> i1, List<Long> l1, List<Double> d1) { 17.159 - takeLong(lower(i1)); // ok 17.160 - takeLong(eq(i1)); // ok 17.161 - takeLong(upper(i1)); // ok* 17.162 - 17.163 - longField = lower(i1); // ok 17.164 - longField = eq(i1); // ok 17.165 - longField = upper(i1); // ok* 17.166 - 17.167 - takeLong(lower(l1)); // ok 17.168 - takeLong(eq(l1)); // ok 17.169 - takeLong(upper(l1)); // ok 17.170 - 17.171 - longField = lower(l1); // ok 17.172 - longField = eq(l1); // ok 17.173 - longField = upper(l1); // ok 17.174 - } 17.175 - 17.176 - void testPrimKO(List<Integer> i1, List<Long> l1, List<Double> d1) { 17.177 - takeLong(lower(d1)); // ERROR 17.178 - takeLong(eq(d1)); // ERROR 17.179 - takeLong(upper(d1)); // ERROR 17.180 - 17.181 - longField = lower(d1); // ERROR 17.182 - longField = eq(d1); // ERROR 17.183 - longField = upper(d1); // ERROR 17.184 - } 17.185 -}
18.1 --- a/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTestb.out Thu May 29 13:46:36 2014 -0700 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,45 +0,0 @@ 18.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)) 18.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)) 18.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) 18.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) 18.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>) 18.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) 18.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)) 18.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>) 18.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) 18.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) 18.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>) 18.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) 18.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>) 18.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)) 18.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>) 18.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) 18.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>) 18.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>) 18.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) 18.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)) 18.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>) 18.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) 18.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) 18.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>) 18.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) 18.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>) 18.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>) 18.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>) 18.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>) 18.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) 18.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)) 18.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>) 18.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)) 18.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) 18.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>) 18.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) 18.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)) 18.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)) 18.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)) 18.43 -EagerReturnTypeResolutionTestb.java:178:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 18.44 -EagerReturnTypeResolutionTestb.java:179:23: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 18.45 -EagerReturnTypeResolutionTestb.java:180:26: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.instance.exists: , T, long) 18.46 -- compiler.note.unchecked.filename: EagerReturnTypeResolutionTestb.java 18.47 -- compiler.note.unchecked.recompile 18.48 -42 errors
19.1 --- a/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.java Thu May 29 13:46:36 2014 -0700 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,25 +0,0 @@ 19.4 -/* 19.5 - * @test /nodynamiccopyright/ 19.6 - * @bug 8030741 19.7 - * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800 19.8 - * @compile/fail/ref=PrimitiveTypeBoxingTest.out -XDrawDiagnostics PrimitiveTypeBoxingTest.java 19.9 - */ 19.10 - 19.11 -public class PrimitiveTypeBoxingTest { 19.12 - 19.13 - static void foo(long arg) {} 19.14 - static void bar(int arg) {} 19.15 - 19.16 - interface F<X> { void get(X arg); } 19.17 - 19.18 - <Z> void m1(F<Z> f, Z arg) {} 19.19 - <Z> void m2(Z arg, F<Z> f) {} 19.20 - 19.21 - void test() { 19.22 - m1(PrimitiveTypeBoxingTest::foo, 23); // expected: error 19.23 - m2(23, PrimitiveTypeBoxingTest::foo); // expected: error 19.24 - 19.25 - m1(PrimitiveTypeBoxingTest::bar, 23); // expected: success 19.26 - m2(23, PrimitiveTypeBoxingTest::bar); // expected: success 19.27 - } 19.28 -}
20.1 --- a/test/tools/javac/inference/EagerReturnTypeResolution/PrimitiveTypeBoxingTest.out Thu May 29 13:46:36 2014 -0700 20.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 20.3 @@ -1,3 +0,0 @@ 20.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) 20.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) 20.6 -2 errors
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/test/tools/javac/lambda/T8041704/ErrorMessageTest.java Tue Jun 03 08:36:09 2014 -0700 21.3 @@ -0,0 +1,12 @@ 21.4 +/** 21.5 + * @test /nodynamiccopyright/ 21.6 + * @bug 8041704 21.7 + * @summary wrong error message when mixing lambda expression and inner class 21.8 + * @compile/fail/ref=ErrorMessageTest.out -XDrawDiagnostics ErrorMessageTest.java 21.9 + */ 21.10 + 21.11 +public class ErrorMessageTest { 21.12 + void f(Runnable r) { 21.13 + f(() -> { f(new MISSING() { public void run() {} }); }); 21.14 + } 21.15 +}
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/test/tools/javac/lambda/T8041704/ErrorMessageTest.out Tue Jun 03 08:36:09 2014 -0700 22.3 @@ -0,0 +1,2 @@ 22.4 +ErrorMessageTest.java:10:25: compiler.err.cant.resolve.location: kindname.class, MISSING, , , (compiler.misc.location: kindname.class, ErrorMessageTest, null) 22.5 +1 error