yangtools.git
2 weeks agoUse a switch expressions in StatementContextBase 32/112132/1
Robert Varga [Thu, 13 Jun 2024 15:14:53 +0000 (17:14 +0200)]
Use a switch expressions in StatementContextBase

We have a few opportunities to use switch expression, make sure we take
advantage of them.

Change-Id: Ic8395bba4ffde357edc9eb97780544bc30f9c9be
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse switch expressions in StatementOutputV1 31/112131/1
Robert Varga [Thu, 13 Jun 2024 15:05:23 +0000 (17:05 +0200)]
Use switch expressions in StatementOutputV1

We are dispatching over a sealed hierarchy. Use switches with patterns
to eliminate error paths.

Change-Id: I991987ecfce5efb6e5507714e69f85f945759fe6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse a switch expression in DerivedTypes 30/112130/1
Robert Varga [Thu, 13 Jun 2024 14:56:54 +0000 (16:56 +0200)]
Use a switch expression in DerivedTypes

Turn the if/else/instanceof cascade into a switch expression with
pattern matching.

Change-Id: Idc1fef755ad5fe2b5af2b71225a026c157970e94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse a switch pattern in TypedefEffectiveStatementImpl 29/112129/1
Robert Varga [Thu, 13 Jun 2024 14:46:59 +0000 (16:46 +0200)]
Use a switch pattern in TypedefEffectiveStatementImpl

We have a type-based dispatch cascade, migrate to using a simple switch
with patterns.

Change-Id: Ifbf42898bb1efdb46f8f217bda342b1a3fc36fc9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse switch expressions in EffectiveStatements 27/112127/1
Robert Varga [Thu, 13 Jun 2024 14:40:45 +0000 (16:40 +0200)]
Use switch expressions in EffectiveStatements

Rather than doing if/else/instanceof, use switch expressions to match
arguments.

Change-Id: I2e6386ed77a4975051614d5fef0c558c264949dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse switch expressions in ConcreteTypes 25/112125/5
Robert Varga [Thu, 13 Jun 2024 11:43:25 +0000 (13:43 +0200)]
Use switch expressions in ConcreteTypes

We have a few type-based dispatches, use pattern switches for the same
task.

Change-Id: I4d0394226cd3add43707b95e27ad64dde14bbcc4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize MutableOffsetMap 17/112117/9
Robert Varga [Wed, 12 Jun 2024 19:53:02 +0000 (21:53 +0200)]
Modernize MutableOffsetMap

Use switch expressions with patterns and local variable type inference
to make things a tad more compact.

Change-Id: I9f03a9dfe450877d3878a49406ef61481b4646b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize ImmutableOffsetMap 15/112115/9
Robert Varga [Wed, 12 Jun 2024 19:28:13 +0000 (21:28 +0200)]
Modernize ImmutableOffsetMap

Use local variable type inference and patterns to make the code a tad
more compact.

Change-Id: Ia019da40c3c79349ba6daa592e3e3e75cbfea7ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize MapAdaptor 16/112116/8
Robert Varga [Wed, 12 Jun 2024 19:42:35 +0000 (21:42 +0200)]
Modernize MapAdaptor

Use local variable type inference and switch with patterns.

Change-Id: Id93504a60dfda64e2683a6bdda4c5e9c74ce68b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse switch expressions in yang-data-util 26/112126/2
Robert Varga [Thu, 13 Jun 2024 11:45:31 +0000 (13:45 +0200)]
Use switch expressions in yang-data-util

We have a number of type-based dispatches using if/else/instanceof.
Convert these to switch statements/expressions with patterns for better
expressiveness.

Change-Id: I81c1c080483d693a6c3be37490a23c9d858c0d5f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize NumberUtil a bit 24/112124/2
Robert Varga [Thu, 13 Jun 2024 11:42:24 +0000 (13:42 +0200)]
Modernize NumberUtil a bit

Use switch expressions to make our intent more explicit and compact.

Change-Id: I62c12ce4435d50b7ed92ef3ee12b39db36d2fa72
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse a switch expression in StatementPrefixResolver 23/112123/2
Robert Varga [Thu, 13 Jun 2024 11:40:21 +0000 (13:40 +0200)]
Use a switch expression in StatementPrefixResolver

We handle only two cases, make sure we express that in an exhaustive
switch.

Change-Id: Ib62d970ad785f166ca57f1c76ce0b35a8f53412f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse switch expressions in IfFeatureExpr 22/112122/2
Robert Varga [Thu, 13 Jun 2024 11:38:59 +0000 (13:38 +0200)]
Use switch expressions in IfFeatureExpr

We are dealing with a sealed class hierarchy, use switch with pattern
to ensure they are exhaustive.

