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

8.4.8.4: Clarify inheritance of multiple override-equivalent signatures

    XMLWordPrintable

    Details

      Description

      A DESCRIPTION OF THE PROBLEM :
      JLS 18 §8.4.8.4. "Inheriting Methods with Override-Equivalent Signatures" says:
      > It is a compile-time error if a class C inherits a concrete method whose signature is override-equivalent with another method inherited by C.

      However, this sentence conflicts with the definition of "inherits" in §8.4.8. "Inheritance, Overriding, and Hiding":
      > No method declared in C has a signature that is a subsignature (§8.4.2) of the signature of m as a member of D
      > [...]
      > No concrete method inherited by C from its direct superclass type has a signature that is a subsignature of the signature of m as a member of D

      I assume §8.4.8.4 is supposed to prevent the following:
      ```
      class C {
          public static void m() {}
      }

      interface I {
          void m();
      }

      class T extends C implements I {}
      ```

      However, in this case the abstract method from `I` is not considered "inherited" due to the definition in §8.4.8; and this specific case might actually already be covered by §8.4.8.2. "Hiding (by Class Methods)". Or which specific cases is the sentence in §8.4.8.4. supposed to cover, which are not covered already by another definition?

      (Also: It would be good to clarify the definition for "inherits", because it refers only to "direct" supertypes even when transitive supertypes are considered as well for multiple of the sentences (?))


        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gbierman Gavin Bierman
              Reporter:
              webbuggrp Webbug Group
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: