Fix two sonar issues 06/96806/1
authorRobert Varga <robert.varga@pantheon.tech>
Mon, 5 Jul 2021 14:50:54 +0000 (16:50 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Mon, 5 Jul 2021 14:50:54 +0000 (16:50 +0200)
Rather than using a boolean constant in a ?: expression, use a simple
logical or, which does the same thing, but more densely.

Change-Id: If0ce9e755f1323cd28926f4f03f4c8168f7ce8b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
parser/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java

index 65656d4efa5ba85c3e4541b6cf033756f4170547..d3fd8206efcd9651136509f27ae1f6ab18dc4666 100644 (file)
@@ -446,7 +446,7 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
 
     @Override
     final boolean doTryToCompletePhase(final byte targetOrder) {
-        final boolean finished = phaseMutation.isEmpty() ? true : runMutations(targetOrder);
+        final boolean finished = phaseMutation.isEmpty() || runMutations(targetOrder);
         if (completeChildren(targetOrder) && finished) {
             onPhaseCompleted(targetOrder);
             return true;
@@ -468,7 +468,7 @@ public abstract class StatementContextBase<A, D extends DeclaredStatement<A>, E
     private boolean runMutations(final byte targetOrder) {
         final ModelProcessingPhase phase = verifyNotNull(ModelProcessingPhase.ofExecutionOrder(targetOrder));
         final Collection<ContextMutation> openMutations = phaseMutation.get(phase);
-        return openMutations.isEmpty() ? true : runMutations(phase, openMutations);
+        return openMutations.isEmpty() || runMutations(phase, openMutations);
     }
 
     private boolean runMutations(final ModelProcessingPhase phase, final Collection<ContextMutation> openMutations) {