Refactor AbstractEffectiveModule 15/86015/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 26 Nov 2019 11:27:57 +0000 (12:27 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 27 Nov 2019 08:34:47 +0000 (09:34 +0100)
commit8ee27503bbf18f614aa21956bcd483ad0a96f985
tree208b71edb72d29eeccbf2a4d4e91ad1e5c1065b5
parentefd6bb5760a297649ce6a1f2434ae7ed62e13659
Refactor AbstractEffectiveModule

AbstractEffectiveModule has a number of special cases in its
constructor, effectively adding behavior based on expected subclass.

Furthermore its layout does not correctly propagate declared/effective
substatements towards superclass, leading to partially-populated
data/schema tree namespaces.

This patch moves the special handling bits to subclasses, making
AbstractEffectiveModule properly agnostic of whether it is used as
a ModuleEffectiveStatement or SubmoduleEffectiveStatement.

For the mechanics of including submodule effective statements into
the main module we introduce ModuleStmtContext, which performs the
semantic addition, thus all StmtContexts are properly visible as if
they were declared in the main module.

JIRA: YANGTOOLS-1042
Change-Id: Ice9609c2db82981ec9156d076f8a02bc637181b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 32b112dc64848d9c1cf0ea227109ca9a1265e2e7)
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/module/ModuleEffectiveStatementImpl.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/module/ModuleStmtContext.java [new file with mode: 0644]
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/submodule/SubmoduleEffectiveStatementImpl.java
yang/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/YT1042Test.java [new file with mode: 0644]
yang/yang-parser-rfc7950/src/test/resources/bugs/YT1042/bar.yang [new file with mode: 0644]
yang/yang-parser-rfc7950/src/test/resources/bugs/YT1042/foo.yang [new file with mode: 0644]