yangtools.git
12 days agoRemove BindingReflections.findHierarchicalParent()
Robert Varga [Wed, 2 Nov 2022 14:34:39 +0000 (15:34 +0100)]
Remove BindingReflections.findHierarchicalParent()

These methods are not used anywhere, remove them.

JIRA: MDSAL-787
Change-Id: If141bf222523671fb524c27f2322e4591410d900
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDeprecate BindingReflections.findHierarchicalParent()
Robert Varga [Wed, 2 Nov 2022 14:33:33 +0000 (15:33 +0100)]
Deprecate BindingReflections.findHierarchicalParent()

These methods are not used, deprecate them for removal.

Change-Id: Idee358f004fb36fb01a3c5222430a808dd68bbfd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoRemove BindingReflections.isAugmentationChild()
Robert Varga [Wed, 2 Nov 2022 14:30:48 +0000 (15:30 +0100)]
Remove BindingReflections.isAugmentationChild()

This method is not used anywhere, remove it.

JIRA: MDSAL-786
Change-Id: I6ed40aab7432f59e2e2a8bcb51e161cac2fcb33e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDeprecate BindingReflections.isAugmentationChild()
Robert Varga [Wed, 2 Nov 2022 14:28:24 +0000 (15:28 +0100)]
Deprecate BindingReflections.isAugmentationChild()

This method is used only in test, deprecate it for removal.

Change-Id: I894429041302163288036085a1af4718d5e28a83
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse Optional.orElseThrow()
Robert Varga [Wed, 2 Nov 2022 14:15:04 +0000 (15:15 +0100)]
Use Optional.orElseThrow()

This makes the intent clearer.

Change-Id: Ib7d733d7563e6a51b86dbf313da55abb18556d4d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoBump upstreams
Robert Varga [Wed, 5 Oct 2022 11:16:17 +0000 (13:16 +0200)]
Bump upstreams

Adopt:
- odlparent-12.0.0
- yangtools-10.0.0

Change-Id: Ic101cb87855ee69680746d783e1a40b6f944e3f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoAdd BindingReflections.getQName(Rpc)
Robert Varga [Thu, 13 Oct 2022 13:40:34 +0000 (15:40 +0200)]
Add BindingReflections.getQName(Rpc)

Acquiring the QName of an RPC implementation is a well-known operation,
make sure we publish that capability.

JIRA: MDSAL-773
Change-Id: I2d3bd90d41b8da45f7b99a0ffebdfa4e18c0ffcc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoImprove BindingReflections.getQName()
Robert Varga [Thu, 13 Oct 2022 13:28:36 +0000 (15:28 +0200)]
Improve BindingReflections.getQName()

BaseIdentity operates on instance methods now, hence we should not
be passing a Class here. This allows us to evolve the contract in
the future.

Change-Id: I837dbfd9dffedf190c6885202d39cf730cd08de2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUpdate BindingReflections.getQName()
Robert Varga [Thu, 13 Oct 2022 13:27:06 +0000 (15:27 +0200)]
Update BindingReflections.getQName()

Use orElseThrow() instead of checkState() and explicit check/get.

Change-Id: I9b16d31ad4dba8a1d911a3566d590b2d8d2f47fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDeprecate BindingMapping.NOTIFICATION_LISTENER_SUFFIX
Robert Varga [Thu, 13 Oct 2022 09:28:09 +0000 (11:28 +0200)]
Deprecate BindingMapping.NOTIFICATION_LISTENER_SUFFIX

This is part of the NotificationListener specification, it needs to be
deprecated just as the rest of it is.

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

12 days agoGenerate Rpc services
Robert Varga [Wed, 5 Oct 2022 12:43:57 +0000 (14:43 +0200)]
Generate Rpc services

Introduce an Rpc concept similar to Action, except without a path.
Generate its specializations, allowing RPCs to be implemented and/or
invoked without their ModuleService aggregate.

JIRA: MDSAL-773
Change-Id: I5fec1ac5c81b908714965e71c3471b954b58d1f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoIntegrate Action with BindingContract
Robert Varga [Thu, 6 Oct 2022 11:58:58 +0000 (13:58 +0200)]
Integrate Action with BindingContract

Having an integrated BindingContract allows us readily identify
the the implementation contract of an action. This allows us to ditch
the explicit class instance.

JIRA: MDSAL-776
Change-Id: I6fc297f331d5f0c545b80e84ca54025c44c67eb6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoImprove ModuleAugmentGenerator safety
Robert Varga [Wed, 5 Oct 2022 12:42:26 +0000 (14:42 +0200)]
Improve ModuleAugmentGenerator safety

Require parent to be a module, which makes the intent more explicit.