Change-Id: Ide8de6358247f4e72f466061bd7878ab263a66b6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSharedSingletonMap is a SequencedMap 21/112121/2
Robert Varga [Thu, 13 Jun 2024 11:31:54 +0000 (13:31 +0200)]
SharedSingletonMap is a SequencedMap

We do not need a custom method to access the single element, as we can
expose it via SequencedMap.firstEntry().

Change-Id: I35d338d3755c883097a9a5cb0bde04ebb0fa2ccf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoPromote SingletonSet to a SequencedSet 00/112100/5
Robert Varga [Wed, 12 Jun 2024 11:21:20 +0000 (13:21 +0200)]
Promote SingletonSet to a SequencedSet

Java 21 allows us to neatly access the singleton value via
getFirst()/getLast() -- providing a well-known interface.

Change-Id: I479e0ec8b653d6ab09c1e3e37356019962cb022b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize SchemaInferenceStack 20/112120/3
Robert Varga [Wed, 12 Jun 2024 21:40:10 +0000 (23:40 +0200)]
Modernize SchemaInferenceStack

Use switch expressions with patterns where convenient, making things a
tad more compact.

Change-Id: I34ad527c09e43d1b1b3f084b5eb09bc1ff8d521e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize yang-data-spi a bit 19/112119/3
Robert Varga [Wed, 12 Jun 2024 21:26:52 +0000 (23:26 +0200)]
Modernize yang-data-spi a bit

Use switch expressions with patterns to make things a tad more compact
and expressive.

Change-Id: If0303adb759f3cbf4d12fdcd456db7d986fb865c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize yang-data-tree-ri 18/112118/2
Robert Varga [Wed, 12 Jun 2024 21:15:44 +0000 (23:15 +0200)]
Modernize yang-data-tree-ri

Use local variable type inference in more places.
Use patterns and switch expressions where convenient.

Change-Id: Iafe3ac1842adff3e6f8db3825a7e8a4397321585
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse switch with patterns in yang-data-codec-xml 14/112114/2
Robert Varga [Wed, 12 Jun 2024 18:41:27 +0000 (20:41 +0200)]
Use switch with patterns in yang-data-codec-xml

We have a number of places where we dispatch based on type. Use switch
statements/expressions with pattern match instead of if/else cascades.

Change-Id: Ibf3511f75f14e21c3b83d998701bbeb33d07c560
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse a switch expression in TypeDefinitionAwareCodec 13/112113/1
Robert Varga [Wed, 12 Jun 2024 17:45:06 +0000 (19:45 +0200)]
Use a switch expression in TypeDefinitionAwareCodec

Rather than going through an instanceof if/else cascade, use a simple
switch expression with instanceof patterns.

Change-Id: I2451b7d9ea7e0850948bbe21fef2033953113015
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoModernize AntlrXPathParser 12/112112/1
Robert Varga [Wed, 12 Jun 2024 17:31:33 +0000 (19:31 +0200)]
Modernize AntlrXPathParser

Use local variable type inference and switch with patterns to make the
logic more concise.

Change-Id: I069abdd24b8ed764a08c8aed03109139b3658b45
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse switch with patterns in YangInstanceIdentifierWriter 11/112111/1
Robert Varga [Wed, 12 Jun 2024 17:18:57 +0000 (19:18 +0200)]
Use switch with patterns in YangInstanceIdentifierWriter

Do not use and if/else instanceof cascade, just switch with patterns.

Change-Id: Ic763d0a29ccbc8f1f877ff0958ec19c9760bacb4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse switch pattern in NormalizedNodePrettyTree 10/112110/1
Robert Varga [Wed, 12 Jun 2024 16:59:59 +0000 (18:59 +0200)]
Use switch pattern in NormalizedNodePrettyTree

Use a type dispatch on the node instead of the usual if/else cascade.

Change-Id: Id23d55cf9a8b99db683f737cb5b37054957fb119
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse switch with patterns in NormalizedNodeWriter 09/112109/2
Robert Varga [Wed, 12 Jun 2024 16:51:05 +0000 (18:51 +0200)]
Use switch with patterns in NormalizedNodeWriter

Instead if/else cascade of instanceof checks, use a switch with pattern
matching to dispatch.

Change-Id: Ide0cee6168ea419f4584e4dc0074a27acf3fe44f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse pattern match in PotassiumDataOutput.writePathArgumentInternal() 08/112108/2
Robert Varga [Wed, 12 Jun 2024 16:29:04 +0000 (18:29 +0200)]
Use pattern match in PotassiumDataOutput.writePathArgumentInternal()

Using a switch with patterns guarantees exhaustiveness and is more
readable.

