siom79 / japicmp

Comparison of two versions of a jar archive
https://siom79.github.io/japicmp
Apache License 2.0
694 stars 107 forks source link

Refactor interface hierarchy to avoid unnecessary casting #382

Closed guillermocalvo closed 5 months ago

guillermocalvo commented 5 months ago

Given that:

  1. All current implementations of JApiHasAnnotations and JApiHasGenericTemplates implement JApiCompatibility as well.
  2. Code in CompatibilityChanges assumes that any such instances can be safely casted to JApiCompatibility.

I believe that we can say that, by definition, all instances of JApiHasAnnotations and JApiHasGenericTemplates must be a JApiCompatibility.

So I think these two interfaces should extend JApiCompatibility to clarify this relationship and to avoid unnecessary type casting.