yangtools.git
15 months agoOptimize ModifierImpl.AbstractPrerequisite 88/104388/1
Robert Varga [Tue, 14 Feb 2023 10:17:31 +0000 (11:17 +0100)]
Optimize ModifierImpl.AbstractPrerequisite

Object analysis shows we are recording outer class multiple times,
leading to suboptimimal object layout. Make the class hierarchy static,
with outer class recorded in explicit field, reducing
size of PhaseModificationInNamespacePath from 40-80 (48 typical) bytes
to 32-64 (40 typical) bytes. Other subclasses observe a similar
reduction.

JIRA: YANGTOOLS-1486
Change-Id: Ifc3da86a564bc54f4247996e622787a8528422b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 007dd4ccf28dd4288bafbce38a00c2b8d3ec2a68)

15 months agoUse a switch expression to get validator 87/104387/1
Robert Varga [Tue, 14 Feb 2023 09:45:28 +0000 (10:45 +0100)]
Use a switch expression to get validator

We are looking at an enumeration, hence we can use switch expression
exhaustiveness to eliminate an ISE.

Change-Id: Iebfd1b7f8d5ea19a5c7508c5f1a4f3d69074ab84
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 444398f5b137cb9f8f12cd451f7e3059260e8611)

15 months agoDo do not check unique in unsupported lists 82/104382/1
Sangwook Ha [Mon, 30 Jan 2023 21:50:33 +0000 (13:50 -0800)]
Do do not check unique in unsupported lists

Parsing of YANG models fails if a list conditional on a feature has a
unique statement and the feature is not supported.

Add test cases to reproduce the issue and fix
RequireEffectiveList.isApplicable() to also check for
isSupportedByFeatures().

JIRA: YANGTOOLS-1481
Change-Id: Id73f3f36fc5300e4c9fe97c32a25e58ab75078e4
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a94cb0f875a6b56360f64a6ba49d209a3dddd1ee)

15 months agoDo not access size indirect through body() 51/104151/1
Robert Varga [Tue, 24 Jan 2023 13:32:43 +0000 (14:32 +0100)]
Do not access size indirect through body()

This seems to be more efficient, but needs to be evaluated.

Change-Id: Ia8ddc618b7b98a82ad51d97c349d035793386562
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 63dd7f36f6f23ce6e35cd0027ea042147fec641c)

15 months agoFix ReactorStmtCtx.calculateParentRefcount() 89/104189/1
Sangwook Ha [Wed, 4 Jan 2023 04:12:51 +0000 (20:12 -0800)]
Fix ReactorStmtCtx.calculateParentRefcount()

If we have an empty grouping, which is referenced via augment-uses to a
different module, then if that module is buildEffective()'d first, we
end up with the grouping being swept.

This turns out to be a bug in parentRef determination -- in this
particular case we observe parent being REFCOUNT_NONE and invoke it
recursively -- and since the parent is a module, it itself does not have
a parentRef. This leads to us thinking the grouping does not have a
parentRef, whereas it does.

Update calculateParentRefcount() to recognize parent.refCount == 0 as
parent holding us down.

The problem manifests itself in the test when the models are processed
in order foo.yang, bar.yang -- but not when bar.yang is processed before
foo.yang.

Unfortunately the order of processing is not predictable in
BuildGlobalContext, hence we repeat the test 4 times.

JIRA: YANGTOOLS-1474
Change-Id: Ib3d55fb92d5a6d34230722ab1cd39e8f8831b6fe
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ad55ca2b2e72f15d7963cfcb011e4f7610889fce)

15 months agoSplit calculateParentRefcount() 88/104188/1
Robert Varga [Mon, 30 Jan 2023 10:01:54 +0000 (11:01 +0100)]
Split calculateParentRefcount()

The real meat of the method operates solely on parent, so split it off
into a dedicated method.

Change-Id: I9e3b8a19d4031372669c454bcbd3fbd5ceb29e07
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f1eab654288b106cf7ddb956aa37fb63d446b1b0)

16 months agoAllow unqualified node-identifiers in instance-identifier 53/103953/1
Ruslan Kashapov [Mon, 24 Oct 2022 13:04:41 +0000 (16:04 +0300)]
Allow unqualified node-identifiers in instance-identifier

node-identifier has an optional prefix, make sure we reflect this in our
class design.

JIRA: YANGTOOLS-1361
Change-Id: I928eabf5d2508d9be1390f7662998829cb06af81
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 173787948ff24c4098602e351fb097a55a4ffd85)

16 months agoCorrect instance-identifier escaping 52/103952/1
Robert Varga [Tue, 3 Jan 2023 15:39:04 +0000 (16:39 +0100)]
Correct instance-identifier escaping

Dealing with single-quoted and double-quoted strings in
instance-identifier differs quite a bit. In order to deal with these
strings, we need to differentiate them in lexer, for which we create
separate modes.

This forces us to explicitly define lexer lokens and only match raw
strings in their mode -- ensuring there are no surprises.

JIRA: YANGTOOLS-1458
Change-Id: I3f58c10f068da1128d8a7c1c5bed3917bfea0c78
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 45e8951a576c6bf2cb2bd0290167619b8be2fc5a)

16 months agoForce instanceIdentifier to consume all input 51/103951/1
Robert Varga [Tue, 3 Jan 2023 19:25:10 +0000 (20:25 +0100)]
Force instanceIdentifier to consume all input

