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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Robert Varga [Mon, 18 Apr 2022 17:48:21 +0000 (19:48 +0200)]
Add odl-mdsal-bytebuddy
Rather than shading byte-buddy, provide it in a separate feature.
This will allow packagers better control of the runtime we link to
and allow it to be reused.
JIRA: MDSAL-747
Change-Id: Id25acfdb24cce9ce2529b0ac8706b8f00671ed7b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 14 Mar 2022 09:31:49 +0000 (10:31 +0100)]
Map identities to proper objects
Change the binding type mapping from Class<? extends BaseIdetity>
to proper objects. While this imposes some runtime footprint in terms of
loaded classes (there is an anonymous implementation of each identity)
and objects (that implementation is an eager singleton), it removes a
metric ton of irregularities. This this change, all mapped objects
objects can be checked via 'instanceof' and most of them have
implementedInterface() for exact contract matches.
JIRA: MDSAL-733
Change-Id: Iab7dfb7656db87850613f567dfe40ef31494f6c4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 14 Apr 2022 20:00:51 +0000 (22:00 +0200)]
Use StringBuilder fluently
This is just a bunch of appends, use the return value to chain them.
Change-Id: I7db1a134387ae6ac0b756886d06264cbb8ffa43b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 8 Apr 2022 21:00:37 +0000 (23:00 +0200)]
Do not generate union builders
Union builds are not referenced by generated code anymore and have a
number of issues which need to be addressed separately. Just do not
generate them at all, pending a proper factory replacement.
JIRA: MDSAL-49
Change-Id: I6b769ca4d82da16b9f48720e8a17d7c4e1b4e8ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 14 Apr 2022 12:34:13 +0000 (14:34 +0200)]
Bump versions to 10.0.0-SNAPSHOT
This starts the next major development iteration.
Change-Id: Id30b892ae437fc78f930b372ddf69c85d8724f05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 14 Apr 2022 11:34:59 +0000 (13:34 +0200)]
Specialize CompositeValueCodec
We have only two codec interactions, both of which have dom-codec-api
not tied to IllegalArgumentCodec. Specialize the class and use our codec
API.
JIRA: MDSAL-704
Change-Id: Ic4b219f3e328fe3244811a57037fe1d1780e141f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 14 Apr 2022 11:15:20 +0000 (13:15 +0200)]
Remove ValueTypeCodec
CompositeValueCodec is null-hostile, hence it can directly subclass
AbstractIllegalArgumentCodec. This leaves UnionTypeCodec as the only
ValueTypeCodec -- hence we can remove the indirection, making the type
hierachy crisper.
JIRA: MDSAL-704
Change-Id: I7661263f5dd7684cebcff7af82d76a1fe0d9b1eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 14 Apr 2022 10:51:11 +0000 (12:51 +0200)]
Simplify CompositeValueCodec instantiation
We have some long-winded instantiation here, which amounts to getting an
EncapsulatedValueCodec. Specialize two constructors for
identityref/instance-identifier to make things a bit more clear and
direct.
JIRA: MDSAL-704
Change-Id: I766d4437ff51a8c32c872f6a3bfe66aec68caa14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 14 Apr 2022 06:54:11 +0000 (08:54 +0200)]
Bump versions to 9.0.3-SNAPSHOT
This starts the next development iteration.
Change-Id: I84fc11be536df45edcc531964969ce0bc202e212
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 14 Apr 2022 06:53:33 +0000 (08:53 +0200)]
Bump yangtools to 8.0.3
Pick up fixes from upstream.
Change-Id: I1bb83612ef0c9ad474c2ec4e893c90e2455d62dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 12 Apr 2022 09:45:28 +0000 (11:45 +0200)]
SchemaUnawareCodec is AbstractIllegalArgumentCodec
AbstractIllegalArgumentCodec is null-hostile, just as really all
SchemaUnawareCodecs are. Express this in a the type hierarchy,
coalescing things to a place where we can do a like-for like
replacement.
JIRA: MDSAL-704
Change-Id: I44cc2a0d0e5abcb7ea696eeba65dfe892c5daafb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 12 Apr 2022 09:32:00 +0000 (11:32 +0200)]
Switch SchemaUnawareCodec to an abstract class
We have four implementations here, three of which are indirected via
ValueTypeCodec. Switch the type hierarchy a bit, which leaves only
two codecs still using ValueTypeCodec.
JIRA: MDSAL-704
Change-Id: I4c92f15f7de2678a51792e60431947e4c6acbd6f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 11 Apr 2022 17:58:59 +0000 (19:58 +0200)]
Do not indirect UnionLoading through Callable
Let's just declare Exception to be thrown, forcing the caller to deal
with it -- which it already does.
JIRA: MDSAL-704
Change-Id: I21e26b4f40814bb62a03b5e4a46eed3c29f27882
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 11 Apr 2022 15:06:18 +0000 (17:06 +0200)]
Remove ReflectionBaseCodec
This base class has no real function, remove it.
JIRA: MDSAL-704
Change-Id: I1c79e861bc55133ed16745d4744b29588326eee5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 11 Apr 2022 14:51:01 +0000 (16:51 +0200)]
Disconnect BitsCodec from ReflectionBasedCodec
There is just no need to retain the target class here, as we'll never
access it.
JIRA: MDSAL-704
Change-Id: I1d01af3a16d2a4de5d8bd899428960875280493a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 11 Apr 2022 14:29:53 +0000 (16:29 +0200)]
Eliminate ValueTypeCodec.encapsulatedValueCodecFor()
There are only two call sites in the same method, inline it and remove
the unnecessary indirection through ValueTypeCodec -- which any reason
for existence except binding IllegalArgumentCodec vtable.
JIRA: MDSAL-704
Change-Id: I11cd0b4f08a1cb8dacd1f66fec9070102ba47889
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 11 Apr 2022 14:23:18 +0000 (16:23 +0200)]
Disconnect EncapsulatedValueCodec from ReflectionBasedCodec
While are not looking at the class after we have created our
MethodHandles, hence retaining the Class reference and the baggage
from ReflectionBasedCodec is completely unnecessary. This also
simplifies the class hierarchy a bit.
JIRA: MDSAL-704
Change-Id: Ifc0a9d98d892ab6fa72fd8c91ee3d4a61b1740a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 11 Apr 2022 14:18:06 +0000 (16:18 +0200)]
EncapsulatedValueCodec does not use TypeDefinition
The class does not use the definition at all, hence we can neatly
switch to using a LoadingCache, making things a lot clearer.
JIRA: MDSAL-704
Change-Id: I6563e7f97c168fc9a06bcddc0668060104ea0f0a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 11 Apr 2022 14:09:15 +0000 (16:09 +0200)]
Promote SchemaUnawareCodec to a top-level construct
The encapsulation in ValueTypeCodec seems to be rather unfortunate,
as it is obscuring what codec classes there are.
Change-Id: I25a3cf02b952da9293ad6c4937646c3198fbd6e6
JIRA: MDSAL-704
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 11 Apr 2022 13:57:28 +0000 (15:57 +0200)]
Split STATIC_CODECS into per-type caches
We have a rather sorry tangle of call sites due to the fact we one
instance of a cache with multiple loaders. Split the cache up separately
for each type, co-locating the cache and the loader. This makes it a tad
clearer as to what the type hierarchy looks like: ValueTypeCodec really
is just a useless holder.
JIRA: MDSAL-704
Change-Id: Ia334d373090a119297e7b9c92bccb166e80bcac6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 11 Apr 2022 11:57:24 +0000 (13:57 +0200)]
Disconnect IdentifiableItemCodec from IllegalArgumentCodec
IdentifiableItemCodec is only used by KeyedListNodeCodecContext
and it is used directly. Detach it from IllegalArgumentCodec, making
peeling off one possibility from the class tree.
JIRA: MDSAL-704
Change-Id: I25a818eabe80d5bb3f6b4ff2d152e7ca002a93a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 6 Apr 2022 14:58:07 +0000 (16:58 +0200)]
Add InstanceNotification(Publish)ServiceAdapter
Add the binding/dom adapter to route requests towards the DOM service.
This necessitates a bit of work on the codec side to allow generic
notification translation service.
JIRA: MDSAL-494
Change-Id: I6f98304aa475717ae4a0fb0e8fb2fb5b5a659336
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 10 Apr 2022 22:51:29 +0000 (00:51 +0200)]
Remove superfluous @NonNull
Nullness is specified by the contract, no need to repeat it.
Change-Id: I27d846125faea0b5cd083f342b61f269cefec257
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 10 Apr 2022 22:48:53 +0000 (00:48 +0200)]
Require yang.binding
We are referencing yang.binding constructs, make sure we require them
transitively.
Change-Id: I84ab5f4e585f469fea05fa91298a035921c79322
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 8 Apr 2022 14:31:57 +0000 (16:31 +0200)]
Centralize MoreObjects import
We are importing MoreObjects through Class, let's go through
JavaTypeName, centralized in JavaFileTemplate. Also use 'var' to elide
the need to refer to it twice.
Change-Id: Id7fa0625e8d939195654b710e5f9847303c33861
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 8 Apr 2022 15:05:15 +0000 (17:05 +0200)]
Import java.lang.reflect.Type
Simplify references to make things a tad easier.
Change-Id: I920b633b48b496156eaca2e90ed388adeba41d7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 8 Apr 2022 14:04:19 +0000 (16:04 +0200)]
Remove unused lines
We have commented-out imports and a superfluous empty line. Remove them.
Change-Id: I91b8dca0041b50baefa032ccff2e4d02a781605a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 8 Apr 2022 13:18:50 +0000 (15:18 +0200)]
Import yang-binding
We are referencing a number of constructs here, make sure we also
import the module.
Change-Id: I8b1823046c762e33cc99e1471ee5965ab57e233b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 8 Apr 2022 10:38:44 +0000 (12:38 +0200)]
Split out isBitsType()
Simplify dispatch of checking to a separate method.
Change-Id: I59e3baf22bf99ead66f43c7df0fd62ab2b030894
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>