Change-Id: I2afeff389d6b9a68ba6f3bc903a6ebbbe4ca493b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse pattern matching in PotassiumDataOutput.writeObject() 07/112107/2
Robert Varga [Wed, 12 Jun 2024 16:19:35 +0000 (18:19 +0200)]
Use pattern matching in PotassiumDataOutput.writeObject()

Rather than having an if/else cascade, use a switch with pattern
matching to dispatch on value type.

Change-Id: I801739b9f138cefe8272d6634532d9854c78469c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse patterns in InstanceIdentifierJSONCodec 03/112103/2
Robert Varga [Wed, 12 Jun 2024 12:01:57 +0000 (14:01 +0200)]
Use patterns in InstanceIdentifierJSONCodec

Rather that doing an if/else cascade, use a switch with instanceof
patterns to dispatch.

Change-Id: I361dba4acfc18265bef9463121ad46cdb4ad4aa9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse pattern match in JsonParserStream 02/112102/2
Robert Varga [Wed, 12 Jun 2024 12:00:58 +0000 (14:00 +0200)]
Use pattern match in JsonParserStream

Rather than doing an if/else, use a switch with patterns to adapt the
parent node.

Change-Id: I69791ccb2441a1a3d3ff6f50e086dd4955734d3e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdopt odlparent-14.0.0-SNAPSHOT 90/111890/5
Robert Varga [Tue, 28 May 2024 17:08:11 +0000 (19:08 +0200)]
Adopt odlparent-14.0.0-SNAPSHOT

odlparent-14 allows us to target Java 21. This patch adopts a snapshot
version to allow us to deliver subsequent changes.

Change-Id: Ida26a3e50b3d27bd9c10fed06f9d610ad85f8b36
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove SourceIdentifier.LOG 96/112096/1
Robert Varga [Wed, 12 Jun 2024 09:44:19 +0000 (11:44 +0200)]
Remove SourceIdentifier.LOG

This field is not used anywhere, remove it.

Change-Id: I913c1ad5e1e1d93312d6566694fca8c7ccd287b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoCentralize 'cannot interpret' 64/112064/1
Robert Varga [Mon, 10 Jun 2024 10:54:09 +0000 (12:54 +0200)]
Centralize 'cannot interpret'

Sonar is complaining about duplicates, centralize exception allocation
to keep it happy.

Change-Id: If383e924561a9b9c41d9f90593369008d4495758
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoCentralize unexpect token literal 63/112063/1
Robert Varga [Mon, 10 Jun 2024 10:53:28 +0000 (12:53 +0200)]
Centralize unexpect token literal

Sonar complains about duplication, centralize allocation.

Change-Id: Ia1fc1b5cc8dd71c3fd5358b1dde7d31993c2037f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoCentralize 'unsupported original' IAE 62/112062/1
Robert Varga [Mon, 10 Jun 2024 10:43:10 +0000 (12:43 +0200)]
Centralize 'unsupported original' IAE

Sonar complains about literal duplication, let's fix that by using a
dedicated method for IAE allocation.

Change-Id: I2ceac05839c0e43c25c898d2643a0244c65174d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoCentralize IAE message 61/112061/1
Robert Varga [Mon, 10 Jun 2024 10:38:33 +0000 (12:38 +0200)]
Centralize IAE message

Sonar is complaining about us using the same literal three times. Fix
that by allocating the exception in a dedicated method.

Change-Id: I5636943c75fbc0b8e6bea7b069485c724e150973
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoYet another round of Sonar issue fixes 59/112059/1
Robert Varga [Mon, 10 Jun 2024 10:33:41 +0000 (12:33 +0200)]
Yet another round of Sonar issue fixes

Fix more unused throws declarations and unused variables.

Change-Id: I17d6c584e761347bb2098c2bd2ddbbe9fd1c337d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoAnother round of Sonar warnings fixes 56/112056/2
Robert Varga [Mon, 10 Jun 2024 09:07:06 +0000 (11:07 +0200)]
Another round of Sonar warnings fixes

Eliminate unused exception declarations.

Change-Id: I951e0911e754d3e7e455938b276c473a598cbc62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoClean up more Sonar warnings 83/111983/2
Robert Varga [Tue, 4 Jun 2024 14:21:11 +0000 (16:21 +0200)]
Clean up more Sonar warnings

This removes unused exception throws and similar minor complaints.

Change-Id: Idf43b899700e875f164c3a8e763b0c82c47664de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove unused throws declarations 80/111980/2
Robert Varga [Tue, 4 Jun 2024 13:09:31 +0000 (15:09 +0200)]
Remove unused throws declarations

SonarCloud is reporting a ton of unused throws declarations. This patch
makes a dent in them.

