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

Graph inference: wrong logic for picking best variable to solve

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P3
    • 8
    • 8, 8-repo-lambda
    • tools
    • b100
    • Verified

    Description

      This program fails to compile:

      import java.util.Map;

      class TestData<X,Y> { }

      interface Foo<X, Y extends Foo<X, Y>> { }

      interface IntFoo extends Foo<Integer, IntFoo> { }

      interface Function<X, Y> {
        Y apply(X x);
      }


      class Test {
              void test(TestData<Integer, IntFoo> data) {
                 m(data, s->s);
              }

      <E, E_OUT extends Foo<E, E_OUT>, W, W_IN extends Foo<W, W_IN>> void m(TestData<W, W_IN> data, Function<W_IN, E_OUT> m) { }
      }

      Note: if inference variable in the 'm' method are swapped, so that W, W_IN come first, the program compiles.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: