Skip to content

Commit

Permalink
Merge pull request #382 from guillermocalvo/extend-compatibility-inte…
Browse files Browse the repository at this point in the history
…rface

Refactor interface hierarchy to avoid unnecessary casting
  • Loading branch information
siom79 authored Feb 24, 2024
2 parents f4cf4cc + 7935cb7 commit 8821891
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ private void evaluateBinaryCompatibility(JApiClass jApiClass, Map<String, JApiCl
private void checkIfGenericTemplatesHaveChanged(JApiHasGenericTemplates jApiHasGenericTemplates) {
for (JApiGenericTemplate jApiGenericTemplate : jApiHasGenericTemplates.getGenericTemplates()) {
if (jApiGenericTemplate.getChangeStatus() != JApiChangeStatus.UNCHANGED) {
((JApiCompatibility)jApiHasGenericTemplates).getCompatibilityChanges().add(JApiCompatibilityChange.CLASS_GENERIC_TEMPLATE_CHANGED);
jApiHasGenericTemplates.getCompatibilityChanges().add(JApiCompatibilityChange.CLASS_GENERIC_TEMPLATE_CHANGED);
break;
}
}
Expand All @@ -86,7 +86,7 @@ private void checkIfGenericTemplatesHaveChanged(JApiHasGenericTemplates jApiHasG
if (changeStatus == JApiChangeStatus.MODIFIED || changeStatus == JApiChangeStatus.UNCHANGED) {
if (!SignatureParser.equalGenericTypes(jApiGenericTemplate.getOldGenericTypes(), jApiGenericTemplate.getNewGenericTypes())) {
jApiGenericTemplate.getCompatibilityChanges().add(JApiCompatibilityChange.CLASS_GENERIC_TEMPLATE_GENERICS_CHANGED);
((JApiCompatibility)jApiHasGenericTemplates).getCompatibilityChanges().add(JApiCompatibilityChange.CLASS_GENERIC_TEMPLATE_GENERICS_CHANGED);
jApiHasGenericTemplates.getCompatibilityChanges().add(JApiCompatibilityChange.CLASS_GENERIC_TEMPLATE_GENERICS_CHANGED);
break;
}
}
Expand Down Expand Up @@ -470,7 +470,7 @@ private void checkIfAnnotationDeprecatedAdded(JApiHasAnnotations jApiHasAnnotati
for (JApiAnnotation annotation : jApiHasAnnotations.getAnnotations()) {
if (annotation.getChangeStatus() == JApiChangeStatus.NEW || annotation.getChangeStatus() == JApiChangeStatus.MODIFIED) {
if (annotation.getFullyQualifiedName().equals(Deprecated.class.getName())) {
addCompatibilityChange((JApiCompatibility) jApiHasAnnotations, JApiCompatibilityChange.ANNOTATION_DEPRECATED_ADDED);
addCompatibilityChange(jApiHasAnnotations, JApiCompatibilityChange.ANNOTATION_DEPRECATED_ADDED);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
/**
* Implemented by all elements that can have annotations.
*/
public interface JApiHasAnnotations {
public interface JApiHasAnnotations extends JApiCompatibility {
/**
* Returns a list of annotations as {@link japicmp.model.JApiAnnotation}.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

import java.util.List;

public interface JApiHasGenericTemplates {
public interface JApiHasGenericTemplates extends JApiCompatibility {
List<JApiGenericTemplate> getGenericTemplates();
}

0 comments on commit 8821891

Please sign in to comment.