We need ANTLR to completely process the input string, hence force an EOF
token in instanceIdentifier.

JIRA: YANGTOOLS-1361
Change-Id: I80f1b326a47857e4e8f36c568901d19f771cef96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 9eda34f44f1fc1027c357ad02923484e16b6ac0c)

16 months agoFix InstanceIdentifierParser's lexer 50/103950/1
Robert Varga [Tue, 3 Jan 2023 19:21:08 +0000 (20:21 +0100)]
Fix InstanceIdentifierParser's lexer

We have a day-0 bug here: we are using xpathLexer instead of
instanceIdentifierLexer.

JIRA: YANGTOOLS-1361
Change-Id: Ic4c074577c8a6fce9fbc22ef5da8e54b5df75faa
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8175666c67304af22cda102db8a183784b659799)

16 months agoGuarantee LocationPath.Absolute from implementation 49/103949/1
Robert Varga [Tue, 3 Jan 2023 18:14:52 +0000 (19:14 +0100)]
Guarantee LocationPath.Absolute from implementation

This makes it more type-safe to operate on tests etc.

Change-Id: Ib325c31092519e0644f02608cbca55e3dbca81b6
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 53407d16787eeef7e59dab3199cfa16447d653a0)

16 months agoModernize XPathParserTest 48/103948/1
Robert Varga [Tue, 3 Jan 2023 17:27:31 +0000 (18:27 +0100)]
Modernize XPathParserTest

Use variable type inference and simplify test w.r.t. use in JUnit 5.
Ditches use of Hamcrest as well.

Change-Id: I209480067e4c22ac903086ce05e50d72a7517c73
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 271b91470354f7decb14811cddd0491b9baa48a8)

16 months agoModernize ParseTreeUtils 47/103947/1
Robert Varga [Tue, 3 Jan 2023 15:53:48 +0000 (16:53 +0100)]
Modernize ParseTreeUtils

Use instanceof patterns, local variable type inference and
String.formatted().

Change-Id: I759bb20d8f73100d0b555cf50cdd8f8405334388
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f1f369cc314053498972f83aaee226f1fe88959a)

16 months agoModernize InstanceIdentifierParser 46/103946/1
Robert Varga [Tue, 3 Jan 2023 15:33:19 +0000 (16:33 +0100)]
Modernize InstanceIdentifierParser

Use switch expressions, instanceof pattern and local variable type
inference.

Change-Id: I609a17afc5915ae340b8ee0bc9fe7a2f74fa8ac1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a8b25dbe1b83518844ba8a1c3d5fe970400b7f16)

16 months agoBump versions to 9.0.7-SNAPSHOT 50/103850/1
Robert Varga [Sun, 1 Jan 2023 11:56:35 +0000 (12:56 +0100)]
Bump versions to 9.0.7-SNAPSHOT

This starts the next development iteration.

Change-Id: Ic5853e675a09792f1330b79f0a43e7d6ca720ba7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoBump odlparent to 11.0.4 45/103845/1
Robert Varga [Sat, 31 Dec 2022 18:02:57 +0000 (19:02 +0100)]
Bump odlparent to 11.0.4

Adopt updates from upstream.

Change-Id: Ieea5cf06caaec869a374e191f7de1c554510a636
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
16 months agoImprove Descendant check 38/103738/1
Robert Varga [Wed, 21 Dec 2022 23:00:56 +0000 (00:00 +0100)]
Improve Descendant check

Rather than asserting Absolute, use an explicit if with instanceof
expression to guard list additions. Also retain declaration order
by not going through an intermediate HashSet.

Change-Id: I0292aa8f927a101de83979da808cf84032bfb021
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e3d8fe2ba1ab33920596f1dd3140e7ac4bf6e75f)

16 months agoDo not suppress 'uses' node effects 34/103734/1
Sangwook Ha [Sun, 4 Dec 2022 06:00:47 +0000 (22:00 -0800)]
Do not suppress 'uses' node effects

Parser tries to process an 'augment' statement with 'if-feature' and
fails when the feature is not supported and the 'augment' statement
targets a node defined with a nested grouping and dependent on the
feature.

Add a test case (4th one) to reproduce the issue. The other test cases
show that there is no parsing issue if the augmentation target node is
defined with a single grouping or feature is supported.

The problem here is not AugmentStatementSupport, but rather
UsesStatementSupport, which fails to propagate children when if-feature
is in effect -- hence those children never make it to the schema tree,
and hence fail to be looked up.

Use 'uses' statement's if-feature to mark any children as unsupporte,
hence they are reflected in namespaces, but they will not be built.

JIRA: YANGTOOLS-1471
Change-Id: Ibd86530388a99ed3c8ade7bf9af109c6a0cfb80a
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4ad4e83aa9150c6c32af1e04fc879e844edae5cd)

16 months agoModernize UsesStatementSupport a bit 33/103733/1
Robert Varga [Wed, 21 Dec 2022 20:31:00 +0000 (21:31 +0100)]
Modernize UsesStatementSupport a bit

Use Java 11/Java 17 trivial features to clean up logic.

Change-Id: Id4f5d68726acafe7ecdf3e7739719d0619925fca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8ec4aaf5743b34a74e58907a18ebcebbfd585d60)

16 months agoFix unique statement argument propagation 32/103732/1
Sangwook Ha [Sat, 3 Dec 2022 23:19:45 +0000 (15:19 -0800)]
Fix unique statement argument propagation

