RPC statement should refuse to get copied 72/94672/2
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 19 Jan 2021 21:54:59 +0000 (22:54 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Tue, 19 Jan 2021 22:24:51 +0000 (23:24 +0100)
RPCs cannot be defined inside reusable constructs and therefore
they should never be copied. Use the appropriate policy.

JIRA: YANGTOOLS-1195
Change-Id: I4cbf582cac0a4865447bc3782cf1771c96d7cba3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/BaseSchemaTreeStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/rpc/RpcStatementSupport.java

index ea75558dc2fd345e2d81107a7f5ab5b589ff1568..8145894fc735ea164e63d81e68186509b5d5aa51 100644 (file)
@@ -26,6 +26,12 @@ import org.opendaylight.yangtools.yang.parser.spi.meta.StmtContextUtils;
  */
 public abstract class BaseSchemaTreeStatementSupport<D extends DeclaredStatement<QName>,
         E extends SchemaTreeEffectiveStatement<D>> extends AbstractQNameStatementSupport<D, E> {
+    protected BaseSchemaTreeStatementSupport(final StatementDefinition publicDefinition,
+            final StatementPolicy<QName, D> policy) {
+        super(publicDefinition, policy);
+    }
+
+    @Deprecated
     protected BaseSchemaTreeStatementSupport(final StatementDefinition publicDefinition, final CopyPolicy copyPolicy) {
         super(publicDefinition, copyPolicy);
     }
index a532af4cddb8f39eab425cfc81fe01ff500af72e..38380d759216f0454c9042d001ae5f88d76e3fa8 100644 (file)
@@ -60,7 +60,7 @@ public final class RpcStatementSupport extends BaseSchemaTreeStatementSupport<Rp
 
     private RpcStatementSupport(final InputStatementSupport implicitInput,
             final OutputStatementSupport implicitOutput) {
-        super(YangStmtMapping.RPC, CopyPolicy.DECLARED_COPY);
+        super(YangStmtMapping.RPC, StatementPolicy.reject());
         this.implicitInput = requireNonNull(implicitInput);
         this.implicitOutput = requireNonNull(implicitOutput);
     }