From 41ed305a7dce99e21a7b1066711347147dc067d8 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Wed, 17 Feb 2021 23:42:02 +0100 Subject: [PATCH] Use simple requireNonNull() StatementContextBase.addPhaseCompletedListener() is the heart of inference and the checkNotNull() here is taking sourceReference(). Acquiring source reference is an indirection, which may actually got through a forwarding chain. While we could use and if/throws, let's just use plain requireNonNull. JIRA: YANGTOOLS-652 Change-Id: I77d5b1dcc8b6b575d01ced0850d7081909b57964 Signed-off-by: Robert Varga (cherry picked from commit cd04351669d5921088a73a275954ba78336c1a44) --- .../yang/parser/stmt/reactor/StatementContextBase.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java b/yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java index a9aa4099c3..e51b39706c 100644 --- a/yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java +++ b/yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/StatementContextBase.java @@ -8,7 +8,6 @@ package org.opendaylight.yangtools.yang.parser.stmt.reactor; import static com.google.common.base.Preconditions.checkArgument; -import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Preconditions.checkState; import static com.google.common.base.Verify.verify; import static java.util.Objects.requireNonNull; @@ -809,8 +808,8 @@ public abstract class StatementContextBase, E * @throws NullPointerException if any of the arguments is null */ void addPhaseCompletedListener(final ModelProcessingPhase phase, final OnPhaseFinished listener) { - checkNotNull(phase, "Statement context processing phase cannot be null at: %s", getStatementSourceReference()); - checkNotNull(listener, "Statement context phase listener cannot be null at: %s", getStatementSourceReference()); + requireNonNull(phase, "Statement context processing phase cannot be null"); + requireNonNull(listener, "Statement context phase listener cannot be null"); ModelProcessingPhase finishedPhase = completedPhase; while (finishedPhase != null) { -- 2.36.6