diff -r f595d8bc0599 -r 3a2200681d69 src/share/classes/com/sun/tools/javac/comp/Infer.java --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue Sep 13 14:15:22 2011 +0100 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java Tue Sep 13 14:15:39 2011 +0100 @@ -269,21 +269,18 @@ // VGJ: sort of inlined maximizeInst() below. Adding // bounds can cause lobounds that are above hibounds. List hibounds = Type.filter(that.hibounds, errorFilter); + Type hb = null; if (hibounds.isEmpty()) - return; - Type hb = null; - if (hibounds.tail.isEmpty()) + hb = syms.objectType; + else if (hibounds.tail.isEmpty()) hb = hibounds.head; - else for (List bs = hibounds; - bs.nonEmpty() && hb == null; - bs = bs.tail) { - if (isSubClass(bs.head, hibounds)) - hb = types.fromUnknownFun.apply(bs.head); - } + else + hb = types.glb(hibounds); if (hb == null || - !types.isSubtypeUnchecked(hb, hibounds, warn) || - !types.isSubtypeUnchecked(that.inst, hb, warn)) - throw ambiguousNoInstanceException; + hb.isErroneous()) + throw ambiguousNoInstanceException + .setMessage("incompatible.upper.bounds", + that.qtype, hibounds); } }