Change-Id: Ic9d83c879838d10a475b46feb43a6aeab0c3f66c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse instanceof patterns
Robert Varga [Wed, 5 Oct 2022 12:50:53 +0000 (14:50 +0200)]
Use instanceof patterns

We have quite a bit of checking and casting going on, simplify a bit
but using JDK17 constructs.

Change-Id: Iffd0537e9832f8372b696fba7025c49c0fbf597c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoRemove use of SchemaPath
Robert Varga [Wed, 5 Oct 2022 11:53:54 +0000 (13:53 +0200)]
Remove use of SchemaPath

We are not referencing SchemaPath in any shape or form. Remove all
references.

Change-Id: I509ee338ed3e8d038200ca8d36686a5320b13884
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoBump versions to 11.0.0-SNAPSHOT
Robert Varga [Wed, 5 Oct 2022 11:05:58 +0000 (13:05 +0200)]
Bump versions to 11.0.0-SNAPSHOT

This starts the next major development iteration.

Change-Id: Ia278be03f42f2e9c17c6b59fb5330aa41e3faa99
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoBump versions to 10.0.3-SNAPSHOT
Robert Varga [Wed, 14 Sep 2022 12:30:02 +0000 (14:30 +0200)]
Bump versions to 10.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: I2434badf754ee6f6845ee7f090f78e597f0d5af0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoGenerate javadoc for TypeObjects
Samuel Schneider [Wed, 17 Aug 2022 08:07:50 +0000 (10:07 +0200)]
Generate javadoc for TypeObjects

Fix warnings about missing javadoc in TypeObject classes.

Add setting of YangSourceDefinition when building GeneratedType
for TypeObject so JavaFileTemplate.appendSnippet() generate javadoc
for this class.

Generation of javadoc was added for all TypeObjects not only
ScalarTypes as described in corresponding task.

JIRA: MDSAL-762
Change-Id: Iec3ab9e36bcea0807892bd024b7f04c451ff9000
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoClean up AbstractEnumerationBuilder
Robert Varga [Wed, 14 Sep 2022 10:43:51 +0000 (12:43 +0200)]
Clean up AbstractEnumerationBuilder

We can use Java 17, fluent StringBuilder and streams to make the code
denser.

Change-Id: Id0b8bc176076469120fddbb993e9a59215aa660a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoPropagate status in feature classes
Robert Varga [Fri, 9 Sep 2022 13:52:44 +0000 (15:52 +0200)]
Propagate status in feature classes

When we have a deprecated or obsolete identity, the resulting interface
should be marked as deprecated, perhaps for removal.

JIRA: MDSAL-770
Change-Id: I2b1204b2afcd4b2786c0c76695c1d58304349f57
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoPropagate status in identity classes
Robert Varga [Fri, 9 Sep 2022 13:51:15 +0000 (15:51 +0200)]
Propagate status in identity classes

When we have a deprecated or obsolete identity, the resulting interface
should be marked as deprecated, perhaps for removal.

JIRA: MDSAL-769
Change-Id: I5aefc70d5cde269217143e092ba208589b55d12f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoBump xtend to 2.28.0
Robert Varga [Fri, 9 Sep 2022 05:39:05 +0000 (07:39 +0200)]
Bump xtend to 2.28.0

https://www.eclipse.org/xtend/releasenotes.html#/releasenotes/2022/05/30/version-2-27-0
https://www.eclipse.org/xtend/releasenotes.html#/releasenotes/2022/08/29/version-2-28-0

Change-Id: I9ce1d9fddabff9df48de9fc69637492d30c39635
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoGenerate features with @NonNullByDefault
Robert Varga [Mon, 22 Aug 2022 14:50:10 +0000 (16:50 +0200)]
Generate features with @NonNullByDefault

We get quite a few warnings around nulls, use @NonNullByDefault, as that
is what we need.

Change-Id: Ia6b7c572ece161cc4e9cac1e9530a91b621cd93e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoBump versions to 10.0.2-SNAPSHOT
Robert Varga [Thu, 18 Aug 2022 08:11:18 +0000 (10:11 +0200)]
Bump versions to 10.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: I353e51fd685690023e24fdad452d53ced4d44eee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoBump odlparent/yangtools
Robert Varga [Wed, 17 Aug 2022 15:48:39 +0000 (17:48 +0200)]
Bump odlparent/yangtools

Adopt:
- odlparent-11.0.1
- yangtools-9.0.1

Change-Id: I3b1ba2d5345bbf26d471296f850e3b9836ffb2a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse @Serial tag
Robert Varga [Tue, 16 Aug 2022 11:01:14 +0000 (13:01 +0200)]
Use @Serial tag

With Java 17 we can make serialization-related components explicitly
tagged so their shape is enforced. Sprinkle java.io.Serial around.

