From 09755fe9c958f3b10e49ec533a589fb0ad60545d Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Mon, 26 Dec 2016 17:34:10 +0100 Subject: [PATCH] Fix mandatory statement checking This fixes a mismatch between the comment and what the method actually does. For some reason we ended up iterating over the same collection twice. Furthermore use .forEach() with a self-referencing lambda instead of Iterables.concat(), as that can be optimized by the implementation. Change-Id: I6f74794fd58576b9ce34b6f27217b5e81bef4457 Signed-off-by: Robert Varga --- .../yang/parser/stmt/rfc6020/AugmentStatementImpl.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/AugmentStatementImpl.java b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/AugmentStatementImpl.java index 47e59579de..b570d68908 100644 --- a/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/AugmentStatementImpl.java +++ b/yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/rfc6020/AugmentStatementImpl.java @@ -10,7 +10,6 @@ package org.opendaylight.yangtools.yang.parser.stmt.rfc6020; import com.google.common.base.Verify; import com.google.common.collect.ImmutableList.Builder; import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -272,10 +271,8 @@ public class AugmentStatementImpl extends AbstractDeclaredStatement sourceSubStatement : Iterables.concat( - sourceCtx.declaredSubstatements(), sourceCtx.declaredSubstatements())) { - checkForMandatoryNodes(sourceSubStatement); - } + sourceCtx.declaredSubstatements().forEach(Definition::checkForMandatoryNodes); + sourceCtx.effectiveSubstatements().forEach(Definition::checkForMandatoryNodes); } InferenceException.throwIf(StmtContextUtils.isMandatoryNode(sourceCtx), -- 2.36.6