Refactor AbstractEffectiveModule 70/85970/10
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 00:34:43 +0000 (01:34 +0100)
commit32b112dc64848d9c1cf0ea227109ca9a1265e2e7
tree98d425bc6c016dcfbe9fbf0623df7fe2e561c25c
parentd1af6cd6063d8ee88caa09a78989dcedea9139d6
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>
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]