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

18.4: Improve generation of fresh variables

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • 8u60
    • specification
    • None

      This began failing with the patch from JDK-8069545.

      ---

      class C<T> {}

      <S> C<S> makeC(Function<String,S> f) { return null; }
      <T extends Comparable<T>> void eatC(C<T> list) {}

      void test() {
          eatC(makeC(x->x));
      }

      ---

      Expected: compiles, S = T = String

      Actual: error:

      error: method eatC cannot be applied to given types;
          eatC(makeC(x->x));
          ^
        required: C<T>
        found: C<Object>
        reason: inferred type does not conform to upper bound(s)
          inferred: Object
          upper bound(s): Comparable<Object>,Object

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: