src/share/classes/com/sun/tools/javac/comp/Infer.java

changeset 1087
3a2200681d69
parent 1006
a2d422d480cb
child 1114
05814303a056
equal deleted inserted replaced
1086:f595d8bc0599 1087:3a2200681d69
267 .setMessage("no.unique.minimal.instance.exists", 267 .setMessage("no.unique.minimal.instance.exists",
268 that.qtype, lobounds); 268 that.qtype, lobounds);
269 // VGJ: sort of inlined maximizeInst() below. Adding 269 // VGJ: sort of inlined maximizeInst() below. Adding
270 // bounds can cause lobounds that are above hibounds. 270 // bounds can cause lobounds that are above hibounds.
271 List<Type> hibounds = Type.filter(that.hibounds, errorFilter); 271 List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
272 Type hb = null;
272 if (hibounds.isEmpty()) 273 if (hibounds.isEmpty())
273 return; 274 hb = syms.objectType;
274 Type hb = null; 275 else if (hibounds.tail.isEmpty())
275 if (hibounds.tail.isEmpty())
276 hb = hibounds.head; 276 hb = hibounds.head;
277 else for (List<Type> bs = hibounds; 277 else
278 bs.nonEmpty() && hb == null; 278 hb = types.glb(hibounds);
279 bs = bs.tail) {
280 if (isSubClass(bs.head, hibounds))
281 hb = types.fromUnknownFun.apply(bs.head);
282 }
283 if (hb == null || 279 if (hb == null ||
284 !types.isSubtypeUnchecked(hb, hibounds, warn) || 280 hb.isErroneous())
285 !types.isSubtypeUnchecked(that.inst, hb, warn)) 281 throw ambiguousNoInstanceException
286 throw ambiguousNoInstanceException; 282 .setMessage("incompatible.upper.bounds",
283 that.qtype, hibounds);
287 } 284 }
288 } 285 }
289 286
290 /*************************************************************************** 287 /***************************************************************************
291 * Exported Methods 288 * Exported Methods

mercurial