Do not access GroupingNamespace during effective build 53/94053/4
authorRobert Varga <robert.varga@pantheon.tech>
Fri, 4 Dec 2020 17:02:36 +0000 (18:02 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sat, 5 Dec 2020 13:27:21 +0000 (14:27 +0100)
commitd2047b2479d9de56a107b97042039f72127c4027
tree5291151dff5dcfdf6ffe299773b568e6c9dcbe9c
parentdb9f79fb739b8e6809226826d8472a5db8ecc16d
Do not access GroupingNamespace during effective build

There are two places which are accessing GroupingNamespace during
statement build:

AbstractGroupingStatementSupport.buildDeclared() performs a check
for namespace conflict. This is better done through an inference
action in FULL_DECLARATION of root model, when we can check whether
there is a conflict -- before we ever get to build statements.

UsesStatementSupport is searching namespaces to locate its source
to build its effective model -- to satisfy
UsesNode.getSourceGrouping(). This is better done by remembering
the source grouping's context in a statement-local namespace
and then pick it up when needed.

The two changes together allow us to sweep GroupingNamespace at
the end of RootStatementContext's build.

JIRA: YANGTOOLS-1197
Change-Id: I3a75ad92aeffeeed279466fffcf4402b17ee1d09
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
yang/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/RootStatementContext.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/reactor/RFC7950Reactors.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/grouping/AbstractGroupingStatementSupport.java
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/uses/SourceGroupingNamespace.java [new file with mode: 0644]
yang/yang-parser-rfc7950/src/main/java/org/opendaylight/yangtools/yang/parser/rfc7950/stmt/uses/UsesStatementSupport.java