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 (?))
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 (?))
- relates to
-
JDK-8284566 javac does not report clashing default methods
-
- In Progress
-