Catch duplicate instantiation of statements 75/103275/1
authorRobert Varga <robert.varga@pantheon.tech>
Tue, 15 Nov 2022 22:30:15 +0000 (23:30 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Wed, 16 Nov 2022 18:59:24 +0000 (19:59 +0100)
commit73d204cbb6811f6c9e531c0590b4d3d9d4532db1
tree67193f0cbbed71cdf1a735cea1102481d0366c6f
parentca91675fae151ef044ae03c8ea1393c4d2812451
Catch duplicate instantiation of statements

The problem here is that during tryToReusePrototype() we are copying
child statements, which in turn are triggering onStatementAdded(). For
unique statements this incurs a SchemaTreeNamespace requirement on the
target leaf -- which is satisified via requestSchemaTreeChild() and
recorded in substatements (as partial materialization) and it is also
recorded in the schema tree namespace. When this happens, though,
effectiveCopy() does not notice the statement has already been copied
and copies it again, and thus ends up colliding in the schema tree
namespace -- pointing to the same statement as the source of the
problem.

Update effectiveCopy() to re-examing substatements to see if they
reflect partial materialization and pick copied statement from there.

JIRA: YANGTOOLS-1445
Change-Id: Ic184f872bf21e3e3c112b4fb5960fbe44262c77e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a14125cf6968d126396fc19849b63c29e4f865f6)
parser/yang-parser-reactor/src/main/java/org/opendaylight/yangtools/yang/parser/stmt/reactor/InferredStatementContext.java