Skip to content

Commit

Permalink
Match single-tag javadocs, regardless of their textual contents
Browse files Browse the repository at this point in the history
  • Loading branch information
tsantalis committed Dec 10, 2024
1 parent 13242e2 commit 363a93b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/gr/uom/java/xmi/diff/UMLJavadocDiff.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ public UMLJavadocDiff(UMLJavadoc javadocBefore, UMLJavadoc javadocAfter, UMLOper
private void process(UMLJavadoc javadocBefore, UMLJavadoc javadocAfter) {
List<UMLTagElement> tagsBefore = javadocBefore.getTags();
List<UMLTagElement> tagsAfter = javadocAfter.getTags();
boolean singleTagJavadoc = tagsBefore.size() == 1 && tagsAfter.size() == 1;
List<UMLTagElement> deletedTags = new ArrayList<UMLTagElement>(tagsBefore);
List<UMLTagElement> addedTags = new ArrayList<UMLTagElement>(tagsAfter);
if(tagsBefore.size() <= tagsAfter.size()) {
Expand Down Expand Up @@ -208,6 +209,15 @@ else if(tagBefore.isThrows() && tagAfter.isThrows()) {
}
}
}
if(singleTagJavadoc && commonTags.isEmpty()) {
UMLTagElement tagBefore = deletedTags.get(0);
UMLTagElement tagAfter = addedTags.get(0);
deletedToBeDeleted.add(tagBefore);
addedToBeDeleted.add(tagAfter);
Pair<UMLTagElement, UMLTagElement> pair = Pair.of(tagBefore, tagAfter);
commonTags.add(pair);
matchNestedTags(tagBefore, tagAfter);
}
deletedTags.removeAll(deletedToBeDeleted);
addedTags.removeAll(addedToBeDeleted);
this.deletedTags.addAll(deletedTags);
Expand Down

0 comments on commit 363a93b

Please sign in to comment.