Skip to content

Commit df64e8a

Browse files
committed
Eliminate a nested if
Sonar is pointing out an if/if block, collapse the two to fix the issue up. Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
1 parent 4768c99 commit df64e8a

File tree

1 file changed

+3
-5
lines changed
  • triemap/src/main/java/tech/pantheon/triemap

1 file changed

+3
-5
lines changed

triemap/src/main/java/tech/pantheon/triemap/INode.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -520,11 +520,9 @@ private void cleanParent(final Object nonlive, final INode<K, V> parent, final T
520520
final var sub = cn.array[pos];
521521
if (sub == this && nonlive instanceof TNode<?, ?> tn) {
522522
final var ncn = cn.updatedAt(pos, tn.copyUntombed(), gen).toContracted(lev - LEVEL_BITS);
523-
if (!parent.gcas(cn, ncn, ct)) {
524-
if (ct.readRoot().gen == startgen) {
525-
// Tail recursion: cleanParent(nonlive, parent, ct, hc, lev, startgen);
526-
continue;
527-
}
523+
if (!parent.gcas(cn, ncn, ct) && ct.readRoot().gen == startgen) {
524+
// Tail recursion: cleanParent(nonlive, parent, ct, hc, lev, startgen);
525+
continue;
528526
}
529527
}
530528
break;

0 commit comments

Comments
 (0)