Augmentation to the list with a unique statement from a module different
from the one where the list is defined causes SourceException which
complains that the argument node of the unique statement does not exist.

This turns out to have already been flagged with a FIXME -- this
behaviour has been there since forever.

The correct behaviour is to use a StatementPolicy.copyDeclared() and
adjust QNames in the argument's Descendants.

JIRA: YANGTOOLS-1470
Change-Id: Ib2cd23d50cd881d2ae94dbc0b271b5d481c9f55c
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
(cherry picked from commit 7e849648fed0d0a195f83d43d1a7d015478ad1eb)

17 months agoBump versions to 9.0.6-SNAPSHOT 46/103546/1
Robert Varga [Sat, 3 Dec 2022 14:00:07 +0000 (15:00 +0100)]
Bump versions to 9.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I7d26518cc017251f9b4b39f5cbd58d50c5ffe738
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoDo not ignore passed-in path 42/103542/1
Robert Varga [Sat, 3 Dec 2022 12:02:01 +0000 (13:02 +0100)]
Do not ignore passed-in path

The path needs to be forwarded, this was missed during review.

JIRA: YANGTOOLS-1469
Change-Id: I654c9812d2b5b580cf98e2644538d7871ccee782
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoBump versions to 9.0.5-SNAPSHOT 33/103433/1
Robert Varga [Sun, 27 Nov 2022 13:12:32 +0000 (14:12 +0100)]
Bump versions to 9.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: I6d4b8371878d04bd0a8212189d26a5f6c635d37e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoBump odlparent to 11.0.3 03/103403/1
Robert Varga [Fri, 25 Nov 2022 17:29:40 +0000 (18:29 +0100)]
Bump odlparent to 11.0.3

Adopt latest upstreams.

Change-Id: I0e9e9c1011aa8056341193c5d99712496ef5995b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoFix isSupportedToBuildEffective() propagation 53/103353/2
Robert Varga [Tue, 22 Nov 2022 17:47:49 +0000 (18:47 +0100)]
Fix isSupportedToBuildEffective() propagation

InferredStatementContext has bad interaction with ImplictStmtCtx -- the
latter fizzles when it is not supported by features. This leads to a
failure to build effective context, as the prototype cannot be built and
therefore an attempt to reuse it fails.

Adjust InferredStatementContext to check if its prototype can be built
and carry over that fact when it is not.

JIRA: YANGTOOLS-1465
Change-Id: Iad05b0c6a06b6d9f837b70ced0da8cdc8ed3ed97
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e31531765d8ae6e3bc36f3de4ae4e14e06568e83)

17 months agoBump versions to 9.0.4-SNAPSHOT 17/103317/1
Robert Varga [Tue, 22 Nov 2022 15:38:20 +0000 (16:38 +0100)]
Bump versions to 9.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: Id3853c4f424807e45bfba53b724e205a7e6c60a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
17 months agoFix yang-xpath-impl package import 55/103255/1
Robert Varga [Tue, 22 Nov 2022 12:06:18 +0000 (13:06 +0100)]
Fix yang-xpath-impl package import

The dependency on javax.inject should be optional, make sure that is the
case.

JIRA: YANGTOOLS-1467
Change-Id: Ic005d463e65bd8596fe586bb64272e966a6d1693
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 94f35afbda71f4a07a44ef0cee54923bd8f7e5ec)

18 months agoFix NPE when parsing deviation from submodule 83/103283/2
Ruslan Kashapov [Tue, 15 Nov 2022 15:41:31 +0000 (17:41 +0200)]
Fix NPE when parsing deviation from submodule

If the deviation statement is used in a submodule, we need to lookup up
the corresponding module, otherwise we will not find the correct
namespace.

JIRA: YANGTOOLS-1448
Change-Id: Iaf2e1d6526a9f268a6c0a3835e1bfdfafa05fffe
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 274de5b85ab4626c0ba6f79c38e8dd2e5b0eddcb)

18 months agoEnable deviation substatement validation 81/103281/1
Robert Varga [Wed, 16 Nov 2022 19:47:04 +0000 (20:47 +0100)]
Enable deviation substatement validation

Make sure we call super, as that circles back to our validator.

Change-Id: I41dcaa3a48b98cb09a348349a56263a4936ea5bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b6ebfe2a7cebefe8755e6c40c88267adf65fb2ee)

18 months agoAllow path to be null 77/103277/1
Robert Varga [Thu, 10 Nov 2022 16:27:52 +0000 (17:27 +0100)]
Allow path to be null

Downstreams need to perform dispatch to use either create() without
the path -- which is a bit hostile for utilities. Allow path to be
optional, improving usability a bit.

Change-Id: I46e4c4b5d2aa9218df6cb729f7a68cbd503cc4c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4ecf78a50f2e638ffd182aca0efb2dcfbf2140dd)

18 months agoReproduce YANGTOOLS-1445 76/103276/1
Sangwook Ha [Tue, 12 Jul 2022 22:26:01 +0000 (15:26 -0700)]
Reproduce YANGTOOLS-1445

Building effective model fails when unique statement is used in a
grouping used by another grouping.

Add a test case (the third one) to reproduce the issue. There is no
issue when the unique statement is used in a single grouping like the
first two test cases.

JIRA: YANGTOOLS-1445
Change-Id: Idadfb6e8fc0bf724f0ff770d9fe986692e4b30eb
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
(cherry picked from commit 4bfd28bd20bcdb401b8a612ffbd6eadf8ca4b904)

18 months agoCatch duplicate instantiation of statements 75/103275/1
Robert Varga [Tue, 15 Nov 2022 22:30:15 +0000 (23:30 +0100)]
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)

18 months agoAdd SourceIdentifier(String,Revision) 48/102648/1
Robert Varga [Tue, 8 Nov 2022 20:44:02 +0000 (21:44 +0100)]
Add SourceIdentifier(String,Revision)

This is a convenience constructor which is useful when mapping
raw literals to a concrete namespace revision. Also improve
documentation a bit.

Change-Id: I955c2bdbf4d573da4ef87aec8b0f9faaecc6cb5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d3c54ad273b98f4f1811d4492fa69ffb957c109b)

18 months agoBump versions to 9.0.3-SNAPSHOT 18/102918/1
Robert Varga [Fri, 28 Oct 2022 13:11:44 +0000 (15:11 +0200)]
Bump versions to 9.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: Id4fb3f8ad4b01f0b1d9dc913357e4b8169756945
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
18 months agoDeprecate Rfc6020AbnfRule 36/102636/1
Robert Varga [Wed, 26 Oct 2022 15:38:24 +0000 (17:38 +0200)]
Deprecate Rfc6020AbnfRule

This annotation is used for very light documentation purposes only.
It also does not have an RFC7950 counterpart nor can it express the
various definitions in YANG extensions. Deprecate it for removal.

Change-Id: I13eff70e8cf8dc20bfdaf42969ab92b608bc1dff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e3438419937ef1ba629eb032f1cf8ec39e9efbc0)

18 months agoBump odlparent to 11.0.2 61/102861/1
Robert Varga [Mon, 24 Oct 2022 18:44:09 +0000 (20:44 +0200)]
Bump odlparent to 11.0.2

Pick up latest updates.

Change-Id: I51776a2546fc949a29217f3419837a78c2a9a083
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
19 months agoReduce code duplication in InferredStatementContext 52/102652/1
Robert Varga [Tue, 4 Oct 2022 13:15:11 +0000 (15:15 +0200)]
Reduce code duplication in InferredStatementContext

We are treating declared/effective copies the same way -- isolate
duplicated code into utility methods.

Change-Id: I1faa7348fb7185a60abeec75c041aa0466998b00
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e0a8b628efee26ec871f3ba6df65049fd7bc7311)

19 months agoImprove StatementContextBase.stream{Declared,Effective} 51/102651/1
Robert Varga [Tue, 4 Oct 2022 13:08:07 +0000 (15:08 +0200)]
Improve StatementContextBase.stream{Declared,Effective}

We have an implementation invariant of returning ReactorStmtCtx,
make sure we expose it, removing the need for unchecked casts.

Change-Id: I7b4ab5c1032d719520bcdf046045bd6638aea13a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a964a780e67e0f094f275a35c20a9079cb902a47)

19 months agoFix yang-data extension definition 50/102650/1
Peter Suna [Thu, 26 May 2022 09:58:49 +0000 (11:58 +0200)]
Fix yang-data extension definition

The definition on ietf-restconf's yang-data is being rather exploited in
the wild, with a license to contain choices and anydata. These are
essentially allowed by other tooling, hence we need to also relax our
requirements.

This implies we cannot really expose the container directly, but rather
have to implement DataNodeContainer instead -- with the implied API
breakage. This is fine due to @Beta-level contract of all interfaces
involved.

Since we are breaking semantics here, also ditch the notion that the
yang-data argument can be parsed into a QName and instead reuse the
schema tree child's QName as the value required by SchemaNode contract.

JIRA: YANGTOOLS-1443
Change-Id: I3f78f71ea2980bf84f409d1ec89979e9e7b200ae
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 6dec3b24ef9055b777e7ea09b2006a1f867da827)

19 months agoFix DataTreeCandidateNodes handling of deleted nodes 40/102540/1
Robert Varga [Mon, 3 Oct 2022 08:42:11 +0000 (10:42 +0200)]
Fix DataTreeCandidateNodes handling of deleted nodes

Recursive candidate should be used only for DistinctNodeContainer,
not all NormalizedNodeContainers. Fix the check so that we do not hit a
ClassCastException.

JIRA: YANGTOOLS-1455
Change-Id: I6a89f8e59a7f8d8b36c5c5d2990290f66f79f529
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a3bdb0fbc05db361f7c105469ffd73b1e35390be)

21 months agoBump versions to 9.0.2-SNAPSHOT 35/102135/1
Robert Varga [Wed, 17 Aug 2022 14:21:06 +0000 (16:21 +0200)]
Bump versions to 9.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: If3a6260f46cfdc51b29035ea62d8a3780c05bf15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use substatements in StmtContextUtils.getRootModuleQName() 33/102133/1
Sangwook Ha [Tue, 7 Jun 2022 21:12:36 +0000 (14:12 -0700)]
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>
(cherry picked from commit 30f4e375338124bbb66d2bf1e1c65d0968fd1f0e)

21 months agoUse SSv1 during writeout 26/102126/1
Robert Varga [Wed, 17 Aug 2022 07:45:08 +0000 (09:45 +0200)]
Use SSv1 during writeout

Make sure we are not dependent on SingletonSet hierarchy in
serialization writeout path.

Change-Id: I7b602f166bccc418ea27af0b887f5868fadbf9e3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0fc692ac97b7a899750bc4eb6559dacdabdc0433)

21 months agoAdd SSv1 25/102125/1
Robert Varga [Wed, 17 Aug 2022 07:42:35 +0000 (09:42 +0200)]
Add SSv1

Add a serialization proxy for SingletonSet, so that we have explicit
control over the format.

Change-Id: Iedf53fe200215fbe1236464677e42b7d27d0caf5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 3e086972fad7b1d81b8a9d3e4ed0f84f2e8822fe)

21 months agoUse instanceof pattern in SingletonSet 15/102115/1
Robert Varga [Wed, 17 Aug 2022 06:45:54 +0000 (08:45 +0200)]
Use instanceof pattern in SingletonSet

We can simplify our equals() implementation a bit, let's do that.

Change-Id: I6b0d18ca1be2762cf5709857975a58a68ace6599
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit a9a4403e92ae551c01ed3acef6e161dafdc132da)

21 months agoUse serialization proxy for ImmutableOffsetMap 14/102114/1
Robert Varga [Wed, 10 Aug 2022 22:15:54 +0000 (00:15 +0200)]
Use serialization proxy for ImmutableOffsetMap

This patch switches to using an Externalizable proxy, allowing us to
properly inject fields.

Change-Id: I2a556713f2ab47a3ea1fabff7a5e45da02494c81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4481fd2b8436bd0d040b804750fab6692d3dd5b4)

21 months agoFixup IOMv1 13/102113/1
Robert Varga [Tue, 16 Aug 2022 21:50:36 +0000 (23:50 +0200)]
Fixup IOMv1

We are missing serialVersionUID, fix that up.

Change-Id: I21b8f7146a52f8c6c004df30acf386086a452d8d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8165d1ca88da1ba03aa13e25aa69326fad7cf1d8)

21 months agoAdd IOMv1 proxy 12/102112/1
Robert Varga [Wed, 10 Aug 2022 22:14:27 +0000 (00:14 +0200)]
Add IOMv1 proxy

ImmutableOffsetMap is using ugly reflection, which we are ditching. Add
the serialization proxy for compatibility.

Change-Id: I8687eee174462f62cdba927eb7c6d7386f7009ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1c1146b3a6a4dffa1d5b2e679ab82755456d123e)

21 months agoRemove unneeded @NonNull 11/102111/1
Robert Varga [Tue, 16 Aug 2022 19:53:05 +0000 (21:53 +0200)]
Remove unneeded @NonNull

The contract is specified by super, no need for these.

Change-Id: I93638a90eace123c1a4c7ea33d93a1f2d1de067a
(cherry picked from commit c2e69576827d6aaf4c9d0b599fa3a8efd35d0c45)

21 months agoUse instanceof patterns in MutableOffsetMap 10/102110/1
Robert Varga [Wed, 10 Aug 2022 22:42:19 +0000 (00:42 +0200)]
Use instanceof patterns in MutableOffsetMap

We can simplify the code a bit through patterns.

Change-Id: I9fecdeebfa308485bbb57081ced484d4426aa6ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 8bb4a3e29171d7cf5a94d41f0909e7a8d896be4a)

21 months agoSeal util classes 09/102109/1
Robert Varga [Wed, 10 Aug 2022 20:21:28 +0000 (22:21 +0200)]
Seal util classes

Most of our utility classes can be safely sealed, make sure we do that.

Change-Id: Iea937912d2a586f13963141727f29f97b004958c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit c656ab289d43b190293c4fd107407bcdc516da86)

21 months agoUse @Serial in util 08/102108/1
Robert Varga [Wed, 10 Aug 2022 19:59:37 +0000 (21:59 +0200)]
Use @Serial in util

This improves code safety quite a bit and allows us to perform a
long-needed audit.

Change-Id: I04161cfe8e6a367e1ae0d53a2628fbf72035ecde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 14fb0b4eba9e86b7a6358f9c29527c9b9d1ec5f1)

21 months agoUse instanceof patterns 07/102107/1
Robert Varga [Wed, 10 Aug 2022 20:04:26 +0000 (22:04 +0200)]
Use instanceof patterns

We can simplify the code a bit by using pattern matching.

Change-Id: I08d9239f056ec46d4fe796ea07cc889e0298f003
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit d7e96958ebebd89d17ed062b31455b2e0768c30b)

21 months agoUse instanceof pattern 06/102106/1
Robert Varga [Wed, 10 Aug 2022 13:20:23 +0000 (15:20 +0200)]
Use instanceof pattern

We can simplify things a bit by removing unneeded casts.

Change-Id: I553f14e70e5f1d6caa497b5fa4644367303fecf1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit b654670dedf0bd437d31b1d62f3caffdf4d6dfde)

21 months agoDo not iterate over SchemaPath 05/102105/1
Robert Varga [Wed, 10 Aug 2022 12:33:17 +0000 (14:33 +0200)]
Do not iterate over SchemaPath

We are exposing a List here, so we can things a tad more efficiently.

Change-Id: I310b626f5b8e7b94ca0cfade03833a0774931dab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0801c308b60fd9a86061da2fc43db21dfdb90768)

21 months agoUse instanceof patterns 04/102104/1
Robert Varga [Wed, 10 Aug 2022 11:10:28 +0000 (13:10 +0200)]
Use instanceof patterns

Modernize this a bit to remove unneeded casts.

Change-Id: I2ebe44acd6c056f089198ccab9109b1a5ac9447e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f64d0ed23d29d1bf4f87ea013cd367afc5544b2f)

21 months agoRemove use of DeviateKind.getKeyword() 25/102025/1
Robert Varga [Tue, 9 Aug 2022 19:46:30 +0000 (21:46 +0200)]
Remove use of DeviateKind.getKeyword()

Update javadoc and use argument() instead.

Change-Id: Id5af2a39bb253d610fc30ebe5264d3537e04886c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse concrete implementation for base decimal constraints 24/102024/1
Robert Varga [Tue, 9 Aug 2022 17:39:21 +0000 (19:39 +0200)]
Use concrete implementation for base decimal constraints

There are package-internal constants, make sure we advertize the fact
they are resolved.

Change-Id: Iaf5d8419385955531b8f627ec8a9f7d3432ab7ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSeal SchemaNodeIdentifier 20/102020/3
Robert Varga [Tue, 9 Aug 2022 16:49:39 +0000 (18:49 +0200)]
Seal SchemaNodeIdentifier

We do not allow SchemaNodeIdentifier to be subclassed outside of its
package, make sure the compiler understands that as well.

Change-Id: Ia61cebfa30bc77b8055d3b7c4e01fef73b7b067f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSeal ValueRange 19/102019/1
Robert Varga [Tue, 9 Aug 2022 16:30:38 +0000 (18:30 +0200)]
Seal ValueRange

We really want to make sure we only use the two provided instantiations,
make sure to seal the base class.

Change-Id: I8bd1530fbe5874f37e3998fd528ee0cd48d54373
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoGuarantee @NonNull return from ValueRange 18/102018/1
Robert Varga [Tue, 9 Aug 2022 16:30:04 +0000 (18:30 +0200)]
Guarantee @NonNull return from ValueRange

We always return a non-null, make sure we express that.

Change-Id: I737065b6f87e6891f4b43d500443a5bb12cffdfc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse instanceof pattern match in ValueRange 17/102017/1
Robert Varga [Tue, 9 Aug 2022 16:28:59 +0000 (18:28 +0200)]
Use instanceof pattern match in ValueRange

This simplifies the equality contract a bit.

Change-Id: Ie59c58e70e8c7de2b1898f58c99c84694073f86a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoAdd support for RFC8819 "module-tag" extension 42/100542/31
ivan.martiniak [Fri, 6 May 2022 10:30:39 +0000 (12:30 +0200)]
Add support for RFC8819 "module-tag" extension

Schema context successfully recognizes ModuleTagEffectiveStatementImpl
object, raw representation in the yang file: tags:module-tag "ietf:tag";
Module-tag extension is fully supported.

JIRA: YANGTOOLS-1315
Change-Id: I5ce2ce7ae57febf80c71de68bc37422e5a5431f7
Signed-off-by: Ivan Martiniak <ivan.martiniak@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDeprecate XMLStreamNormalizedNodeStreamWriter.create() 04/102004/3
Robert Varga [Mon, 8 Aug 2022 08:43:49 +0000 (10:43 +0200)]
Deprecate XMLStreamNormalizedNodeStreamWriter.create()

SchemaPath is going away, let's make sure users are guided towards
alternative methods.

JIRA: YANGTOOLS-1451
Change-Id: Id49381cfd0d0b46f623b223c4f23127c14d26134
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoMark deprecated methods for removal 03/102003/2
Robert Varga [Mon, 8 Aug 2022 08:38:13 +0000 (10:38 +0200)]
Mark deprecated methods for removal

We have a number of methods deprecated, but not marked for removal.
Update them along with the release where they were deprecated.

Change-Id: I20d56689d1c0349dc8f41b823d293576f40b5bb7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove a SchemaPath reference 06/102006/1
Robert Varga [Mon, 8 Aug 2022 08:54:29 +0000 (10:54 +0200)]
Remove a SchemaPath reference

We have a replacement construct, which accurately captures statement
hierarchy. Use that in javadocs instead of SchemaPath.

Change-Id: I1a5e02a5515a000826c458adee378a451c39f9c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoConvert yang-data-codec-gson to JPMS 00/102000/8
Robert Varga [Sun, 7 Aug 2022 19:33:14 +0000 (21:33 +0200)]
Convert yang-data-codec-gson to JPMS

This is an automatic module, jump the ship and become a full module.

JIRA: YANGTOOLS-1449
Change-Id: Ib1847be1e684e3a694f110d8a3d6b0166d52259c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoClean up JSONNormalizedNodeStreamWriter 02/102002/1
Robert Varga [Sun, 7 Aug 2022 19:31:05 +0000 (21:31 +0200)]
Clean up JSONNormalizedNodeStreamWriter

This was missed in review, fix it up.

Change-Id: Ibad2e8f1a9e156bacce83eba3cde7cfd690e65bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDeprecate JSONNormalizedNodeStreamWriter.create*Writer() 99/101999/7
Robert Varga [Sun, 7 Aug 2022 19:31:05 +0000 (21:31 +0200)]
Deprecate JSONNormalizedNodeStreamWriter.create*Writer()

Deprecate methods that use SchemaPath for identification. Introduce
replacatement methods where appropriate.

JIRA: YANGTOOLS-1450
Change-Id: I7418873de01094aed75670cbfea18d221224814d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoIntegrate JSONCodecFactory specializations 96/101996/7
Robert Varga [Sun, 7 Aug 2022 18:33:31 +0000 (20:33 +0200)]
Integrate JSONCodecFactory specializations

There is no point in keeping simple subclasses separate, move them
to be nest-mates and tighen them up. This also integrates
JSONInstanceIdentifierCodec, as it provides some brevity.

Change-Id: Iaea1cb529603976324516516a7f172b33f68e127
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSeal JSONCodecFactory 95/101995/6
Robert Varga [Sun, 7 Aug 2022 18:28:10 +0000 (20:28 +0200)]
Seal JSONCodecFactory

The factory can only be instantiated from within the package due to
package-private constructor. It is therefore safe to seal.

Change-Id: Ia03e553b6ee9a3080aad6112278cea45cab99da7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoCleanup Bug5446Test 98/101998/2
Robert Varga [Sun, 7 Aug 2022 19:18:33 +0000 (21:18 +0200)]
Cleanup Bug5446Test

Change-Id: I2ec91057ccdd9b84bf04c8abcf48ed30119719d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoFix a null warning 97/101997/2
Robert Varga [Sun, 7 Aug 2022 18:59:02 +0000 (20:59 +0200)]
Fix a null warning

Bug4501Test should require the node to be present before accessing
its body.

Change-Id: Iec99007f73aae3735a1baba94f1944abaed20c34
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoBump odlparent to 11.0.1 96/101796/3
Robert Varga [Mon, 11 Jul 2022 11:05:34 +0000 (13:05 +0200)]
Bump odlparent to 11.0.1

Pick up latest upgrades from upstream.

Change-Id: Ib23e45796564d846e7b72c9648f3fc9f185be0c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoAdd test for statement prerequisites and materialization 26/101926/2
Peter Suna [Fri, 29 Jul 2022 14:21:19 +0000 (16:21 +0200)]
Add test for statement prerequisites and materialization

Add test to Building SchemaContext when augmenting submodel container
with unique leafs inside list.

JIRA: YANGTOOLS-1434
Change-Id: I8e1984bc00ca94f72a264d20925ab55721cb0ccc
Signed-off-by: Peter Suna <peter.suna@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoImprove Decimal64.toString() implementation 35/101635/22
OleksandrZharov [Tue, 28 Jun 2022 14:56:08 +0000 (16:56 +0200)]
Improve Decimal64.toString() implementation

Change implementation of Decimal64.toString() method to:
pad unscaled value to scale + 1 size string, insert '.',
and remove trailing zeros.

JIRA: YANGTOOLS-1439
Change-Id: Ifb21ce4cdcf17d91da669c8f2c5e73de6a3edf22
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoBump versions to 9.0.1-SNAPSHOT 11/101611/1
Robert Varga [Mon, 20 Jun 2022 12:20:38 +0000 (14:20 +0200)]
Bump versions to 9.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: I293b34b52d8bf923dcb4af234b55207d0d8b4bf1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoCrossSourceStatementReactor.BuildAction should be final 10/101610/2
Robert Varga [Mon, 20 Jun 2022 12:11:59 +0000 (14:11 +0200)]
CrossSourceStatementReactor.BuildAction should be final

We do not want this class to be subclassed, make sure it is final.

Change-Id: I3f0e39b13a4f5b09fc454e27acd41a5229cf7a1d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoAdd YangLibModule et al. 99/100999/16
Robert Varga [Thu, 5 May 2022 00:21:56 +0000 (02:21 +0200)]
Add YangLibModule et al.

Introduce ietf-yang-library equivalents and a resolver that trusts
them by default. This routes the information we need to the reactor.

JIRA: YANGTOOLS-837
Change-Id: Iab12347ea065f7d6351b0943ff3416fdb23eb0e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse AssertionError 09/101609/1
Robert Varga [Mon, 20 Jun 2022 11:39:07 +0000 (13:39 +0200)]
Use AssertionError

We have an accidental use of opentest4j, make sure we use plain
AssertionError.

Change-Id: I06e0b184fdc9d129d70ba927e8f6d0d9f4001ceb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUpdate yang-maven-plugin requirements 73/101573/2
Robert Varga [Mon, 13 Jun 2022 10:56:31 +0000 (12:56 +0200)]
Update yang-maven-plugin requirements

We require maven-3.8, make sure we update our dependencies.

Change-Id: I0b20df4f138377b1ff2ef9382a0e366c8fbbfa79
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoMove (Abstract)IllegalArgumentCodec to yang.data.api.codec 61/100561/2
Robert Varga [Tue, 12 Apr 2022 11:18:46 +0000 (13:18 +0200)]
Move (Abstract)IllegalArgumentCodec to yang.data.api.codec

The only users of this construct live in yang-data-{api,util,impl}. Move
the contract there and un-deprecate it.

JIRA: YANGTOOLS-1332
Change-Id: Ie19b09e108a4bac8946c080da563fdb9ccdaae6a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse assertInstanceOf 42/101542/1
Robert Varga [Thu, 9 Jun 2022 10:04:13 +0000 (12:04 +0200)]
Use assertInstanceOf

No need to use Hamcrest, as we have a JUnit5 version of this assertion.

Change-Id: Ibe915ea3d74bff941237d33ad33d002180958590
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoMigrate yang-data-api to JUnit5 66/101466/1
Robert Varga [Mon, 6 Jun 2022 11:36:46 +0000 (13:36 +0200)]
Migrate yang-data-api to JUnit5

We have a few tests here, migrate them over.