Change-Id: Iff2e75a2126dfb3b63a72401688c9ed50631f197
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove ContainerSchemaNodes 79/111979/2
Robert Varga [Tue, 4 Jun 2024 12:46:04 +0000 (14:46 +0200)]
Remove ContainerSchemaNodes

This class has been deprecated for quite some time, with replacements
directly integrated into {Notification,Operation}Definition. Remove it
now.

Change-Id: I576e5c8f129038219b091f98415d08a7d694fe6c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove deprecated YangVersion methods 78/111978/2
Robert Varga [Tue, 4 Jun 2024 12:36:10 +0000 (14:36 +0200)]
Remove deprecated YangVersion methods

Both parse() and getReference() have been deprecated since
yangtools-11.0.0. Remove them now.

Change-Id: Ifd2ddf31f529026cae571ad73c51403fe313aa23
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove Revision.Proxy 77/111977/1
Robert Varga [Tue, 4 Jun 2024 12:34:10 +0000 (14:34 +0200)]
Remove Revision.Proxy

This is the legacy serialization proxy, which has been superseded in
last major release. This patch removes it.

Change-Id: I880ea5cdac71668fac82c53742c38463ad0ae331
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove deprecated QNameModule methods 87/103387/3
Robert Varga [Tue, 4 Jun 2024 12:32:55 +0000 (14:32 +0200)]
Remove deprecated QNameModule methods

We have a number for deprecated .create() methods, remove them.

Change-Id: I61c5c8b38037abb3b80e922498c3329d97c951e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove ListenerRegistration and ListenerRegistry 28/109228/2
Robert Varga [Fri, 8 Dec 2023 16:39:50 +0000 (17:39 +0100)]
Remove ListenerRegistration and ListenerRegistry

This interface has been deprecated. ListenerRegistry has been replaced
with ObjectRegistry.

Remove both these classes and all of the supporting scenery.

JIRA: YANGTOOLS-1552
Change-Id: Ie583ce23c5bd645845ea979b047731ad82ab43f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove Listener{Registration,Registry} and related classes 41/111941/2
Robert Varga [Mon, 3 Jun 2024 16:45:32 +0000 (18:45 +0200)]
Remove Listener{Registration,Registry} and related classes

ListenerRegistration has tight coupling to EventListener, which we are
not using anywhere. Remove this interface along with its
implementations.

ListenerRegistry relies on it, but has a more powerful replacement in
ObjectRegistry, so we remove that as well.

JIRA: YANGTOOLS-1552
Change-Id: Iba4da09f4a76615c643b266fc293e5f99afb4204
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSpecialize JSONCodec to JSONValueWriter 75/111175/6
Robert Varga [Tue, 2 Apr 2024 08:56:42 +0000 (10:56 +0200)]
Specialize JSONCodec to JSONValueWriter

Completely disconnect JSONCodec from JsonWriter, eliminating the
deprecated method.

JIRA: YANGTOOLS-1568
Change-Id: I41f7426a11e76e90d717a898dfc916141e05ebf4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoSpecialize JSONCodec to Void input 60/111160/4
Robert Varga [Mon, 1 Apr 2024 18:36:39 +0000 (20:36 +0200)]
Specialize JSONCodec to Void input

We do not take any input, not some vague Object. Specialize to
java.lang.Void, of which there is only the null instance.

JIRA: YANGTOOLS-1568
Change-Id: Ia7cda3f485b07d56b9986f689635fbcca1025a65
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoRemove UnknownTypeDefinition 50/111250/2
Robert Varga [Thu, 4 Apr 2024 00:47:24 +0000 (02:47 +0200)]
Remove UnknownTypeDefinition

This type is not really used anywhere, remove all references to it.

Change-Id: If2ae1b89144419adf1115235e840145169f40392
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoBump versions to 14.0.0-SNAPSHOT 33/111933/1
Robert Varga [Mon, 3 Jun 2024 15:16:32 +0000 (17:16 +0200)]
Bump versions to 14.0.0-SNAPSHOT

This starts the next major development iteration.

Change-Id: I716788d312e1b1240f7861a59646c4333373992e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 weeks agoBump versions to 13.0.7-SNAPSHOT 32/111932/1
Robert Varga [Mon, 3 Jun 2024 15:15:37 +0000 (17:15 +0200)]
Bump versions to 13.0.7-SNAPSHOT

This starts the next development iteration.

Change-Id: I93fea828d23b4038b7700a0f949d4fa5920aebe9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRelease yangtools v13.0.6
jenkins-releng [Mon, 3 Jun 2024 14:03:05 +0000 (14:03 +0000)]
Release yangtools

4 weeks agoRework antlr suppression 23/111923/3
Robert Varga [Mon, 3 Jun 2024 09:08:27 +0000 (11:08 +0200)]
Rework antlr suppression

We can now exclude packages from analysis, use that facility instead of
a @SuppressFBWarnings.

Change-Id: I37ce23351b29f0370658f7e52c032ffbeb635f5a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoMigrate model-* artifacts to bnd-parent 22/111922/2
Robert Varga [Mon, 3 Jun 2024 07:05:50 +0000 (09:05 +0200)]
Migrate model-* artifacts to bnd-parent

Ditch the use bundle-parent in model/*, resulting in fewer warnings and
better metadata.

Change-Id: I33af0d5f81880127791550df9479223698f8eab8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoClean up codec-xml's module-info 10/111910/2
Robert Varga [Fri, 31 May 2024 17:08:55 +0000 (19:08 +0200)]
Clean up codec-xml's module-info

Use proper order of requires.

Change-Id: I21f66c9818629731cdc779f7e7e82bb51577370a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoMigrate openconfig-model-api to bnd-parent 94/111894/2
Robert Varga [Tue, 28 May 2024 20:05:38 +0000 (22:05 +0200)]
Migrate openconfig-model-api to bnd-parent

This is as easy as they come.

Change-Id: I6a7d4d2ec9121cca8bc2a566e69f2362b5526df4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoImprove bundle manifests 93/111893/2
Robert Varga [Tue, 28 May 2024 19:23:46 +0000 (21:23 +0200)]
Improve bundle manifests

Our bnd-based bundles are carrying excess manifest entries and end up
having a differt Bundle-SymbolicName.

Fix this by introducing a default bnd.bnd to inherit from, and also fix
Bundle-DocURL to point to our GitHub mirror.

Change-Id: I83329ac59d84fcd49559d4f8ca938518571f90c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoFix NormalizedNodeStreamWriterStack root handling 11/111411/11
tobias.pobocik [Thu, 23 May 2024 13:16:28 +0000 (15:16 +0200)]
Fix NormalizedNodeStreamWriterStack root handling

When we are attempting to startListEntry(), we really need to be looking
also at the root, as we may have been instantiated at the list itself.

Introduce a dedicated method to return that and use it also when
checking for choices.

JIRA: YANGTOOLS-1575
Change-Id: If4f4afa758d9edd358e9a8e7f1f7665b0156d8b2
Signed-off-by: tobias.pobocik <tobias.pobocik@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRemove more unused @SuppressFBWarnings 89/111889/1
Robert Varga [Tue, 28 May 2024 14:54:56 +0000 (16:54 +0200)]
Remove more unused @SuppressFBWarnings

Upgraded SpotBugs no longer reports a few false positives. Remove
a few more of the superfluous suppressions.

Change-Id: I4274a18c3d75a768a55ff80df9baf85095510af1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoRemove unused @SuppressFBWarnings 84/111884/1
Robert Varga [Tue, 28 May 2024 14:54:56 +0000 (16:54 +0200)]
Remove unused @SuppressFBWarnings

Upgraded SpotBugs no longer reports a false positive, fix that up,
eliminating the dependency from yang-test-util.

Change-Id: Ib3ad5125fac3d8b2c360a10bf0eb3572b87e7c35
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 weeks agoBump odlparent to 13.1.3 86/111686/2
Robert Varga [Tue, 14 May 2024 11:30:57 +0000 (13:30 +0200)]
Bump odlparent to 13.1.3

Adopt latest upgrades.

Change-Id: Ia126d5848ce88bd30084e8cc4cce9e6bb934c01f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoDefine a feature-parent 19/111619/1
Robert Varga [Sun, 5 May 2024 11:59:29 +0000 (13:59 +0200)]
Define a feature-parent

We have quite a bit of repetition going on, centralize what we can
in a common pom.xml.

Change-Id: Ia42f26e9043a47a918e60c2c7b18d6fecfbfff16
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoConvert features to template-feature-parent 18/111618/1
Robert Varga [Sun, 5 May 2024 11:03:45 +0000 (13:03 +0200)]
Convert features to template-feature-parent

We are getting warnings from maven-install-plugin for our feature
artifacts. Migrate them to template-feature-parent, which does not have
this problem.

Change-Id: Ibc7bbfb6675e3f010511020d4387492eef133f66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoBump versions to 13.0.6-SNAPSHOT 15/111615/1
Robert Varga [Sat, 4 May 2024 22:36:33 +0000 (00:36 +0200)]
Bump versions to 13.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: Ia4f239c6acbb073ef16710c4ed13a4b1fc0f91b5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoRelease yangtools v13.0.5
jenkins-releng [Sat, 4 May 2024 20:11:06 +0000 (20:11 +0000)]
Release yangtools

8 weeks agoBump odlparent to 13.1.2 11/111611/2
Robert Varga [Sat, 4 May 2024 05:29:23 +0000 (07:29 +0200)]
Bump odlparent to 13.1.2

Pick up upgrades and fixes from upstream.

Change-Id: Idb89c3c6c156a0368e0d14105043f35cdbe195a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
8 weeks agoFix checkstyle 10/111610/1
Robert Varga [Sat, 4 May 2024 05:46:57 +0000 (07:46 +0200)]
Fix checkstyle

Upgraded checkstyle finds a new violation, fix it up.

Change-Id: Id7445bd7adc83b5bc776122ca5be213830f06b85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoBump versions to 13.0.5-SNAPSHOT 40/111440/1
Robert Varga [Wed, 17 Apr 2024 14:34:50 +0000 (16:34 +0200)]
Bump versions to 13.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: Ia43d33c287acf9c46301ecb2a131ac0f782366c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRelease yangtools v13.0.4
jenkins-releng [Wed, 17 Apr 2024 11:50:58 +0000 (11:50 +0000)]
Release yangtools

2 months agoFix DependencyResolver 34/111434/3
Robert Varga [Tue, 16 Apr 2024 14:03:32 +0000 (16:03 +0200)]
Fix DependencyResolver

We have a problem with submodules: a submodule cannot be resolved until
its belongs-to module is resolved -- but a module cannot be resolved
until its include submodules are resolved.

Fix this by partially restoring previous logic -- i.e. we consider
submodules resolved without considering belongs-to. We then add a
separate pass to invalidate resolved modules.

JIRA: YANGTOOLS-1572
Change-Id: I3b54912fe0b9ed86b98037b0ce4551a021663199
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoHide DependencyResolverTest methods 33/111433/1
Robert Varga [Tue, 16 Apr 2024 13:23:24 +0000 (15:23 +0200)]
Hide DependencyResolverTest methods

The methods are needlessly public, hide them.

Change-Id: I00d9715948fbc3832acc4fb73e20aee0fb4983b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoBump versions to 13.0.4-SNAPSHOT 98/111398/1
Robert Varga [Mon, 15 Apr 2024 15:20:19 +0000 (17:20 +0200)]
Bump versions to 13.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: Id7dcb8271faef8d6d4a90586b8a4dcc91569e1ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRelease yangtools v13.0.3
jenkins-releng [Mon, 15 Apr 2024 12:38:14 +0000 (12:38 +0000)]
Release yangtools

2 months agoBump odlparent to 13.1.1 42/110442/9
Robert Varga [Sun, 3 Mar 2024 06:22:41 +0000 (07:22 +0100)]
Bump odlparent to 13.1.1

Pick up improments from upstream.

Change-Id: I8f43c3f6da7abea981712197cd0e99d2f3123b6c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDitch logback from yang-parser-rfc7950 tests 86/111386/1
Robert Varga [Sun, 14 Apr 2024 20:43:39 +0000 (22:43 +0200)]
Ditch logback from yang-parser-rfc7950 tests

Use slf4j-simple, as that is what we get by default. Also prevents a
warning about multiple providers being present.

Change-Id: I29d77f7ca1094cd773650c711167e1d42dcbf5ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDefeat potential singleton pollution attacks 48/111348/1
Robert Varga [Wed, 10 Apr 2024 13:50:16 +0000 (15:50 +0200)]
Defeat potential singleton pollution attacks

yang.common.Empty is a Serializable, which has no state beside its class
hierarchy. It therefore lends itself to having a singleton value object
-- except SpotBugs flags this as a violation MSC07-J rule in SEI CERT
Oracle Coding Standard for Java.

Digging into this, the readResolve() guard could be defeated via
hand-crafted serialization -- and thus could in theory have more than
once instance. Doing so would allow to have two Empty instances which
have the same Class, but do not compare as equal.

This patch erases that possibility, fixing a possibility of the error.

Also update documentation a bit to remove the word 'singleton', so users
are not tempted to use '==' for comparison -- which is already a bad
idea anyway.

Change-Id: Ibccd2909790e7a46d002d80f7b36280ff27fb724
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoModernize mocking in yang-data-api 18/111318/4
Robert Varga [Mon, 8 Apr 2024 01:10:31 +0000 (03:10 +0200)]
Modernize mocking in yang-data-api

We are testing utility classes with incomplete mocks. Enforce complete
mocking and drop FIXMEs for improvement.

Change-Id: Ifa17b12d5c6d801705b11e3685f53ec1c937ceab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoFix a requires warning 17/111317/1
Robert Varga [Mon, 8 Apr 2024 01:33:41 +0000 (03:33 +0200)]
Fix a requires warning

We are using Immutables for the default implementation, which leaks the
dependency. We should therefore import it transitively.

Change-Id: Ib9493744b0617c2ee7193cc3b6ff692e59ec6b57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAllow emission of operation input/output 79/111279/5
Robert Varga [Fri, 5 Apr 2024 09:49:23 +0000 (11:49 +0200)]
Allow emission of operation input/output

Both XML and JSON codecs should be in a place where they can emit
RPC/action input/outputs -- except NormalizedNodeStreamWriterStack
cannot initialize there.

Rework NormalizedNodeStreamWriterStack internal tracking to work on
EffectiveStatements and lift this restriction.

JIRA: YANGTOOLS-1570
Change-Id: If45bb096ee30cc35bf2a40ec26e12217f71ca06c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoRename JSONInstanceIdentifierCodec 49/111249/1
Robert Varga [Thu, 4 Apr 2024 00:49:48 +0000 (02:49 +0200)]
Rename JSONInstanceIdentifierCodec

This class is oddly named, it should be called
InstanceIdentifierJSONCodec.

Change-Id: I479475fb63e151f2756e44d62bf388d83bae01f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDeprecate UnknownTypeDefinition 48/111248/1
Robert Varga [Thu, 4 Apr 2024 00:36:03 +0000 (02:36 +0200)]
Deprecate UnknownTypeDefinition

This is just a stray API element, causing problems to downstreams of
model.api.type. Deprecate it for removal.

Change-Id: Ib8ac000ca8fbb533483bda5f3e7430db52d3a327
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAdd JSONValue and JSONCodec.unparseValue() 11/111211/4
Robert Varga [Tue, 2 Apr 2024 17:54:08 +0000 (19:54 +0200)]
Add JSONValue and JSONCodec.unparseValue()

RESTCONF use case requires serializing values using JSON encoding --
without having a document ready.

Introduce JSONValue to encapsulate what sort of values we can have along
with JSONCodec.unparseValue() -- which produces such values.

JIRA: YANGTOOLS-1569
Change-Id: I398af058b5c017803a9dc4c61d3f7cfbc45cca5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoDisconnect JSONCodec from JsonWriter 74/111174/4
Robert Varga [Tue, 2 Apr 2024 08:49:01 +0000 (10:49 +0200)]
Disconnect JSONCodec from JsonWriter

We have a use case where we would like to JSON-encode values without a
JsonWriter. Introduce JSONValueWriter to enable the values to be
intercepted.

JIRA: YANGTOOLS-1569
Change-Id: I8cabe490a78effb78d6d4bfaf0bb62238bd1b809
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoUse JsonWriter.nullValue() 72/111172/1
Robert Varga [Tue, 2 Apr 2024 08:29:14 +0000 (10:29 +0200)]
Use JsonWriter.nullValue()

We are passing a null String, which ends up calling to nullValue().
Short-circuit this.

Change-Id: I75423bee13cb2d73ef1b817b975a9cb155721c02
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoWriteout primitive boolean 71/111171/1
Robert Varga [Tue, 2 Apr 2024 08:21:13 +0000 (10:21 +0200)]
Writeout primitive boolean

We know the value is non-null, hence we can short-circuit to
JsonWriter.value(boolean).

Change-Id: I9340c2ebd8adfe34323e13f35a74ae78d24c2ce2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 months agoAdd JSONCodec.parseValue(String) 59/111159/1
Robert Varga [Mon, 1 Apr 2024 18:12:36 +0000 (20:12 +0200)]
Add JSONCodec.parseValue(String)

JSONCodec's parsing does not have a document context, add convenience
a convenience method.

JIRA: YANGTOOLS-1567
Change-Id: Iae1329be54bcb2f9249d0a159b4aa316be2e8d3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoImprove Revision.toString() javadoc 85/110685/1
Robert Varga [Tue, 12 Mar 2024 21:53:21 +0000 (22:53 +0100)]
Improve Revision.toString() javadoc

Revision.toString() has a few guarantees, make sure we document them.

Change-Id: I80ba05c9ac99ab8928e48eb33ad9e9216bddf61e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoBump versions to 13.0.3-SNAPSHOT 68/110668/1
Robert Varga [Tue, 12 Mar 2024 14:31:59 +0000 (15:31 +0100)]
Bump versions to 13.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: I41edd29c96e94e531aa973e2ebf1ff28a571aefc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 months agoRelease yangtools v13.0.2
jenkins-releng [Tue, 12 Mar 2024 10:39:59 +0000 (10:39 +0000)]
Release yangtools

3 months agoFix Guava javadoc reference 62/110462/1
Robert Varga [Sun, 3 Mar 2024 19:53:22 +0000 (20:53 +0100)]
Fix Guava javadoc reference

We have a down-revved reference, fix it up.

Change-Id: I88daa1d63919885e4cb1e0e4a26d6aa563e33e24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoBump odlparent to 13.0.11 31/110431/1
Robert Varga [Fri, 1 Mar 2024 21:32:28 +0000 (22:32 +0100)]
Bump odlparent to 13.0.11

Pick up latest upgrades from upstream.

Change-Id: I2b9e3d9f9e9b80d563f7004bb3558f3767817e2e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 months agoImprove YangParserTestUtils 10/110310/1
Robert Varga [Fri, 23 Feb 2024 07:58:55 +0000 (08:58 +0100)]
Improve YangParserTestUtils

Annotate method returns with @NonNull and ditch the use of
checkArgument().

Change-Id: I62b0da68bffb5cd50dc6dcb3bb755454a9575b52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoMake Empty hashcode deterministic 94/110094/1
Robert Varga [Wed, 31 Jan 2024 08:57:36 +0000 (09:57 +0100)]
Make Empty hashcode deterministic

All our YANG value types have a deterministic hash code, except Empty.
Fix that by assigning a hard-coded value.

Change-Id: I35d5b7a8d3bf653a2e85fc5e8fcbfe6baadc06b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoAdd Empty.{completed,immediate}Future() 89/110089/2
Robert Varga [Tue, 30 Jan 2024 01:13:27 +0000 (02:13 +0100)]
Add Empty.{completed,immediate}Future()

A number of downstream users are using Empty as a result of a future
which should only report empty success without relying on
java.lang.Void.

Since we are not playing favorites, let's expose two versions in keeping
with Java/Guava naming conventions:
- completedFuture() is the CompletionStage
- immediateFuture() is the ListenableFuture

JIRA: YANGTOOLS-1566
Change-Id: I5897ef561f562440e5d81fa7b0711e139dc6d6ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoMigrate users of ImmutableNodes 28/110028/1
Robert Varga [Sat, 27 Jan 2024 13:37:05 +0000 (14:37 +0100)]
Migrate users of ImmutableNodes

This is a simple clean up of the remaining users.

Change-Id: If5b96ad0d7fb73b98e1e5b19358d3c308004c2dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoMigrate users of deprecated QNameModule methods 27/110027/3
Robert Varga [Sat, 27 Jan 2024 12:28:18 +0000 (13:28 +0100)]
Migrate users of deprecated QNameModule methods

Mass-migrate to replacement methods, reducing quite a bit of verbosity.

Change-Id: I0ae704fbc7c753e4767134840b134ad72077a37e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoFix deprecation marker 26/110026/1
Robert Varga [Sat, 27 Jan 2024 12:30:23 +0000 (13:30 +0100)]
Fix deprecation marker

We have the wrong version here -- 12.0.1 will never ship, it should be
13.0.1.

Change-Id: Icf2b2cbfae56885231f997b3745d9c152f7f3fe3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoUse RevisionUnion in QNameModule 42/109642/16
Robert Varga [Fri, 5 Jan 2024 14:35:28 +0000 (15:35 +0100)]
Use RevisionUnion in QNameModule

QNameModule holds an optional Revision, which is inconvenient. This
patch retrofits RevisionUnion into it.

Since we are in this area, improve instantiation api, introducing of()
and ofRevision() convenience methods and deprecate create() methods.

Since QNameModule is a WritableObject composed of XMLNamespace and
RevisionUnion, make the two also WritableObjects and delegate to them.

Change-Id: Ib5349ef324d73340b285e9634e579825e55ab95d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoAdd QNameModule hash code tests 25/110025/1
Robert Varga [Fri, 26 Jan 2024 20:12:15 +0000 (21:12 +0100)]
Add QNameModule hash code tests

We need to ensure hash code is stable, add explicit tests for that.

Change-Id: Ibd4266c7f5f70363fc6d1e3cedbc1225d20550f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoModernize UniqueValidator 41/109941/3
Robert Varga [Tue, 23 Jan 2024 23:43:24 +0000 (00:43 +0100)]
Modernize UniqueValidator

Use local variable type inference and instanceof patterns to reduce
verbosity and explicit casts.

Change-Id: I6f8a3a8fd96037d127c091aa16a705a31775d96f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoModernize UniqueValidation a bit 43/109943/2
Robert Varga [Wed, 24 Jan 2024 00:03:17 +0000 (01:03 +0100)]
Modernize UniqueValidation a bit

Use local variable type inference and instanceof patterns to reduce
clutter.

Change-Id: I79717c6b41e6510464838d36b81158fcb26e51ea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
5 months agoAdd a UniqueValues design note. 42/109942/2
Robert Varga [Tue, 23 Jan 2024 23:53:12 +0000 (00:53 +0100)]
Add a UniqueValues design note.

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