Compiler mishandles three-way return-type-substitutability

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • 8
    • Affects Version/s: 8
    • Component/s: tools
    • None
    • b96
    • generic
    • generic
    • Verified

      This fails to compile:

      ---

       interface I {
         Object m(Iterable l);
       }

       interface J<S> {
         S m(Iterable<String> l);
       }

       interface K<T> {
         T m(Iterable<String> l);
       }

       interface Functional<S,T> extends I, J<S>, K<T> {}

      ---

      On the other hand, this compiles fine:

      ---

      interface Parent<T> {
         T m(Iterable<String> i);
       }

       interface Child<T> extends Parent<T> {
         Object m(Iterable i);
       }

      ---

      This compiles fine, too:

      ---

      interface I {
         int[] m(Iterable l);
       }

       interface J<S> {
         java.io.Serializable m(Iterable<String> l);
       }

       interface K<T> {
         Cloneable m(Iterable<String> l);
       }

       interface Functional<S,T> extends I, J<S>, K<T> {}

      ---
       
      Problem appears to be that javac is looking for pairwise return-type-substitutable when it uses the rule "R1 = |R2|", while JLS 9.4.1 just says that there needs to be one method RTS for all the others.

            Assignee:
            Maurizio Cimadamore
            Reporter:
            Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: