Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8059898

4.10.4: lub incorrect for '? extends T', '? super T' combination

XMLWordPrintable

      Per JLS 4.10.4, lub(List<? extends Exception>, List<? super Exception>) = List<Exception>.

      lcta(? extends U, ? super V) = U if U = V, otherwise ?

      This is not correct -- the result is not a supertype of either of the inputs. (Effectively this is computing a glb, not a lub.)

      The right thing to do is to find a wildcard that includes the union of the ranges represented by two wildcards -- always an unbounded wildcard, '?'

            abuckley Alex Buckley
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: