0

I understand the term superinterface can be ambiguous. Let me explain.

  • Interface AB extends interfaces A and B.

  • A and B don't extend anything else.

Now, we have abstract class X implementing both AB and A.

Why is this necessary? Isn't it enough for abstract class X just to implement AB?

kgf3JfUtW
  • 13,702
  • 10
  • 57
  • 80
  • 2
    Yes, that is sufficient. You can add `[implements] A, B` for explicitness. – daniu Feb 08 '18 at 15:43
  • 2
    Maybe some legacy code stayed in there, as it originally only implemented `A`? Or maybe for documentation clarity? Functionally, it doesn't change a thing and the `A` part could be removed. – Mena Feb 08 '18 at 15:43
  • 1
    It most likely only does implement the implement `AB`, the JavaDoc tool shows the entire relationship regardless of how the programmer chooses to specify it. – Elliott Frisch Feb 08 '18 at 15:44
  • 1
    *Right now* AB extends A and B, but that may change. If you "simplify" the interfaces implemented, you may lose capturing the original intention. – Bohemian Feb 08 '18 at 15:46
  • 1
    Usually interfaces extending other interface(s) is a sign of over engineering. – tsolakp Feb 08 '18 at 16:01

0 Answers0