Bug 4506: Honor if-feature during SchemaContext assembly
[yangtools.git] / yang / yang-parser-impl / src / main / java / org / opendaylight / yangtools / yang / parser / stmt / rfc6020 / AugmentStatementImpl.java
index 0638d31abdbe763935d0b09c741ecca899df3d1f..97edbf247dbfd06824737354273f1cc982fb4110 100644 (file)
@@ -90,6 +90,10 @@ public class AugmentStatementImpl extends AbstractDeclaredStatement<SchemaNodeId
         @Override
         public void onFullDefinitionDeclared(
                 final StmtContext.Mutable<SchemaNodeIdentifier, AugmentStatement, EffectiveStatement<SchemaNodeIdentifier, AugmentStatement>> augmentNode) {
+            if (!StmtContextUtils.areFeaturesSupported(augmentNode)) {
+                return;
+            }
+
             SUBSTATEMENT_VALIDATOR.validate(augmentNode);
 
             if (StmtContextUtils.isInExtensionBody(augmentNode)) {
@@ -107,7 +111,8 @@ public class AugmentStatementImpl extends AbstractDeclaredStatement<SchemaNodeId
                 @Override
                 public void apply() {
                     final StatementContextBase<?, ?, ?> augmentTargetCtx = (StatementContextBase<?, ?, ?>) target.get();
-                    if (!AugmentUtils.isSupportedAugmentTarget(augmentTargetCtx) || StmtContextUtils.isInExtensionBody(augmentTargetCtx)) {
+                    if (!AugmentUtils.isSupportedAugmentTarget(augmentTargetCtx)
+                            || StmtContextUtils.isInExtensionBody(augmentTargetCtx)) {
                         augmentNode.setIsSupportedToBuildEffective(false);
                         return;
                     }