Do not use substatements in StmtContextUtils.getRootModuleQName() 88/101488/7
authorSangwook Ha <sangwook.ha@verizon.com>
Tue, 7 Jun 2022 21:12:36 +0000 (14:12 -0700)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 17 Aug 2022 12:46:45 +0000 (14:46 +0200)
commit30f4e375338124bbb66d2bf1e1c65d0968fd1f0e
treee9b091e18db590ba9b186121b56bd235f269c152
parent6bd1b92fa0aea9090821f5d3313459cb8cfb849e
Do not use substatements in StmtContextUtils.getRootModuleQName()

Building effective model fails when a grouping in a submodule
is augmented from another submodule or the unique statement points
to a leaf in a grouping from another submodule.

Add test cases to reproduce the issues, which points to us accessing
substatements of submodules after all references have been resolved.

Since we already rely on SOURCE_LINKAGE being complete in this method
(e.g. ModuleCtxToModuleQName being populated), switch from using
statement enumeration to also using the BelongsToPrefixToModuleCtx
namespace, which resolved during that same phase.

JIRA: YANGTOOLS-1436
Change-Id: I71eb1122bf7c3820043a3197249a3b2fba6e9e8c
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/YT1436Test.java [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1436/augment/foo-a.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1436/augment/foo-b.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1436/augment/foo.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1436/unique/bar-a.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1436/unique/bar-b.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1436/unique/bar.yang [new file with mode: 0644]
parser/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StmtContextUtils.java