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

Super wildcard has incorrect upper bound

    Details

    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      import java.util.List;

      class Foo {}
      class Bar extends Foo {}
      interface FooList<T extends Foo> extends List<T> {}

      class Test {
          <T extends FooList<? super Bar>> void m(T t) {
      Foo f = t.get(0);
          }
      }
      The program below doesn't compile:

      $ javac Test.java
      Test.java:9: incompatible types
      found : java.lang.Object
      required: Foo
              Foo f = t.get(0);
                           ^
      1 error

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                ahe Peter Ahe
                Reporter:
                ahe Peter Ahe
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: