Fix statement prerequisites and materialization 57/101157/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 17 May 2022 10:57:32 +0000 (12:57 +0200)
committerRobert Varga <nite@hq.sk>
Wed, 18 May 2022 14:36:04 +0000 (14:36 +0000)
commitd7ad636cbbe77726e6d0d236229b0cb5baec01e1
tree6cf3770bfab8aa52e5acb295628e5e5233422fe1
parent157a6df3f39ea0418076426114f1c23a0415dd80
Fix statement prerequisites and materialization

We are firing onStatementAdded() when copying statements, which means
that:
a) a new inference requirement may be created during inferred
   statemenent materialization
b) the inference requirement may be immediately available in effective
   model

In order to deal with this, ModifierImpl has to always go through a
bootstrap, so that it prerequisites only trigger once an action is
registered.

Furthermore InferredStatementContext needs always instantiate the map
for partial instantiations so as to deal with namespace-driven
instantiations happening while full instantiation is going on.

JIRA: YANGTOOLS-1434
Change-Id: I86dae587c1fe5804cd983c194903e1975f257408
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a257eeb5333f6719db8afed7258fa0ce3dbdc0ae)
parser/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/InferredStatementContext.java
parser/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/ModifierImpl.java
parser/yang-parser-rfc7950/src/test/java/org/opendaylight/yangtools/yang/stmt/YT1434Test.java [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1434/bar.yang [new file with mode: 0644]
parser/yang-parser-rfc7950/src/test/resources/bugs/YT1434/foo.yang [new file with mode: 0644]