Change-Id: Ibf0ce6e19f8433b3274e05ad3f56d86616146e78
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse instanceof pattern in Identity's equals()
Robert Varga [Tue, 16 Aug 2022 11:47:39 +0000 (13:47 +0200)]
Use instanceof pattern in Identity's equals()

We can use an implicit cast here, let's just do that to make things a
tad simpler.

Change-Id: Ic2f48c2b8f3fc0e4b5aec0b699cad8edf4c434b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoFixup a nullness warning
Robert Varga [Tue, 16 Aug 2022 09:45:50 +0000 (11:45 +0200)]
Fixup a nullness warning

Add an annotation to fix a potential problem.

Change-Id: I8676cb25ee5f7c8c132b894f47c4383825d9ff5d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoFix raw type warnings in OSGiBindingRuntime
Robert Varga [Tue, 16 Aug 2022 09:38:16 +0000 (11:38 +0200)]
Fix raw type warnings in OSGiBindingRuntime

Component/ComponentFactory take a type specification, make sure we
take advantage of that.

Change-Id: I11cd64811b683fdfa8dfd62980cf9e1979ed1c0d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoAdd YangFeatureProvider
Robert Varga [Wed, 10 Aug 2022 23:23:51 +0000 (01:23 +0200)]
Add YangFeatureProvider

YangFeatureProvider is a counterpart to YangModuleInfoProvider,
providing the runtime with the ability to introspect what features
should be supported in an EffectiveModelContext.

JIRA: MDSAL-767
Change-Id: I6d08772c96eead79b4c88ae9ac27c57901dc70a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoGenerate classes for 'feature' statements
Robert Varga [Wed, 10 Aug 2022 23:51:46 +0000 (01:51 +0200)]
Generate classes for 'feature' statements

We need to cross-reference 'feature' statements before we assemble an
EffectiveModelContext. In order to do that cleanly and in a type-safe
manner, we need to generate Binding representation of each feature.

JIRA: MDSAL-766
Change-Id: I67e2a1dd42bd1b364fbcbbf88a83d96c947621ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse instanceof pattern checks
Robert Varga [Mon, 15 Aug 2022 17:48:07 +0000 (19:48 +0200)]
Use instanceof pattern checks

We can clean up some code with instanceof patterns, use them.

Change-Id: I0c3022b44d824b4677b1286a9c3b99cf18a01193
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoNarrow @SuppressModernizer
Robert Varga [Mon, 15 Aug 2022 08:27:00 +0000 (10:27 +0200)]
Narrow @SuppressModernizer

We are only suppressing the use of Guava's Objects in != operator, narrow
covered places.

Change-Id: I6b3ec8f78996227bae27558f9c04b22ed866595b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse an instanceof pattern
Robert Varga [Mon, 15 Aug 2022 07:35:54 +0000 (09:35 +0200)]
Use an instanceof pattern

We can remove a cast here, saving a few characters.

Change-Id: Ie2c03a062cffce58ba15a253e81957b6cc5d1b6b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDitch Collections.{singleton,empty}List()
Robert Varga [Sun, 14 Aug 2022 16:59:29 +0000 (18:59 +0200)]
Ditch Collections.{singleton,empty}List()

Use List.of() instead.

Change-Id: I728826dba2b4790ef75606da918c5968b3c8ee48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoShare AbstractExplicitGenerator.runtimeJavaType()
Robert Varga [Fri, 12 Aug 2022 20:41:15 +0000 (22:41 +0200)]
Share AbstractExplicitGenerator.runtimeJavaType()

Most implementations do the same thing, pull the implementation down
into the abstract class.

Change-Id: Iaf0b6cee34e62c89ea3d34b8c83fa4f02bce913e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoSeal CollisionMember.Member
Robert Varga [Thu, 11 Aug 2022 00:19:57 +0000 (02:19 +0200)]
Seal CollisionMember.Member

This is an implementation detail, seal the class hierarchy.

Change-Id: Ifb9497a172d16a2e2560b46df47631934351afe0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDispatch statements with instanceof pattern
Robert Varga [Thu, 11 Aug 2022 00:09:08 +0000 (02:09 +0200)]
Dispatch statements with instanceof pattern

Remove a bit of casting by using an instanceof match.

Change-Id: I2d22f4a3bd6151c4193d3dec95efc7f69c09013d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse instanceof pattern
Robert Varga [Tue, 9 Aug 2022 20:01:25 +0000 (22:01 +0200)]
Use instanceof pattern

Remove a cast to make the expression simpler.

Change-Id: I7a0d1abf1e80cafb9352bfbb1f05ae56b9117bf1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoImprove javadoc for generated keys
Samuel Schneider [Mon, 11 Jul 2022 09:52:08 +0000 (11:52 +0200)]
Improve javadoc for generated keys

