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

Inference doesn't report error on incompatible upper bounds

XMLWordPrintable

    • b17
    • Verified

      the example below compiles successfully on JDK8b132, but it seems to me that it should fail according to spec.

          class Container<U> {
              U t;
          }

          interface Supertype<U> {
          }

          interface Type1 extends Supertype<Number> {
          }

          interface Type2 extends Supertype<Integer> {
          }

          public class Main {
              static <U extends Type1> void m(Container<? super U> a) {
              }

              public static void main(String[] args) {
                  m(new Container<Type2>());
              }
          }

            mcimadamore Maurizio Cimadamore
            mcimadamore Maurizio Cimadamore
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: