yangtools.git
21 months agoResolve PrefixToModule cognitive dissonance 43/102143/6
Robert Varga [Wed, 17 Aug 2022 18:38:36 +0000 (20:38 +0200)]
Resolve PrefixToModule cognitive dissonance

This class serves two purposes: a namespace for reactor interactions
and XML source lookup. The second purpose is really a resolver
interface, split it out and clean up api/impl mess.

JIRA: YANGTOOLS-1452
Change-Id: I0fdfaee784a9c95bad0a64f746f0a1fe6412646e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove PrefixToModule.DEFAULT_PREFIX 42/102142/1
Robert Varga [Wed, 17 Aug 2022 18:35:32 +0000 (20:35 +0200)]
Remove PrefixToModule.DEFAULT_PREFIX

Remove this constant, as it's just getting in the way.

Change-Id: Ib19ededfbbcb9df310775a7d34d7090225cc86ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDeprecate PrefixToModule.DEFAULT_PREFIX 41/102141/1
Robert Varga [Wed, 17 Aug 2022 18:34:25 +0000 (20:34 +0200)]
Deprecate PrefixToModule.DEFAULT_PREFIX

There are no users, we are removing this constant. If it re-emerges, it
will be its proper semantic point with proper binding towards
XMLContants.

Change-Id: I9b36846dfbaa01084bb053f0f4f3625313671e8e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoCleanup MutableOffsetMap a bit 37/102137/1
Robert Varga [Wed, 17 Aug 2022 15:41:57 +0000 (17:41 +0200)]
Cleanup MutableOffsetMap a bit

Use instanceof patterns and guarantee @NonNull clone().

Change-Id: I40efddbf0d248427cd9d01cd13ef26db94b0377a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoAdd StmtContextUtils.getModuleQName() 32/102132/1
Robert Varga [Wed, 17 Aug 2022 13:39:36 +0000 (15:39 +0200)]
Add StmtContextUtils.getModuleQName()

We can make things safer by requiring a RootStmtContext, which in turn
allows us to take a slight shortcut.

Change-Id: I200ff520eeca5d3ff5a3653988257fe379e5763e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use substatements in StmtContextUtils.getRootModuleQName() 88/101488/7
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>
21 months agoRemove BelongsToModuleContext 31/102131/1
Robert Varga [Wed, 17 Aug 2022 11:32:50 +0000 (13:32 +0200)]
Remove BelongsToModuleContext

This namespace is not really useful, as it can contain really just a
single mapping (due to belongs-to cardinality). Also the key is never
used, which means BelongsToPrefixToModuleCtx can serve exactly the same
needs.

Change-Id: I08d92148f330fc0da8ff99443bdce270def3924c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse List for importedNamespace 30/102130/1
Robert Varga [Wed, 17 Aug 2022 11:15:21 +0000 (13:15 +0200)]
Use List for importedNamespace

Collection is too vague and we always implement it with a List, make
sure that is reflected in the declaration.

Change-Id: I1323e9649427ca31d9884f3a8d9c2fd221df933a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove old YangInstanceIdentifier serialization 23/102123/4
Robert Varga [Wed, 17 Aug 2022 08:13:23 +0000 (10:13 +0200)]
Remove old YangInstanceIdentifier serialization

YangInstanceIdentifier is written out through YIDv1 since version 3.0.0,
there is no point in supporting direct serialization methods anymore.
This has a nice effect of ditching reflection.

Change-Id: I50ad185df83b88495cb1fc1024170dcb4cd41ade
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove NIPv1 22/102122/3
Robert Varga [Wed, 17 Aug 2022 08:07:16 +0000 (10:07 +0200)]
Remove NIPv1

This serialization proxy has been deprecated since 4.0.0, remove it as
we should not be encountering it anymore.

Change-Id: I040e4c347662f7ca684ab910db3f6a800e996ccf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSprinkle @Serial annotations on yang-data-api 21/102121/3
Robert Varga [Wed, 17 Aug 2022 08:01:23 +0000 (10:01 +0200)]
Sprinkle @Serial annotations on yang-data-api

We are about to move forward on serialization, make sure the methods are
properly annotated.

Change-Id: I3613ab4436d4503a0117983d5e4cd3254e48b95d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoSeal SingletonSet 44/102044/19
Robert Varga [Wed, 10 Aug 2022 21:25:14 +0000 (23:25 +0200)]
Seal SingletonSet

We cannot have an anonymous subclass and also seal it. Since we have
solved the writeout path, we can just rely on SSv1 to do the most of the
lifting and break the format.

Change-Id: I34177672db7a2f1d91731978205d20e76353aaa7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse SSv1 during writeout 19/102119/2
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>
21 months agoAdd SSv1 18/102118/2
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>
21 months agoUse instanceof pattern in SingletonSet 03/102103/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>
21 months agoAssume serialization proxy 47/102047/13
Robert Varga [Wed, 10 Aug 2022 22:21:15 +0000 (00:21 +0200)]
Assume serialization proxy

Ditch reflexive access in favor of the (smaller) serialization proxy.
Since we have introduced writeReplace() before, we can now assume fields
are not touched. Ditches troublesome reflection.

Change-Id: I837fe0379c77542f2de2ea54d6e563d491f1a8db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse serialization proxy for ImmutableOffsetMap 46/102046/11
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>
21 months agoFixup IOMv1 01/102101/2
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>
21 months agoAdd IOMv1 proxy 45/102045/8
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>
21 months agoRemove unneeded @NonNull 00/102100/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

21 months agoUse instanceof patterns in MutableOffsetMap 48/102048/4
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>
21 months agoSeal util classes 43/102043/2
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>
21 months agoUse @Serial in util 42/102042/2
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>
21 months agoUse instanceof patterns 41/102041/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>
21 months agoRemove model.api.SchemaPath 51/97351/10
Robert Varga [Sat, 28 Aug 2021 01:41:27 +0000 (03:41 +0200)]
Remove model.api.SchemaPath

SchemaPath is of no further use to us. Purge it with fire.

JIRA: YANGTOOLS-1236
Change-Id: Ib66523e2393f526d64c111684f7bb308fdb6512c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use SchemaPath in SchemaInferenceStack 10/102010/4
Robert Varga [Mon, 8 Aug 2022 09:05:59 +0000 (11:05 +0200)]
Do not use SchemaPath in SchemaInferenceStack

We have alternative ways of instantiation, do not reference SchemaPath.

Change-Id: I1c36c8d167d1c374399cb0f1ee29d7778a852f3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use SchemaPath in LeafRefContext 36/102036/2
Robert Varga [Wed, 10 Aug 2022 14:24:58 +0000 (16:24 +0200)]
Do not use SchemaPath in LeafRefContext

Use a simple immutable list instead of SchemaPath.

JIRA: YANGTOOLS-1236
Change-Id: I430671a1ac078718e03af3417f01470567c5e744
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoUse instanceof pattern 35/102035/2
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>
21 months agoDo not iterate over SchemaPath 34/102034/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>
21 months agoUse instanceof patterns 33/102033/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>
21 months agoClean up RangeRestrictedTypeBuilder a bit 32/102032/1
Robert Varga [Wed, 10 Aug 2022 10:42:39 +0000 (12:42 +0200)]
Clean up RangeRestrictedTypeBuilder a bit

Use local variable type inference.

Change-Id: Ieac651d4ad84c9813f6cbf446e0f76eda783007c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoNormalize Decimal64 scale in range constraints 65/101765/27
OleksandrZharov [Thu, 7 Jul 2022 11:08:47 +0000 (13:08 +0200)]
Normalize Decimal64 scale in range constraints

Modified logic of DecimalTypeBuilder to ensure proper scale
of fraction-digits. Updated test in order to ensure that range
constraints are correct.

JIRA: YANGTOOLS-1441
Change-Id: I01ac7c7d940119f76867b15a3aaff50b3cd983e0
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove support for reading/writing SchemaPaths 11/102011/4
Robert Varga [Mon, 8 Aug 2022 09:18:27 +0000 (11:18 +0200)]
Remove support for reading/writing SchemaPaths

SchemaPaths are no longer used anywhere downstream, remove support for
their IO.

JIRA: YANGTOOLS-1244
Change-Id: I8992ff3e789b8e9a007678b7a72b793db638db6d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use SchemaPath in NormalizedNodeStreamWriterStack 09/102009/4
Robert Varga [Mon, 8 Aug 2022 08:58:39 +0000 (10:58 +0200)]
Do not use SchemaPath in NormalizedNodeStreamWriterStack

We have alternative ways of instantiation, do not reference SchemaPath.

JIRA: YANGTOOLS-1244
Change-Id: I9621d1f2a1f5fe2fc01035a9916a9f9ba394434d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not reference SchemaPath in yang-data-impl 08/102008/4
Robert Varga [Mon, 8 Aug 2022 09:08:47 +0000 (11:08 +0200)]
Do not reference SchemaPath in yang-data-impl

We have alternative instantiation methods fro
SchemaOrderedNormalizedNodeWriter. Do not reference SchemaPath.

JIRA: YANGTOOLS-1244
Change-Id: Ieab738b98f5ebea8e9c7388f35a4ff3a998b197d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use SchemaPath in yang-data-codec-xml 07/102007/4
Robert Varga [Mon, 8 Aug 2022 08:52:33 +0000 (10:52 +0200)]
Do not use SchemaPath in yang-data-codec-xml

The methods using SchemaPath have been deprecated for removal, now
remove them.

JIRA: YANGTOOLS-1244
Change-Id: Ibc54bbf4a90fe9e327d42ba261c5a67abbbb8f11
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoDo not use SchemaPath in yang-data-codec-gson 05/102005/5
Robert Varga [Mon, 8 Aug 2022 08:39:00 +0000 (10:39 +0200)]
Do not use SchemaPath in yang-data-codec-gson

SchemaPath is going away, do not reference in GSON-based codec.

JIRA: YANGTOOLS-1244
Change-Id: I1da70a13abda2196e2f453316efd2a9d181d73c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoRemove DeviateKind.getArgument() 27/102027/2
Robert Varga [Tue, 9 Aug 2022 19:52:00 +0000 (21:52 +0200)]
Remove DeviateKind.getArgument()

This method has been deprecated and there are no users: remove it.

Change-Id: I50e1152035aef7e2d8ad9f370480deb9a7aa5c56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoBump versions to 10.0.0-SNAPSHOT 26/102026/1
Robert Varga [Tue, 9 Aug 2022 19:49:28 +0000 (21:49 +0200)]
Bump versions to 10.0.0-SNAPSHOT

This starts the next major development iteration.

Change-Id: I7bd72f517b4f90205359c15a0334d9ee881873b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
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>
22 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>
22 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>
22 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years 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>
2 years agoUse a switch expression in DataTreeConfiguration 29/101329/5
Robert Varga [Sun, 29 May 2022 18:27:39 +0000 (20:27 +0200)]
Use a switch expression in DataTreeConfiguration

We have a switch on an enum, use an expression to cut an unneeded
branch.

Change-Id: I9eedf58dcca62e1005c07b0f53d398ceaa4481e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse switch expressions in yang-data-impl 28/101328/5
Robert Varga [Sun, 29 May 2022 18:25:13 +0000 (20:25 +0200)]
Use switch expressions in yang-data-impl

Switch expressions give us exhaustivity and more compact code, use them
where appropriate.

Change-Id: I13a9f146d92b17c1b87725926b4da6a0844cb97a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSeal BinaryStringCodec 27/101327/5
Robert Varga [Sun, 29 May 2022 18:23:52 +0000 (20:23 +0200)]
Seal BinaryStringCodec

We have only internal subclasses, seal the public class to prevent
misuse.

Change-Id: Id1b9a1cdac067d626af42c91e22b90fe40bf290e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse switch expression in NIPv2 26/101326/5
Robert Varga [Sun, 29 May 2022 18:23:09 +0000 (20:23 +0200)]
Use switch expression in NIPv2

Improve clarity a bit.

Change-Id: I390d419a9afefd4bf79ea519ef441270190c69e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize GSON codec a bit 25/101325/4
Robert Varga [Sun, 29 May 2022 18:02:42 +0000 (20:02 +0200)]
Modernize GSON codec a bit

Use instanceof pattern matching and switch expressions.

Change-Id: I48362f161187de4b76314b889e59994dfbf1d107
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix checkArgument() format string 24/101324/4
Robert Varga [Sun, 29 May 2022 18:09:11 +0000 (20:09 +0200)]
Fix checkArgument() format string

We should be using %s, not {} please holder.