Change-Id: I56dd6bbeda75a9225644aacb242ecc46a88878f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoFreeze odlparent at 11.0.0 65/101465/1
Robert Varga [Mon, 6 Jun 2022 11:07:46 +0000 (13:07 +0200)]
Freeze odlparent at 11.0.0

There is a release out there, use that instead of snapshots.

Change-Id: I411b2a7b0e850be56382be2f881211a5a74d18d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoMigrate yang-common-netty to JUnit5 70/101370/2
Robert Varga [Mon, 30 May 2022 16:57:56 +0000 (18:57 +0200)]
Migrate yang-common-netty to JUnit5

We have only two tests, migrate them over.

Change-Id: I3a4bd9153cdae01e685b6cea02340611d500cb7a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoMigrate yang-xpath-impl to JUnit5 69/101369/2
Robert Varga [Mon, 30 May 2022 16:52:49 +0000 (18:52 +0200)]
Migrate yang-xpath-impl to JUnit5

We have only a single test, migrate it.

Change-Id: I046473eb56ff3f6869c96d169aab74bd605bbe9b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoMigrate yang-repo-fs to JUnit5 66/101366/1
Robert Varga [Mon, 30 May 2022 16:38:09 +0000 (18:38 +0200)]
Migrate yang-repo-fs to JUnit5

These are simple tests, migrate them.

Change-Id: Ied27283b229ae27f8d5bef6b8af0554b5ade1bc9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoRemove YangTextSnippetIterator.Quoting 31/101331/10
Robert Varga [Sun, 29 May 2022 18:52:07 +0000 (20:52 +0200)]
Remove YangTextSnippetIterator.Quoting

Eliminate internal enum and inline the dispatch, eliminating the need
for a default case.

Change-Id: I1b728b5b1652bde5f044a9a4e57b30d53f27bfc2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoModernize yang-parser-reactor 41/101341/4
Robert Varga [Sun, 29 May 2022 20:41:52 +0000 (22:41 +0200)]
Modernize yang-parser-reactor

Use switch expressions and pattern match on instanceof to improve code
density.

Change-Id: Ia49f28782258986393e8932403a8468210b84856
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse arrow cases in YT1193Test 40/101340/4
Robert Varga [Sun, 29 May 2022 20:40:33 +0000 (22:40 +0200)]
Use arrow cases in YT1193Test

Drop a few lines with a more expressive construct.

Change-Id: I3c68804d0ac8655c195c1c6b2fe95e057593b744
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse switch expression in yang-parser-impl 39/101339/4
Robert Varga [Sun, 29 May 2022 20:39:38 +0000 (22:39 +0200)]
Use switch expression in yang-parser-impl

A switch is more expressive, use it for initialization of reference
factory.

Change-Id: Ic2b9d2dd890c02f2189c632c8e1909cf62326c0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse switch expression in rfc6241 support 38/101338/4
Robert Varga [Sun, 29 May 2022 20:38:18 +0000 (22:38 +0200)]
Use switch expression in rfc6241 support

An expression is more dense.

Change-Id: I44f814369d9d0ce50de65117c109cfbbc65acda9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse switch expressions 37/101337/4
Robert Varga [Sun, 29 May 2022 20:00:45 +0000 (22:00 +0200)]
Use switch expressions

AbstractModifiedNodeBasedCandidateNode can prune default cases if we use
switch expressions.

Change-Id: I2a8dc3ce0b5cf875a5f09e3f0b242b712d806b7f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse arrow case in ValueNodeModificationStrategy 36/101336/3
Robert Varga [Sun, 29 May 2022 19:54:06 +0000 (21:54 +0200)]
Use arrow case in ValueNodeModificationStrategy

Reduce verbosity by using non-fall-through arrow cases, improving
code density.

Change-Id: I0d5674a27f8c449b814ea37c0a5d94cae23336f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoModernize SchemaAwareApplyOperation 35/101335/3
Robert Varga [Sun, 29 May 2022 19:51:06 +0000 (21:51 +0200)]
Modernize SchemaAwareApplyOperation

Use instanceof pattern matching and modernize switch statement use,
by use of arrow cases and switch expressions.

Change-Id: Ieed9342918a627bb80968d4fd3ecab27203f6a1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoModernize switch use in ModifiedNode 34/101334/3
Robert Varga [Sun, 29 May 2022 19:45:34 +0000 (21:45 +0200)]
Modernize switch use in ModifiedNode

Use arrow cases and switch expressions to improve clarity.

Change-Id: Id34be473139ee20b2dd30da23063ac20d2a29787
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoModernize yang-repo-{api,spi} 33/101333/2
Robert Varga [Sun, 29 May 2022 19:37:25 +0000 (21:37 +0200)]
Modernize yang-repo-{api,spi}

Use pattern matching on instanceof to simplify our code.

Change-Id: I1399f78a5b25558b6437434e1c316790cfc50e23
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse modern switch in yang-model-export 20/101320/5
Robert Varga [Sun, 29 May 2022 17:34:10 +0000 (19:34 +0200)]
Use modern switch in yang-model-export

We can use arrow cases and switch expressions to improve clarity.

Change-Id: Id8897dfa09bf2608b90c730cfdf260d84f34c5c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoUse switch expressions in yang-data-util 30/101330/5
Robert Varga [Sun, 29 May 2022 18:32:09 +0000 (20:32 +0200)]
Use switch expressions in yang-data-util

We have two dispatches, update them to switch expressions.

Change-Id: Iebeaf863e47ffd2a8fad260ca429187a42bd4138
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>