Fix warnings about missing javadoc in Key classes
generated by ListKeyTemplate.xtend.

Add generation of javadoc for all values constructor,
getter methods and for the class.

JIRA: MDSAL-759
Change-Id: I1cef9d4b4415e0f786eca414937b1958d31acd38
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoGenerate javadoc for augments
Samuel Schneider [Thu, 4 Aug 2022 13:13:00 +0000 (15:13 +0200)]
Generate javadoc for augments

Fix warnings about missing javadoc in augment interfaces.

Add setting of YangSourceDefinition when building GeneratedType
corresponding to augments so JavaFileTemplate.appendSnippet()
generate javadoc for this class.

JIRA: MDSAL-761
Change-Id: I243ce2e5198dca2b9c6e6c009c6ddb2a248d44a5
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoGenerate javadoc for unions
Samuel Schneider [Mon, 25 Jul 2022 13:12:49 +0000 (15:12 +0200)]
Generate javadoc for unions

Fix warnings about missing javadoc in union classes.

Add setting of YangSourceDefinition when building GeneratedType
corresponding to union so JavaFileTemplate.appendSnippet()
generate javadoc for this class.

JIRA: MDSAL-760
Change-Id: I42ac82ab099785b1318a5e3615e37ebeee653b02
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse FrameworkUtil.asDictionary()
Robert Varga [Mon, 11 Jul 2022 21:08:59 +0000 (23:08 +0200)]
Use FrameworkUtil.asDictionary()

We do not need a Hashtable, use FrameworkUtil to give us what we need.

Change-Id: If6a590a2651e92b89e349b41a6ab4e10b0f73db8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoClean up YangSourceDefinition a bit
Robert Varga [Mon, 11 Jul 2022 20:29:26 +0000 (22:29 +0200)]
Clean up YangSourceDefinition a bit

Capture the shared predicate in a method and use method references
to route to it. Also use instanceof pattern match.

Change-Id: I530274532db9a4942dcc54725c211785badd5d42
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse instanceof pattern match
Robert Varga [Mon, 11 Jul 2022 20:19:50 +0000 (22:19 +0200)]
Use instanceof pattern match

We can be more expressive now that we have Java 17, let's do that.

Change-Id: I669fe4bd871c9cc269ead6b3b376af21295efc4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoAdd generation of javadoc for Builder.withKey()
Samuel Schneider [Fri, 1 Jul 2022 11:10:54 +0000 (13:10 +0200)]
Add generation of javadoc for Builder.withKey()

Fix warnings about missing javadoc for method withKey() in Builder
classes generated by BuilderTemplate.xtend.

JIRA: MDSAL-758
Change-Id: Ia871623b608a9dcdfb4fec284622843a7365e839
Signed-off-by: Samuel Schneider <samuel.schneider@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoBump versions to 10.0.1-SNAPSHOT
Robert Varga [Mon, 27 Jun 2022 08:51:59 +0000 (10:51 +0200)]
Bump versions to 10.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: Iee036e6c5815752768d86f701fc44b3ce1e6c808
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoImprove TypeObject.toString()
ivan.martiniak [Mon, 28 Mar 2022 11:09:03 +0000 (13:09 +0200)]
Improve TypeObject.toString()

Fixed:
 - Use "value" instead of "_value".

JIRA: MDSAL-693
Change-Id: I7243cf935f5988a563e4d5748ab364e2921c4853
Signed-off-by: ivan.martiniak <ivan.martiniak@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDeprecate NotificationListener
Robert Varga [Tue, 21 Jun 2022 11:49:03 +0000 (13:49 +0200)]
Deprecate NotificationListener

NotificationListener is a top-level generated class with a tight binding
to invocation patterns (in mdsal-binding-api). We already provide an
alternative API via functional interfaces, which deal with the
equivalent problem.

Deprecate NotificationListener and related services, guiding users to
their replacements.

JIRA: MDSAL-496
Change-Id: I4ac52493f253040f0055011122dd41c4c367d84b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoCleanup mdsal-binding-dom-codec-spi dependencies
Robert Varga [Tue, 21 Jun 2022 12:12:55 +0000 (14:12 +0200)]
Cleanup mdsal-binding-dom-codec-spi dependencies

We are using a number of upstream artifacts, make sure we spell
them out.

Change-Id: I7ae2ae61aa0ce6ea8e1e595d1da3facb734db464
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoTurn Restrictions into a final class
Robert Varga [Tue, 21 Jun 2022 11:09:23 +0000 (13:09 +0200)]
Turn Restrictions into a final class

We have a number of distinct implementations, make sure we concatenate
them into a single one. Also mark future evolution of this contract.

JIRA: MDSAL-85
Change-Id: I620d7e52ea0faf1add13ceeae660062c3dbfa278
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoModernize BindingGeneratorUtil
Robert Varga [Tue, 21 Jun 2022 10:37:09 +0000 (12:37 +0200)]
Modernize BindingGeneratorUtil

Use instanceof pattern and use ImmutableList consistently.

Change-Id: If324ba0440df122d37acce485822ce5e463aac87
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoRemove Types.getDefaultRestrictions()
Robert Varga [Tue, 21 Jun 2022 10:27:56 +0000 (12:27 +0200)]
Remove Types.getDefaultRestrictions()

This method is not used anywhere, remove it.

Change-Id: I704f95e98d67aed7e2a322532695d3889af4668a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse yangtools release instead of snapshots
Robert Varga [Mon, 20 Jun 2022 15:10:28 +0000 (17:10 +0200)]
Use yangtools release instead of snapshots

We have a release out there, use that in preparation for our release.

Change-Id: Ia1211f11db9421d9c8e957de4393aeb57d840781
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoRemove an empty line
Robert Varga [Thu, 16 Jun 2022 11:40:10 +0000 (13:40 +0200)]
Remove an empty line

We have a superfluous empty line, remove it.

Change-Id: Icd599065ce41edb6e2f9be071a24b11064d360eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoFix a typo
Robert Varga [Thu, 16 Jun 2022 11:36:36 +0000 (13:36 +0200)]
Fix a typo

We have an unused parameter, but it should have the right name.

Change-Id: I8a9c023d4799c4d9899754c4aef4c0051118d8d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoGenerate fields for all Identityrefs in an Union binding class
OleksandrZharov [Thu, 28 Apr 2022 11:47:27 +0000 (13:47 +0200)]
Generate fields for all Identityrefs in an Union binding class

Changed property name in generator for identityrefs so it will
generate variable names based on type of identityref and not
identityref_ like was before. With that it will generate fields
for all identityrefs that we have in union and methods for them.

Updated related test and added another one to cover the change.

JIRA: MDSAL-740
Change-Id: I11735655ab407f37774cb1b5ffa61955abaee37c
Signed-off-by: OleksandrZharov <Oleksandr.Zharov@pantheon.tech>
Signed-off-by: Tibor Král <tibor.kral@pantheon.tech>
12 days agoEliminate use of the IllegalArgumentCodec
Robert Varga [Fri, 10 Jun 2022 12:13:33 +0000 (14:13 +0200)]
Eliminate use of the IllegalArgumentCodec

Add DomLocalCodec replacement with exactly the semantics we need,
and use that instead of IllegalArgumentCodec.

JIRA: MDSAL-704
Change-Id: I31da50435c8b2a270c1b3cf4210eed59e7e4376f
Signed-off-by: Kostiantyn Nosach <kostiantyn.nosach@pantheon.tech>
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDo not generate java.beans.ConstructorProperties
Robert Varga [Tue, 7 Jun 2022 08:21:11 +0000 (10:21 +0200)]
Do not generate java.beans.ConstructorProperties

We are generating ConstructorParameters, there is no need for
java.desktop dependency here.

JIRA: MDSAL-757
Change-Id: Ibaa0c20194052b7b85a0ba37f59f5c86c99534a7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoModernize AbstractCompositeRuntimeType
Robert Varga [Mon, 30 May 2022 15:48:22 +0000 (17:48 +0200)]
Modernize AbstractCompositeRuntimeType

Use a switch expression to make initialization more explicit.

Change-Id: I349adb2626b13b55a6d122bcfb480acc6c380adc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoModernize Generator
Robert Varga [Mon, 30 May 2022 15:45:27 +0000 (17:45 +0200)]
Modernize Generator

Use switch expressions and instanceof patterns to make the code more
expressive and ditch a few default cases.

Change-Id: I72e3abd0edc68c923500e006a17152bdadfd3fc3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoModernize AbstractTypeObjectGenerator
Robert Varga [Mon, 30 May 2022 15:40:24 +0000 (17:40 +0200)]
Modernize AbstractTypeObjectGenerator

Use switch expressions and instanceof pattern matches.

Change-Id: Icf302df71d019db527fd1472d68b55a9100c536f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoModernize SchemaRootCodecContext
Robert Varga [Mon, 30 May 2022 15:36:06 +0000 (17:36 +0200)]
Modernize SchemaRootCodecContext

Use switch expressions and instanceof patterns to improve
expressiveness.

Change-Id: I08f8806dca5cc1936b2d39ff7c3e2b7b5efc0e60
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse switch expression in IdentifiableItemCodec
Robert Varga [Mon, 30 May 2022 15:31:47 +0000 (17:31 +0200)]
Use switch expression in IdentifiableItemCodec

An expression is more appropriate here, as we always return a result.

Change-Id: I6cb1d5ef2f04aa1156ef23d789ff52eb3b5600bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoModernize DataContainerCodecPrototype
Robert Varga [Mon, 30 May 2022 15:28:51 +0000 (17:28 +0200)]
Modernize DataContainerCodecPrototype

Use pattern matching on instanceof and arrow cases. Also split off
ChoiceSchemaNode addressability computation to speed things up just
a bit.

Change-Id: I9deaab2a97becabbe63b3aa5602301239847358e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse switch expressions in mdsal-binding-model-ri
Robert Varga [Mon, 30 May 2022 08:46:42 +0000 (10:46 +0200)]
Use switch expressions in mdsal-binding-model-ri

We can improve code layout a bit by using a switch expression.

Change-Id: I0784fa87890d81849e08f531b84b081033166c32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse arrow case in BindingMapping
Robert Varga [Mon, 30 May 2022 08:41:55 +0000 (10:41 +0200)]
Use arrow case in BindingMapping

This makes the switch expression a bit denser.

Change-Id: I168148a8c6d46a51cd5619cd52e314b9fd3e5453
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse instanceof pattern in BindingReflections
Robert Varga [Mon, 30 May 2022 08:40:47 +0000 (10:40 +0200)]
Use instanceof pattern in BindingReflections

Reduce the number of casts.

Change-Id: I220b063f9ce81d7487fdf35ef2648193cb7c4cb6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoCorrect mdsal-binding-runtime-spi dependencies
Robert Varga [Wed, 25 May 2022 15:43:49 +0000 (17:43 +0200)]
Correct mdsal-binding-runtime-spi dependencies

We have a number of warnings here, clean up the dependencies.

Change-Id: I7fdca0924ecec08b3ab4c173b543f75a4b6de43b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoRemove _dsannotations-options override
Robert Varga [Wed, 25 May 2022 14:44:19 +0000 (16:44 +0200)]
Remove _dsannotations-options override

We have a modern maven-bundle-plugin, which includes a fixed-up bnd
library and generates proper provides to match ComponentFactory
annotations. Remove suppressions that were needed to make these work.

Change-Id: Ia2a19c69fa11c1d89df733143449fa6954701024
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDo not use RevisionSourceIdentifier
Robert Varga [Wed, 11 May 2022 13:42:38 +0000 (15:42 +0200)]
Do not use RevisionSourceIdentifier

We only have SourceIdentifier now, adjust codebase to reflect this.

Change-Id: I52ab8d0d9bf9ee920df33d40c467acb5e1223185
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoAdjust for ModuleImport type change
Robert Varga [Wed, 11 May 2022 13:38:03 +0000 (15:38 +0200)]
Adjust for ModuleImport type change

We are using Unqualified, not String, hence we need to unpack it.

Change-Id: I1227a66256351acbd534701506230c8c7147972a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse HexFormat to print out byte[] properties
ivan.martiniak [Tue, 3 May 2022 11:32:21 +0000 (13:32 +0200)]
Use HexFormat to print out byte[] properties

HexFormat.of().formatHex(byte[] arr)
 - transform byte array to hex formated string,

For comparison array formated with Arrays.toString()
[-32,79,-48,32,-22,58,105,16,-94,-40,8,0,43,48,48,-99],
with formatHex() it is string "e04fd020ea3a6910a2d808002b30309d".

The main difference is that array formatted with formatHex()
does not contain signed values, what was a condition
in the task description.

The test was required to be changed as well because it was
dependent on Arrays.toString() method.

JIRA: MDSAL-692
Change-Id: Ica9e399d61d54ac19369d3b2a9f60c9690b44128
Signed-off-by: ivan.martiniak <ivan.martiniak@pantheon.tech>
12 days agoUse instanceof pattern match in fieldsFrom()
Robert Varga [Wed, 27 Apr 2022 16:56:13 +0000 (18:56 +0200)]
Use instanceof pattern match in fieldsFrom()

With JD17 we can use a pattern match to cast the argument only once,
simplifying the generated code and the codegen a bit.

Change-Id: I14c61480eee3d0214d43af2337c5fd0cf9b7d3ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse 'var' for augmentation variable
Robert Varga [Wed, 27 Apr 2022 16:43:08 +0000 (18:43 +0200)]
Use 'var' for augmentation variable

Simplify the variable declaration and corresponding codegen bit
by relying on local variable type inference.

Change-Id: I3976b20ce5acbce66b1057bb3e374e18aaef3155
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoGenerate documentation for builder getters
Robert Varga [Wed, 27 Apr 2022 16:36:39 +0000 (18:36 +0200)]
Generate documentation for builder getters

Javadoc rightfully complains about Builders not documenting its getFoo()
methods. Add the javadocs pointing to their interface counterparts.

JIRA: MDSAL-755
Change-Id: Iacb5480b3bc0490d7c088add9e681076d067635d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoGenerate javadoc for builder setters
Robert Varga [Wed, 27 Apr 2022 16:23:30 +0000 (18:23 +0200)]
Generate javadoc for builder setters

Setters are utterly undocumented. Add javadocs which point to the
corresponding interface method.

JIRA: MDSAL-755
Change-Id: I1d51ea8499d430ed231197e6448a1122d7ac0f27
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoImport exception references
Robert Varga [Wed, 27 Apr 2022 15:39:42 +0000 (17:39 +0200)]
Import exception references

We may be generating a competing construct, hence need to use
importedName for {IllegalArgument,NullPointer}Exception.

Change-Id: I3fe59a745bc17b292d8d50e6c55ef8669b0ee35a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDocument Builder.augmentation()
Robert Varga [Wed, 27 Apr 2022 15:32:38 +0000 (17:32 +0200)]
Document Builder.augmentation()

Builder's augmentation() method needs some javadoc to fix linting
warnings.

JIRA: MDSAL-755
Change-Id: I1bc62ea6753411159a9d21eca95eaf40b799d2b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoAnnotate non-null build() return
Robert Varga [Wed, 27 Apr 2022 15:22:10 +0000 (17:22 +0200)]
Annotate non-null build() return

Builder.build() always returns a non-null value, make sure we annotate
it properly.

Change-Id: I88df931e4d98481354d8e418909248f2d23d2b68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoUse Map.of() instead of Collections.emptyMap() in builders
Robert Varga [Wed, 27 Apr 2022 15:02:43 +0000 (17:02 +0200)]
Use Map.of() instead of Collections.emptyMap() in builders

Augmentation field is not used by the builder-internal implementation,
hence we can inline the codegen. Also use Map.of() instead of
emptyMap().

Change-Id: I62e9b92b31355abd917a05a01c94f46230f449ec
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoFix a minor typo
Robert Varga [Wed, 27 Apr 2022 14:57:16 +0000 (16:57 +0200)]
Fix a minor typo

'wich' should be 'which'.

Change-Id: I20295881f28c139b0ec7a04678272e762969efe5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDocument builder constructors
Robert Varga [Wed, 27 Apr 2022 14:49:58 +0000 (16:49 +0200)]
Document builder constructors

Javadoc is not entirely happy with us not generating any documentation
for various Builder constructors. Fix this by adding some rudimentary
javadoc.

JIRA: MDSAL-755
Change-Id: Icaec59bb86d21f372e341ea93d9d89cbb2599951
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoImprove Builder's fieldsFrom() javadoc
Robert Varga [Wed, 27 Apr 2022 14:47:45 +0000 (16:47 +0200)]
Improve Builder's fieldsFrom() javadoc

We are listing out types, but do not link them. Fix this by making
each item a {@link}.

JIRA: MDSAL-755
Change-Id: I3bf6f8a97bd004cb88bee3fbc6b6b0ef373a36d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDocument QNAME constant
Robert Varga [Wed, 27 Apr 2022 14:30:52 +0000 (16:30 +0200)]
Document QNAME constant

Javadoc does not like the constant not being documented. Make sure
we attach a bit of documentation.

JIRA: MDSAL-755
Change-Id: Ib56879225ea7653f22770d5e097d350e931ece13
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoDocument YangModuleInfo(Provider)
Robert Varga [Wed, 27 Apr 2022 14:19:24 +0000 (16:19 +0200)]
Document YangModuleInfo(Provider)

New javadoc is rather more noisy about missing documentation. Improve
the situation for module info and its ServiceLoader provider.

JIRA: MDSAL-755
Change-Id: I9d008a737b4db992664b24babfe206219b975e90
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoRepair version declarations
Robert Varga [Wed, 27 Apr 2022 06:50:22 +0000 (08:50 +0200)]
Repair version declarations

Previous search and replace has bumped our versions to an illegal
string, fix that up.

Change-Id: Ic1f0204ea78384e0c1f542c902ef9ce46bcb8d89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoSeal more Binding contracts
Robert Varga [Tue, 26 Apr 2022 10:03:56 +0000 (12:03 +0200)]
Seal more Binding contracts

DataContainer/BindingObject/BindingContract provide structural
hierarchy which is fixed with codegen attaching to specific endpoints.
Make sure we express this invariant by sealing the interior of the
hierarchy.

Change-Id: I5121b5afe9a880600e7ee12700fc954352afa82d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoSeal YangSourceDefinition
Robert Varga [Tue, 26 Apr 2022 10:11:21 +0000 (12:11 +0200)]
Seal YangSourceDefinition

YangSourceDefinition cannot be subclassed externally, make it a sealed
class.

Change-Id: Ibebd2c13dc4fac4e2def7f0924b2558b728e2f96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoSeal JavaTypeName
Robert Varga [Tue, 26 Apr 2022 10:10:41 +0000 (12:10 +0200)]
Seal JavaTypeName

JavaTypeName cannot be externally subclassed, make it a sealed class.

Change-Id: I2f79f8cf3d4ff060ebb269a1d2fc0f57a3cda604
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoClean up mdsal-binding-java-api-generator dependencies
Robert Varga [Tue, 26 Apr 2022 14:52:50 +0000 (16:52 +0200)]
Clean up mdsal-binding-java-api-generator dependencies

We have a number of used dependencies which are not declared, clean them
up.

Change-Id: Iaaa3c808ff8f8c89b3c0bb67ad169eedefeade77
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoFix mdsal-binding-model-api dependencies
Robert Varga [Tue, 26 Apr 2022 10:13:15 +0000 (12:13 +0200)]
Fix mdsal-binding-model-api dependencies

We have a few warnings about used dependencies, fix that up.

Change-Id: I3ab19de156c637cc97ad06ef8d98a9284601b44a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoFixup mdsal-binding-model-api module definition
Robert Varga [Tue, 26 Apr 2022 10:08:44 +0000 (12:08 +0200)]
Fixup mdsal-binding-model-api module definition

We require SLF4J, make sure to mention that.

Change-Id: Ibbdb5438ef60f4c5fc70c590e3fdfdbe2c0c4b8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoGenerate a switch expression in forName()/forIntValue()
Robert Varga [Tue, 26 Apr 2022 12:53:38 +0000 (14:53 +0200)]
Generate a switch expression in forName()/forIntValue()

JDK17 allows us to use switch expressions, which are nice and concise
way of matching values. Use them instead of ImmutableMaps for value
lookups.

JIRA: MDSAL-753
Change-Id: I1f12eb7469ce08ee66024abfb2bef5305f1cee63
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoCleanup enumeration static factory methods
Robert Varga [Tue, 26 Apr 2022 12:47:23 +0000 (14:47 +0200)]
Cleanup enumeration static factory methods

We have some amount of inconsistency around enumeration returns. Improve
the situation by making forName() return a nullable value and add
ofName()/ofValue() methods which throw IAE.

While we are modifying the template, also add proper @Nullable and
@NonNull annotations.

JIRA: MDSAL-754
Change-Id: I07fe4b408174ba830bcc1369ed70597ea2538a85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoFix mdsal-binding-test-model maven warning
Robert Varga [Tue, 26 Apr 2022 12:57:19 +0000 (14:57 +0200)]
Fix mdsal-binding-test-model maven warning

We are using two dependencies without declaring them, fix that up.

Change-Id: Ifd71d0b5c7768107e004d3c851369d404fc8cbba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoSeal BaseNotification
Robert Varga [Mon, 25 Apr 2022 19:26:06 +0000 (21:26 +0200)]
Seal BaseNotification

BaseNotification should never be used directly, only through
Notification and InstanceNotification.

Change-Id: Ib3fd70aeb364523d7f630eb6e882f2308e427884
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoPick up odlparent/yangtools snapshots
Robert Varga [Mon, 25 Apr 2022 19:09:37 +0000 (21:09 +0200)]
Pick up odlparent/yangtools snapshots

Use snapshots for upstreams in order to get updates and JDK17 support.

Change-Id: Ie9dc7e34084b86cbb7e1c931ca884458d92c185c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoConvert mdsal-binding-dom-codec-osgi to a JPMS module
Robert Varga [Wed, 20 Apr 2022 05:13:58 +0000 (07:13 +0200)]
Convert mdsal-binding-dom-codec-osgi to a JPMS module

This is a simple implementation, convert it to JPMS module, fixing up
warnings in the process of doing so.

JIRA: MDSAL-641
Change-Id: I03f71512580ae9c6b48d5acd0d0c6e77a02f3e82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
12 days agoConvert mdsal-binding-dom-codec to a JPMS module
tadei.bilan [Mon, 19 Jul 2021 14:19:52 +0000 (17:19 +0300)]
Convert mdsal-binding-dom-codec to a JPMS module

Convert mdsal-binding-dom-codec to a properly-injected JPMS module,
available through @Singleton, @Component and @MetaInfServices.

Also update NonCachingCodecTest to expose its mock fields and
UnionValueOptionContextTest to use test-model's classes.

This also necessitates relocating the loeader package, as otherwise
maven-javadoc-plugin ends up being confused passes down invalid
@packages to javadoc.

JIRA: MDSAL-641
Change-Id: I3cbe8da4fc4905a1246a5e94a7e208e1bccfa1d8
Signed-off-by: tadei.bilan <tadei.bilan@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>