Refactor globalOrStatementSpecific() 83/105283/1
authorRobert Varga <robert.varga@pantheon.tech>
Thu, 6 Apr 2023 21:42:52 +0000 (23:42 +0200)
committerRobert Varga <robert.varga@pantheon.tech>
Thu, 6 Apr 2023 21:42:52 +0000 (23:42 +0200)
commit6f866bb7c52a0ed2d4fb9bd4f590fd1a325fc50a
treef2d218a7ead2f567bb09b606df896b8367e8b35a
parent729866e423da12c2adbe9f556c1b2ac642f0f18a
Refactor globalOrStatementSpecific()

Current implementation elicits a nullness warning, which is not quite
there -- at the cost of verifyNotNull().

If we refactor checks we can actually make it more performant and
transparent. This is advanteous bacause a null parent implies current is
a GLOBAL storage -- and we therefore can just check the storage type for
STATEMENT_LOCAL.

As it turns out we can refactor the loop to make it obvious, in that we
manually check parent storage. This makes the code flow nicer and more
transparent -- there are no IDE-invisible non-null guarantees. A null
parent storage indicates GLOBAL storage, hence we can bail.

A further boon is that we can simplify the StorageType check to only
compare to STATEMENT_LOCAL and

Change-Id: I5a5b7faf312db6de7f1cebe654f18e9785f58bac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
parser/yang-parser-spi/src/main/java/org/opendaylight/yangtools/yang/parser/spi/SchemaTreeNamespaceBehaviour.java