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

changeset 1087
3a2200681d69
parent 1006
a2d422d480cb
child 1114
05814303a056
     1.1 --- a/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Sep 13 14:15:22 2011 +0100
     1.2 +++ b/src/share/classes/com/sun/tools/javac/comp/Infer.java	Tue Sep 13 14:15:39 2011 +0100
     1.3 @@ -269,21 +269,18 @@
     1.4              // VGJ: sort of inlined maximizeInst() below.  Adding
     1.5              // bounds can cause lobounds that are above hibounds.
     1.6              List<Type> hibounds = Type.filter(that.hibounds, errorFilter);
     1.7 +            Type hb = null;
     1.8              if (hibounds.isEmpty())
     1.9 -                return;
    1.10 -            Type hb = null;
    1.11 -            if (hibounds.tail.isEmpty())
    1.12 +                hb = syms.objectType;
    1.13 +            else if (hibounds.tail.isEmpty())
    1.14                  hb = hibounds.head;
    1.15 -            else for (List<Type> bs = hibounds;
    1.16 -                      bs.nonEmpty() && hb == null;
    1.17 -                      bs = bs.tail) {
    1.18 -                if (isSubClass(bs.head, hibounds))
    1.19 -                    hb = types.fromUnknownFun.apply(bs.head);
    1.20 -            }
    1.21 +            else
    1.22 +                hb = types.glb(hibounds);
    1.23              if (hb == null ||
    1.24 -                !types.isSubtypeUnchecked(hb, hibounds, warn) ||
    1.25 -                !types.isSubtypeUnchecked(that.inst, hb, warn))
    1.26 -                throw ambiguousNoInstanceException;
    1.27 +                hb.isErroneous())
    1.28 +                throw ambiguousNoInstanceException
    1.29 +                        .setMessage("incompatible.upper.bounds",
    1.30 +                                    that.qtype, hibounds);
    1.31          }
    1.32      }
    1.33  

mercurial