Skip to content

Commit 8df7013

Browse files
committed
Fix matching of throws Javadoc tags (#976)
JabRef/jabref-koppor#716 jablib/src/main/java/org/jabref/logic/crawler/StudyRepository.java
1 parent d350b2a commit 8df7013

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/java/gr/uom/java/xmi/diff/UMLJavadocDiff.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ else if(tagBefore.isReturn() && tagAfter.isReturn()) {
166166
}
167167
else if(tagBefore.isThrows() && tagAfter.isThrows()) {
168168
boolean match = processModifiedTags(tagBefore, tagAfter);
169-
if(match) {
169+
if(match && !throwsTagAlreadyMatchedWithSameType(tagAfter)) {
170170
deletedToBeDeleted.add(tagBefore);
171171
addedToBeDeleted.add(tagAfter);
172172
Pair<UMLTagElement, UMLTagElement> pair = Pair.of(tagBefore, tagAfter);
@@ -235,6 +235,15 @@ else if(tagBefore.isSee() && tagAfter.isSee()) {
235235
this.addedTags.addAll(addedTags);
236236
}
237237

238+
private boolean throwsTagAlreadyMatchedWithSameType(UMLTagElement tagAfter) {
239+
for(Pair<UMLTagElement, UMLTagElement> pair : commonTags) {
240+
if(pair.getRight().equals(tagAfter) && pair.getLeft().getFragments().get(0).equals(pair.getRight().getFragments().get(0))) {
241+
return true;
242+
}
243+
}
244+
return false;
245+
}
246+
238247
private void matchNestedTags(UMLTagElement tagBefore, UMLTagElement tagAfter) {
239248
List<UMLTagElement> nestedTagsBefore = tagBefore.getNestedTags();
240249
List<UMLTagElement> nestedTagsAfter = tagAfter.getNestedTags();

0 commit comments

Comments
 (0)