Do not build unknown statements twice 20/95220/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 18 Feb 2021 00:40:52 +0000 (01:40 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 18 Feb 2021 00:41:31 +0000 (01:41 +0100)
SpotBugs is spotting this in an unrelated change, we should be
checking the product.

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

index d24b29cb21e430ab9743b84bdd30e53b1196cdc0..4e910c269465bdae8e7d8c88c7816dbd06e2370c 100644 (file)
@@ -7,7 +7,8 @@
  */
 package org.opendaylight.yangtools.yang.parser.rfc7950.stmt;
 
-import com.google.common.base.Preconditions;
+import static com.google.common.base.Preconditions.checkState;
+
 import com.google.common.collect.ImmutableList;
 import org.eclipse.jdt.annotation.NonNull;
 import org.opendaylight.yangtools.yang.common.QName;
@@ -44,9 +45,9 @@ public abstract class UnknownEffectiveStatementBase<A, D extends UnknownStatemen
             nodeType = stmt.publicDefinition().getStatementName();
         } else {
             final EffectiveStatement<QName, ExtensionStatement> effective = extensionInit.buildEffective();
-            Preconditions.checkState(effective instanceof ExtensionDefinition,
+            checkState(effective instanceof ExtensionDefinition,
                 "Statement %s is not an ExtensionDefinition", effective);
-            extension = (ExtensionDefinition) extensionInit.buildEffective();
+            extension = (ExtensionDefinition) effective;
             nodeType = null;
         }