Change-Id: I80e22247cef602f50856e792baa8be83b815ebf7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize SchemaInferenceStack 23/101323/4
Robert Varga [Sun, 29 May 2022 17:52:22 +0000 (19:52 +0200)]
Modernize SchemaInferenceStack

Use arrow cases and instanceof pattern matches to reduce verbosity.

Change-Id: I554937e564c76b978d0b53e89476a18628b15e79
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse switch expressions in EffectiveStatementMixins 22/101322/4
Robert Varga [Sun, 29 May 2022 17:37:24 +0000 (19:37 +0200)]
Use switch expressions in EffectiveStatementMixins

We can improve clarity with expressions, use them.

Change-Id: I9ec47d88baeb9df5d13b2d8285c6b4adc826162d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse switch expressions in yang-model-ri 21/101321/2
Robert Varga [Sun, 29 May 2022 17:36:01 +0000 (19:36 +0200)]
Use switch expressions in yang-model-ri

We are dealing with enumerations, hence we can take advantage of
exhaustiveness of switch expressions.

Change-Id: I370e3bf9004a540eaf1e55eb1d7f82862451a322
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse switch expressions in util 19/101319/1
Robert Varga [Sun, 29 May 2022 17:32:38 +0000 (19:32 +0200)]
Use switch expressions in util

We have three places where switch expressions are appropriate, use them
to improve clarity.

Change-Id: Ia46a06608202bcc460c4de57eb1d4afccb5a92a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize yang-data-codec-binfmt 12/101312/5
Robert Varga [Thu, 26 May 2022 21:06:16 +0000 (23:06 +0200)]
Modernize yang-data-codec-binfmt

Use JDK17 features to make the code a bit more less verbose and more
resilient.

Change-Id: I8219ca1a6507940b6d2e24800ff29c1d350469e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse on-demand component activation 94/101294/1
Robert Varga [Wed, 25 May 2022 14:53:23 +0000 (16:53 +0200)]
Use on-demand component activation

SCR provides for a way to activate components on-demand, so they end up
being dormant when not used. Take advantage of this and also lower the
amount of logging we perform during activation/deactivation.

Change-Id: I3bbdc6bf1d6e20b7e9440f3e3c62b075aa826bbc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoNormalize Decimal64 to fraction-digits 70/101270/11
Robert Varga [Mon, 23 May 2022 18:19:57 +0000 (20:19 +0200)]
Normalize Decimal64 to fraction-digits

When parsing a Decimal64, we need to scale it to fraction-digits
to ensure the input matches the expected range.

JIRA: YANGTOOLS-1437
Change-Id: I535eab4a20d30a742e94c3a6342e113cb569d0bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd Decimal64.scaleTo() 79/101279/6
Robert Varga [Wed, 25 May 2022 08:27:47 +0000 (10:27 +0200)]
Add Decimal64.scaleTo()

Decimal64.valueOf(String) results in variable-scale results, based on
the input string. This is sub-optimal when we want to compare values
of particular type -- those should be governed by fraction-digits and
hence, for example "2.00" and "2.0" should be normalized to the same
scale.

Introduce Decimal64.scaleTo(), which can be used to adjust the scale
of an existing Decimal64.

JIRA: YANGTOOLS-1440
Change-Id: Icbc215dff6d8146996c5be1040751fd1e14b6cfe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse imported checkState() 82/101282/1
Robert Varga [Wed, 25 May 2022 09:36:36 +0000 (11:36 +0200)]
Use imported checkState()

DecimalTypeBuilder already contains a static checkState() import, use
that instead of Preconditions.checkState() reference.

Change-Id: Id0d8cea3c398fc6cce6da58e9ee216360a5f0742
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd AbstractConstraint.toString() 81/101281/1
Robert Varga [Wed, 25 May 2022 09:18:08 +0000 (11:18 +0200)]
Add AbstractConstraint.toString()

Resolved constraints do not have a nice toString() method, making
debugging harder than it needs to be. Add a toString() method which
exposes allowed ranges, which is usually what we need to know.

Change-Id: Ib3a8caa67a765cb29db0b2b28509f07a4c1058ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse diamond notation for ClassValue subclass 80/101280/1
Robert Varga [Wed, 25 May 2022 08:39:29 +0000 (10:39 +0200)]
Use diamond notation for ClassValue subclass

Our Java version can now infer the type, remove redundant specifier.

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