Improve {Action,Notification}NodeContainerCompat safety 93/87493/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 6 Feb 2020 13:53:09 +0000 (14:53 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 6 Feb 2020 13:53:09 +0000 (14:53 +0100)
Recent conversion has shown that we need to better guard these
mixins -- they require use with a SchemaTreeAwareEffectiveStatement.

This captures this requirement in the contract, making
SubmoduleEffectiveStatement correctly be DataTreeAwareEffectiveStatement.

Change-Id: I39a30da293a3088cad912371613d87560eb39605
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/SubmoduleEffectiveStatement.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/compat/ActionNodeContainerCompat.java
yang/yang-model-api/src/main/java/org/opendaylight/yangtools/yang/model/api/stmt/compat/NotificationNodeContainerCompat.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/AbstractEffectiveModule.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/container/ContainerEffectiveStatementImpl.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/list/AbstractListEffectiveStatement.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/module/ModuleEffectiveStatementImpl.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/submodule/SubmoduleEffectiveStatementImpl.java

index 953285a96acd4a975713dbc00179543b85791297..65993c39c4b80f2e425d23ae2b8b27bc89227401 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.yangtools.yang.model.api.stmt;
 
 import com.google.common.annotations.Beta;
-import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 
 /**
  * Representation of {@code submodule} statement. Note that implementations of this interface are required to provide
@@ -16,6 +15,6 @@ import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
  * {@link ModuleEffectiveStatement.QNameModuleToPrefixNamespace} namespaces.
  */
 @Beta
-public interface SubmoduleEffectiveStatement extends EffectiveStatement<String, SubmoduleStatement> {
+public interface SubmoduleEffectiveStatement extends DataTreeAwareEffectiveStatement<String, SubmoduleStatement> {
 
 }
index 1f0ced6239d785925a52642681aa22a0c0c02911..f2f4f4d01eaae633a36e97fe5eeb634122b8ac42 100644 (file)
@@ -20,7 +20,8 @@ import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeAwareEffectiveSt
  * {@link SchemaTreeAwareEffectiveStatement}.
  */
 @Beta
-public interface ActionNodeContainerCompat<A, D extends DeclaredStatement<A>>
+public interface ActionNodeContainerCompat<A, D extends DeclaredStatement<A>,
+        E extends SchemaTreeAwareEffectiveStatement<A, D>>
         extends SchemaTreeAwareEffectiveStatement<A, D>, ActionNodeContainer {
 
     @Override
index 37a64bfb4faa0203603bcd496515697457b2d272..16e9dc38ab8a98d6df668a1f1e14cd8ef6f4f8a5 100644 (file)
@@ -20,7 +20,8 @@ import org.opendaylight.yangtools.yang.model.api.stmt.SchemaTreeAwareEffectiveSt
  * {@link SchemaTreeAwareEffectiveStatement}.
  */
 @Beta
-public interface NotificationNodeContainerCompat<A, D extends DeclaredStatement<A>>
+public interface NotificationNodeContainerCompat<A, D extends DeclaredStatement<A>,
+        E extends SchemaTreeAwareEffectiveStatement<A, D>>
         extends SchemaTreeAwareEffectiveStatement<A, D>, NotificationNodeContainer {
 
     @Override
index cb977f527db2ec0c196e76807aeca6ed602d88c4..8de6d290a63c8c20c64466efdd7e216d0b27e506 100644 (file)
@@ -47,6 +47,7 @@ import org.opendaylight.yangtools.yang.model.api.meta.DeclaredStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.EffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.meta.IdentifierNamespace;
 import org.opendaylight.yangtools.yang.model.api.stmt.ContactEffectiveStatement;
+import org.opendaylight.yangtools.yang.model.api.stmt.DataTreeAwareEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ImportEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.ModuleEffectiveStatement;
 import org.opendaylight.yangtools.yang.model.api.stmt.OrganizationEffectiveStatement;
@@ -63,9 +64,10 @@ import org.opendaylight.yangtools.yang.parser.spi.source.ImportPrefixToModuleCtx
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
 @Beta
-public abstract class AbstractEffectiveModule<D extends DeclaredStatement<String>> extends
+public abstract class AbstractEffectiveModule<D extends DeclaredStatement<String>,
+        E extends DataTreeAwareEffectiveStatement<String, D>> extends
         AbstractSchemaEffectiveDocumentedNode<String, D> implements Module,
-        NotificationNodeContainerCompat<String, D> {
+        NotificationNodeContainerCompat<String, D, E> {
     private final String name;
     private final String prefix;
     private final YangVersion yangVersion;
index b283cb3d233e1d314f4152b82ed67e8911ce4da1..c8c8e240b86b49356cc5498d210d91536721393c 100644 (file)
@@ -39,9 +39,9 @@ final class ContainerEffectiveStatementImpl
         implements ContainerEffectiveStatement, ContainerSchemaNode, DerivableSchemaNode,
             DataSchemaNodeMixin<QName, ContainerStatement>, DataNodeContainerMixin<QName, ContainerStatement>,
             ActionNodeContainerMixin<QName, ContainerStatement>,
-            ActionNodeContainerCompat<QName, ContainerStatement>,
+            ActionNodeContainerCompat<QName, ContainerStatement, ContainerEffectiveStatement>,
             NotificationNodeContainerMixin<QName, ContainerStatement>,
-            NotificationNodeContainerCompat<QName, ContainerStatement>,
+            NotificationNodeContainerCompat<QName, ContainerStatement, ContainerEffectiveStatement>,
             MustConstraintMixin<QName, ContainerStatement>, PresenceMixin<QName, ContainerStatement>,
             AugmentationTargetMixin<QName, ContainerStatement> {
 
index 4c515ce28d1c56cfea3bfa6aed190d8d609f3abb..b10d3ad4961aea1a0048bd3c1681d6e0b3b1951c 100644 (file)
@@ -40,7 +40,8 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 abstract class AbstractListEffectiveStatement
         extends DefaultWithDataTree<QName, ListStatement, ListEffectiveStatement>
         implements ListEffectiveStatement, ListSchemaNode, DerivableSchemaNode,
-            ActionNodeContainerCompat<QName, ListStatement>, NotificationNodeContainerCompat<QName, ListStatement>,
+            ActionNodeContainerCompat<QName, ListStatement, ListEffectiveStatement>,
+            NotificationNodeContainerCompat<QName, ListStatement, ListEffectiveStatement>,
             DataSchemaNodeMixin<QName, ListStatement>, UserOrderedMixin<QName, ListStatement>,
             DataNodeContainerMixin<QName, ListStatement>, WhenConditionMixin<QName, ListStatement>,
             AugmentationTargetMixin<QName, ListStatement>, NotificationNodeContainerMixin<QName, ListStatement>,
index 7bda11fac522da859e96418c2297751280eb2ec8..d6a9a160812bd30835ee6b49c6d85d20eb8a42cb 100644 (file)
@@ -42,7 +42,7 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContext;
 import org.opendaylight.yangtools.yang.parser.spi.source.IncludedSubmoduleNameToModuleCtx;
 import org.opendaylight.yangtools.yang.parser.spi.source.ModuleCtxToModuleQName;
 
-final class ModuleEffectiveStatementImpl extends AbstractEffectiveModule<ModuleStatement>
+final class ModuleEffectiveStatementImpl extends AbstractEffectiveModule<ModuleStatement, ModuleEffectiveStatement>
         implements ModuleEffectiveStatement {
     private final ImmutableMap<String, SubmoduleEffectiveStatement> nameToSubmodule;
     private final ImmutableMap<QName, ExtensionEffectiveStatement> qnameToExtension;
index c3d1d6731cc8439c03b6bbc31c9a216a58764cf2..dcdd68bd7cda96a123716f279bfd1918d2afc1da 100644 (file)
@@ -42,7 +42,8 @@ import org.opendaylight.yangtools.yang.parser.spi.source.IncludedSubmoduleNameTo
 import org.opendaylight.yangtools.yang.parser.spi.source.ModuleNameToModuleQName;
 import org.opendaylight.yangtools.yang.parser.spi.source.SourceException;
 
-final class SubmoduleEffectiveStatementImpl extends AbstractEffectiveModule<SubmoduleStatement>
+final class SubmoduleEffectiveStatementImpl
+        extends AbstractEffectiveModule<SubmoduleStatement, SubmoduleEffectiveStatement>
         implements SubmoduleEffectiveStatement, MutableStatement {
     private final ImmutableMap<String, ModuleEffectiveStatement> prefixToModule;
     private final ImmutableMap<QNameModule, String> namespaceToPrefix;