Skip to content

Commit b590f33

Browse files
committed
Do not exclude the DiffTree root from isAnnotation
Not having an explicit root gives the opportunity for `isAnnotation() ^ isArtifact()` to hold. The tests indicate only once place needing change for this to work: The root node should not print `#endif` after the root node.
1 parent bb68ddb commit b590f33

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

  • src/main/java/org/variantsync/diffdetective/diff/difftree

src/main/java/org/variantsync/diffdetective/diff/difftree/DiffNode.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,7 @@ public boolean isRoot() {
978978
* Returns {@link NodeType#isAnnotation()} for this node's {@link DiffNode#nodeType}.
979979
*/
980980
public boolean isAnnotation() {
981-
return this.nodeType.isAnnotation() && !this.isRoot();
981+
return this.nodeType.isAnnotation();
982982
}
983983

984984
/**
@@ -1115,7 +1115,7 @@ public String toTextDiff() {
11151115
}
11161116

11171117
// Add endif after macro
1118-
if (isAnnotation()) {
1118+
if (isAnnotation() && !isRoot()) {
11191119
diff
11201120
.append(toTextDiffLine(this.diffType, List.of(NodeType.ENDIF.asMacroText())))
11211121
.append(StringUtils.LINEBREAK);

0 commit comments

Comments
 (0)