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

Regression: inference fails to reject incompatible upper bounds

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b112
    • Verification:
      Verified

      Description

      The following program erroneously compiles after JDK-8046685:

      import java.util.List;

      class Test {
      <A2 extends A, A> A m(List<? super A2> a2) { return null; }
      <B> B g(B b) { return null; }

      void test() {
      List<Integer> I = null;
      String s = g(m(I));
      }
      }

      This used to give the following error:

      error: incompatible types: inference variable A2 has incompatible upper bounds String,B,Object,Integer,A
      String s = g(m(I));
      ^
        where A2,A,B are type-variables:
          A2 extends A declared in method <A2,A>m(List<? super A2>)
          A extends Object declared in method <A2,A>m(List<? super A2>)
          B extends Object declared in method <B>g(B)
      1 error

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mcimadamore Maurizio Cimadamore
                Reporter:
                mcimadamore Maurizio Cimadamore
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: