mdsal.git
19 months agoBump upstreams 26/102926/2
Robert Varga [Fri, 28 Oct 2022 16:00:08 +0000 (18:00 +0200)]
Bump upstreams

Adopt the following:
- odlparent-10.0.4
- yangtools-8.0.8

Change-Id: I121a4c83392756ddbf4520e6de879e13ca1951f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
20 months agoPropagate status in identity classes 60/102360/1
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>
(cherry picked from commit 01ae8645476f3ba5d8bfc3fb4204b89acad2a037)

21 months agoBump xtend to 2.28.0 23/102323/1
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>
(cherry picked from commit 5ae00dc2578b4ebf7b08421cacfcc9173adea561)

21 months agoDeprecate RpcServiceInvoker.from(Class) 46/102246/1
Robert Varga [Tue, 26 Apr 2022 16:10:52 +0000 (18:10 +0200)]
Deprecate RpcServiceInvoker.from(Class)

Invokers are considered an implementation detail and this particular
method is not used anywhere except tests. Schedule it for removal along
with ClassBasedRpcServiceInvoker it uses.

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

21 months agoBump versions to 9.0.6-SNAPSHOT 83/102183/1
Robert Varga [Sat, 20 Aug 2022 13:47:12 +0000 (15:47 +0200)]
Bump versions to 9.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I3d953b58d56bf6fe3e3be290441a72ced6fc4460
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoFix raw type warnings 80/102180/1
Robert Varga [Mon, 11 Jul 2022 21:04:53 +0000 (23:04 +0200)]
Fix raw type warnings

CompoentFactory should use a proper type, fix that.

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

21 months agoBump byte-buddy to 2.12.13 79/102179/1
Robert Varga [Sat, 20 Aug 2022 01:11:01 +0000 (03:11 +0200)]
Bump byte-buddy to 2.12.13

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.9
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.10
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.11
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.12
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.13

Change-Id: I08268857938cf7f732662c0e41c4fb7e8a5ba996
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
21 months agoShare AbstractExplicitGenerator.runtimeJavaType() 78/102178/1
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>
(cherry picked from commit 6c92275ae2b3c6ce597c0c0f7a915ec911aacf21)

21 months agoFix raw type warnings in OSGiBindingRuntime 77/102177/1
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>
(cherry picked from commit 28e50ae99ae0ee547afa0c72161bc891935d337b)

21 months agoUse contructor injection in OSGiModelRuntime 76/102176/1
Robert Varga [Tue, 16 Aug 2022 10:06:57 +0000 (12:06 +0200)]
Use contructor injection in OSGiModelRuntime

Remove unneeded indirection through fields, so that the lifecycle is a
tad more crisp.

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

21 months agoBump upstreams 75/102175/1
Robert Varga [Sat, 20 Aug 2022 00:09:20 +0000 (02:09 +0200)]
Bump upstreams

Adopt
- odlparent-10.0.3
- mdsal-8.0.7

Change-Id: I672b0df88b738383762067c30d049b038b0394e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
23 months agoFixup dependency 80/101580/1
Robert Varga [Mon, 13 Jun 2022 12:10:16 +0000 (14:10 +0200)]
Fixup dependency

We are missing annotation-api for docs, fix that up.

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

23 months agoRemove unused dependencies 78/101578/1
Robert Varga [Mon, 13 Jun 2022 11:00:33 +0000 (13:00 +0200)]
Remove unused dependencies

We no longer access maven APIs directly, remove now-unused dependencies.

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

2 years agoFix checkState() argument 64/101164/1
Robert Varga [Wed, 8 Jun 2022 09:27:29 +0000 (11:27 +0200)]
Fix checkState() argument

Use %s instead of {}.

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

2 years agoBump versions to 9.0.5-SNAPSHOT 99/101299/1
Robert Varga [Wed, 25 May 2022 18:17:43 +0000 (20:17 +0200)]
Bump versions to 9.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: Ic862725ea2705a41c04b868d1862646ff1eb52e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump yangtools to 8.0.6 95/101295/1
Robert Varga [Wed, 25 May 2022 15:09:21 +0000 (17:09 +0200)]
Bump yangtools to 8.0.6

Pick up latest fixes from upstream.

Change-Id: I96c23c1ecb5eea262b0ac0182c1d4ae2c8529ea9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump versions to 9.0.4-SNAPSHOT 72/101072/1
Robert Varga [Wed, 11 May 2022 12:03:41 +0000 (14:03 +0200)]
Bump versions to 9.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I35c9b18122eeae06256b7de015aab6d67f8ad434
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump yangtools to 8.0.5 62/101062/1
Robert Varga [Wed, 11 May 2022 11:15:25 +0000 (13:15 +0200)]
Bump yangtools to 8.0.5

Pick up latest fixes from upstream.

Change-Id: I8a9b1efd1b84cecc7ea4024014d26d327ba0c4e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImport exception references 48/101048/2
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>
(cherry picked from commit 4c2990d640ee5cd0811e1c7af6f2664822f95cb8)

2 years agoGenerate documentation for builder getters 47/101047/2
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>
(cherry picked from commit 0a6a2b40e92438ca06e73dfd5ffedb733267a9aa)

2 years agoGenerate javadoc for builder setters 46/101046/2
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>
(cherry picked from commit 4de1992fd1e85b2216987cdc47fbaf52088b2d9f)

2 years agoDocument Builder.augmentation() 45/101045/2
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>
(cherry picked from commit 938a70d61dc8948d65e8c7ca64ffcbf4e6162b68)

2 years agoAnnotate non-null build() return 44/101044/2
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>
(cherry picked from commit 0332f7640cec96bd372c9f2e1769485f8bdf9899)

2 years agoUse Map.of() instead of Collections.emptyMap() in builders 43/101043/2
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>
(cherry picked from commit 2789476b592b0df9eab7b83f3a9d2a2b9cd60099)

2 years agoFix a minor typo 42/101042/1
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>
(cherry picked from commit d49eb84dc5c7ec6201660fa899b79c564242d275)

2 years agoDocument builder constructors 41/101041/1
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>
(cherry picked from commit 11fa023df13dfc3b4cd368e71146319cc0368c82)

2 years agoImprove Builder's fieldsFrom() javadoc 40/101040/1
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>
(cherry picked from commit 02d20c1c5ae09f79dd6f20d650888679b127a243)

2 years agoDocument QNAME constant 39/101039/1
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>
(cherry picked from commit d396ffad163ba838868eb19803f388e3adfc74db)

2 years agoDocument YangModuleInfo(Provider) 38/101038/1
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>
(cherry picked from commit 49c4ce7520f9870ad0aecbafd73aa94e4521af3f)

2 years agoBump upstreams 24/101024/5
Robert Varga [Tue, 10 May 2022 04:47:57 +0000 (06:47 +0200)]
Bump upstreams

Adopt:
- odlparent-10.0.2
- yangtools-8.0.4

Change-Id: I0df79b6e2ce2715b2d756c49c4b0f416174f482f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix checkstyle 33/101033/1
Robert Varga [Mon, 25 Apr 2022 19:11:44 +0000 (21:11 +0200)]
Fix checkstyle

Updated checkstyle is finding a few violations, fix them up.

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

2 years agoFix lead transaction cancellation 30/101030/3
Robert Varga [Thu, 28 Apr 2022 16:08:23 +0000 (18:08 +0200)]
Fix lead transaction cancellation

We have a thinko around recording frontend transaction, which leads
to us always cancelling the entire chain. This is not correct, as
evidenced by existing tests.

Correct the book keeping and refactor cancelTransaction() to allow
returning correct result of operation and handle the case where backend
refuses to cancel.

JIRA: MDSAL-756
Change-Id: I553e4de2d09acedf67af63bc292fae0bb5dfed78
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit e781d0af7effb145dc69163744d1a7f02c200d8e)

2 years agoUse Map.entry() in PingPongTransactionChain 29/101029/3
Robert Varga [Thu, 28 Apr 2022 15:38:41 +0000 (17:38 +0200)]
Use Map.entry() in PingPongTransactionChain

Map.entry() is potentially more efficient, use that instead of a
SimpleImmutableEntry.

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

2 years agoUse VarHandles in PingPongTransactionChain 28/101028/3
Robert Varga [Thu, 28 Apr 2022 07:25:39 +0000 (09:25 +0200)]
Use VarHandles in PingPongTransactionChain

Most of our accesses are compareAndSwap() so we do not benefit all
that much from ARFU type safety. Switch to using VarHandles to access
our atomic fields. Provide an acquireReadyTx() to deal with the few
call sites which would require explicit cast due to using getAndSet().

VarHandles allow us to use compareAndExchange(), which exposes the
witness value -- hence our error paths report the correct object without
a possibility of a race.

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

2 years agoReduce volatile variable access 27/101027/3
Robert Varga [Thu, 28 Apr 2022 08:06:34 +0000 (10:06 +0200)]
Reduce volatile variable access

The checkState() and verify() calls are costing us a superfluous
access after we have already accessed the volatile field. Refactor
them to prevent that.

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

2 years agoFix a nullability warning in PingPongTransactionChain 26/101026/3
Robert Varga [Thu, 28 Apr 2022 07:54:33 +0000 (09:54 +0200)]
Fix a nullability warning in PingPongTransactionChain

Eclipse is flagging multiple accessed to the same field. The field
cannot move on us, but use a local variable to make the value invariant.

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

2 years agoUse 'var' for augmentation variable 25/101025/3
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>
(cherry picked from commit a133b671c53ec3d5a6831f628940ec24e32ca734)

2 years agoFixup mdsal-binding-model-api module definition 00/100600/1
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>
(cherry picked from commit 1fb0ef088e1f0fad38c40bebfff520e10ca1a6f6)

2 years agoYet another fix for javadoc 93/100593/1
Robert Varga [Wed, 20 Apr 2022 09:02:02 +0000 (11:02 +0200)]
Yet another fix for javadoc

The method takes a long not an int, fix that up.

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

2 years agoFix InstanceNotificationPublishService javadoc 92/100592/1
Robert Varga [Wed, 20 Apr 2022 07:40:53 +0000 (09:40 +0200)]
Fix InstanceNotificationPublishService javadoc

We have bad references here, fix them up.

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

2 years agoSpecialize CompositeValueCodec 10/100610/3
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>
2 years agoRemove ValueTypeCodec 09/100609/2
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>
2 years agoSimplify CompositeValueCodec instantiation 87/100587/2
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>
2 years agoBump versions to 9.0.3-SNAPSHOT 73/100573/1
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>
2 years agoBump yangtools to 8.0.3 72/100572/1
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>
2 years agoSchemaUnawareCodec is AbstractIllegalArgumentCodec 41/100541/1
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>
2 years agoSwitch SchemaUnawareCodec to an abstract class 40/100540/1
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>
2 years agoDo not indirect UnionLoading through Callable 39/100539/1
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>
2 years agoRemove ReflectionBaseCodec 38/100538/1
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>
2 years agoDisconnect BitsCodec from ReflectionBasedCodec 37/100537/1
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>
2 years agoEliminate ValueTypeCodec.encapsulatedValueCodecFor() 36/100536/1
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>
2 years agoDisconnect EncapsulatedValueCodec from ReflectionBasedCodec 35/100535/2
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>
2 years agoEncapsulatedValueCodec does not use TypeDefinition 34/100534/1
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>
2 years agoPromote SchemaUnawareCodec to a top-level construct 33/100533/1
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>
2 years agoSplit STATIC_CODECS into per-type caches 32/100532/1
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>
2 years agoDisconnect IdentifiableItemCodec from IllegalArgumentCodec 30/100530/1
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>
2 years agoAdd InstanceNotification(Publish)ServiceAdapter 35/100435/10
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>
2 years agoRemove superfluous @NonNull 26/100526/1
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>
2 years agoRequire yang.binding 25/100525/1
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>
2 years agoCentralize MoreObjects import 88/100488/3
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>
2 years agoImport java.lang.reflect.Type 89/100489/1
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>
2 years agoRemove unused lines 87/100487/1
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>
2 years agoImport yang-binding 86/100486/1
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>
2 years agoSplit out isBitsType() 81/100481/1
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>
2 years agoFix Automatic-Module-Name declarations 34/100434/2
Robert Varga [Wed, 6 Apr 2022 14:57:27 +0000 (16:57 +0200)]
Fix Automatic-Module-Name declarations

The declaration should be in <instructions/>, otherwise it is not
effective.

Change-Id: I82aeeaf9c68791ea171853f238afc6a9bafe9661
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoDrop a few FIXMEs into mdsal-binding-dom-adapter 33/100433/1
Robert Varga [Wed, 6 Apr 2022 14:36:45 +0000 (16:36 +0200)]
Drop a few FIXMEs into mdsal-binding-dom-adapter

We should have final classes and similar things.

Change-Id: Ie60973456464367db6396906fd079b76f5cfc3dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd InstanceNotificationService 23/86323/21
Robert Varga [Tue, 10 Dec 2019 10:38:57 +0000 (11:38 +0100)]
Add InstanceNotificationService

InstanceNotificationService provides access to YANG 1.1 nested
notifications, i.e. those defined in a container or a list.

JIRA: MDSAL-494
Change-Id: If308adb3a26964cea90456f8fb020b7364c937db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix javadoc compatibility 73/96873/8
Robert Varga [Mon, 12 Jul 2021 09:15:54 +0000 (11:15 +0200)]
Fix javadoc compatibility

JDK13+ is much stricter about what is considered valid Javadoc. Fixup
to make compilation pass on JDK17. This breaks linting on JDK11, hence
we also disable it for now.

Change-Id: I4ee650e13a135349c9522ad74fe098f088c09e5d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix RetryingManagedNewTransactionRunner javadoc 20/100420/1
Robert Varga [Tue, 5 Apr 2022 15:45:30 +0000 (17:45 +0200)]
Fix RetryingManagedNewTransactionRunner javadoc

JDK13+ requires H2, JDK11 does not care. Fix it up.

Change-Id: Id3898df1112797d8e026934fdc5cae20860871ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix NotificationService javadoc 19/100419/1
Robert Varga [Tue, 5 Apr 2022 15:33:09 +0000 (17:33 +0200)]
Fix NotificationService javadoc

We have an invalid @param here, fix that up.

Change-Id: I737c78114863ab5ca5f3a3485dd38fb6c441b3ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFixup BindingStreamEventWriter javadoc 18/100418/1
Robert Varga [Tue, 5 Apr 2022 15:31:10 +0000 (17:31 +0200)]
Fixup BindingStreamEventWriter javadoc

JDK17 is picky and the class documentation is a mess anyway. Fix it up.

Change-Id: If7e656b9f3336b9a0cffcc9f64c17eb9853fc919
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSuppress warning around pathArgument 17/100417/1
Robert Varga [Tue, 5 Apr 2022 15:05:15 +0000 (17:05 +0200)]
Suppress warning around pathArgument

For some strange reason SE_BAD_FIELD is triggered with JDK17. The
warning is a false positive, as we are handling serialization via
Externalizable proxy.

Change-Id: I4035194852f6b0a914d76929124d92ca8d3039fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd DOMInstanceNotificationService 28/98528/9
Robert Varga [Mon, 15 Nov 2021 08:03:27 +0000 (09:03 +0100)]
Add DOMInstanceNotificationService

DOMNotificationService provides a means to subscribe to top-level
notifications, as defined by YANG 1.0. RFC7950 (YANG 1.1) extended
this construct with the notion that notifications can be bound to
a datastore instance.

Define a set of DOMInstanceNotification* interfaces which cover provide
a conterpart to DOMNotification* interfaces and cover the extensions
introduced in YANG 1.1.

JIRA: MDSAL-494
Change-Id: I610f761bfcb9fb292709dd12618ec5bcb9b843c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix a few javadoc warnings 55/100355/2
Robert Varga [Fri, 1 Apr 2022 17:31:49 +0000 (19:31 +0200)]
Fix a few javadoc warnings

JDK17 is quite picky about these, fix them up.

Change-Id: Id24515f036ec89f24bfb5027ad5d17c37f4b8fa5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoInject RPC input QName into LazySerializedContainerNode 82/100282/9
Dominik Vrbovsky [Wed, 30 Mar 2022 17:53:53 +0000 (19:53 +0200)]
Inject RPC input QName into LazySerializedContainerNode

When ExecuteRpc message is sent with LazySerializedContainerNode
as 'input' parameter, during serialization is invoked its
getIdentifier() method that returns NodeIdentfier of rpc,
not input. So OpsInvoker receives the message with incorrect 'input'
parameter and  we get error downstream because of it.

We need to inject rpc input Qname into LazySerializedContainerNode
to get NodeIdentifier of rpc input from getIdentifier() method. While we
are at it, let's pass a NodeIdentifier, which saves us the cost of
NodeIdentifier.create() in the fast path.

JIRA: MDSAL-739
Change-Id: I77c870fe91a758037bd27e54607e778255d611fc
Signed-off-by: Dominik Vrbovsky <dominik.vrbovsky@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix union stringValue() with Decimal64 09/100309/4
Robert Varga [Thu, 31 Mar 2022 20:25:15 +0000 (22:25 +0200)]
Fix union stringValue() with Decimal64

UnionTemplate still things decimal64 maps to java.math.BigInteger,
resulting in string conversion which does not compile. Fix the template
to recognize Decimal64 as a proper CanonicalValue.

JIRA: MDSAL-738
Change-Id: I0f161b62887f4aea6e0c625d105e48a20c8dc048
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix a typo in UnionTemplate 14/100314/1
Robert Varga [Fri, 1 Apr 2022 08:45:57 +0000 (10:45 +0200)]
Fix a typo in UnionTemplate

We have an extra empty line and mis-spelled 'assigned'.

Change-Id: I058213a3408780ea13249679c0cca4ba21e8a9e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump versions to 9.0.2-SNAPSHOT 56/100256/1
Robert Varga [Fri, 25 Mar 2022 13:40:17 +0000 (14:40 +0100)]
Bump versions to 9.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: I93eac4d2cf3607265434359543ba5d8808815446
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAdd YANG Module Tags models 54/100254/1
Robert Varga [Fri, 25 Mar 2022 09:25:08 +0000 (10:25 +0100)]
Add YANG Module Tags models

Add modules from RFC8819.

JIRA: MDSAL-684
Change-Id: Idb8a1e925a6062598dcd5b1ef06e6a6e39ed808e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump yangtools to 8.0.2 45/100245/1
Robert Varga [Thu, 24 Mar 2022 15:42:10 +0000 (16:42 +0100)]
Bump yangtools to 8.0.2

Pick up bugfixes and features from upstream.

Change-Id: I714d308d6a602c075aa59000650296d8b5cfd2d2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump versions to 9.0.1-SNAPSHOT 53/100153/2
Robert Varga [Sat, 19 Mar 2022 12:38:01 +0000 (13:38 +0100)]
Bump versions to 9.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: I7fed52e8ddd7348e1e0aac90e2af7ac792ca5226
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoIgnore empty augmentations at runtime 56/100156/1
Robert Varga [Sun, 20 Mar 2022 11:11:34 +0000 (12:11 +0100)]
Ignore empty augmentations at runtime

We may end up generating an augmentation for a semantically-empty
construct, which in turn will not have a valid AugmentationIdentifier.
Ignore sure augmentations in codec.

JIRA: MDSAL-735
Change-Id: Ibb279a6b554c49857d0ee2ae0108d4d424939d02
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUpdate mdsal-binding-dom-codec-api modele-info 52/100152/1
Robert Varga [Sat, 19 Mar 2022 10:43:38 +0000 (11:43 +0100)]
Update mdsal-binding-dom-codec-api modele-info

We are exposing yang.model.api to users, make sure we require it
transitively.

Change-Id: I97e28c4f080ca3e40869b532ad2cf9b6ff96d07f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoUse declared statements to resolve augments 51/100151/2
Robert Varga [Fri, 18 Mar 2022 18:37:28 +0000 (19:37 +0100)]
Use declared statements to resolve augments

When trying to map effective instantiated model back to our Generator
hierarchy we need to not get confused by namespaces. The simplest way
to do that is to pick out augmentations first -- as those are the only
ones what can actually differ in namespace. The rest can be taken care
of just based on localName, as we are dealing with
SchemaTreeEffectiveStatements.

In general we can make the connection by tracing back the path we have
taken towards the instantiation site when seeing an
AugmentEffectiveStatement and match it to the corresponding
AbstractAugmentGenerator. Normally we could do this via straight
comparison of AugmentEffectiveStatements, but unfortunately their
equality contract does not give us that.

The reason for that is that we reuse things across groupings, whereas
YANG parser creates separate instantiations -- hence this breaks down
with UsesAugmentGenerator. We deal with that by comparing the declared
view of the two statements -- and those are guaranteed to be unique.

JIRA: MDSAL-735
Change-Id: I4d8f0e50541b53620cc5b0a2170484e85e9cf717
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoOptimize AbstractCompositeRuntimeType storage 44/100144/4
Robert Varga [Thu, 17 Mar 2022 22:01:26 +0000 (23:01 +0100)]
Optimize AbstractCompositeRuntimeType storage

Storage on schema tree does not allow for duplicates. Rather than
allocating a full Map, let's use arrays and associated binary search.
This allows us to drop the storage requirements, especially for choices,
which would end up allocating an object to contain Map.values()
representation.

This results in O(log2(N)) lookups instead of O(1), plus some additional
code, but the lookups are one-off and so well worth the reduced
footprint. A further improvement is that we relax type safety down to
Object, which allows us to not allocate singleton arrays.

Change-Id: Ice6f07a7f853bd68c614a42eda6cc1d3fd2c184e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRework AugmentRuntimeType and Choice/Case linkage 22/100122/11
Robert Varga [Mon, 14 Mar 2022 19:36:49 +0000 (20:36 +0100)]
Rework AugmentRuntimeType and Choice/Case linkage

Augmentations and their interactions with runtime linkage are a strange
beast. Not through YANG semantics, which is very simple. The
complication is Binding Specification reusing statement interfaces
across 'grouping'/'uses' boundaries. This poses distinct challenges as
for a particular GeneratedType we may have multiple augmentations,
which:
- may be completely unrelated. Binding Spec does not provide its usual
  compile-time safety guarantees because it basically says transporting
  anything across grouping boundaries is mostly okay as long as you
  augment all instantiations of the grouping the same way. That is a
  very sensible trade-off, as it allows, for example, no-frills movement
  of data from RPC 'input'/'output' and 'notification' structures to
  and from the datastore. More importantly it allows transportation
  across datastore subtrees, which enables very easy derivation
  pipelines
- but they have to obey YANG namespacing rules, which means that when we
  are interfacing towards yang.data.api (or any YANG-conforming
  projection), we have to make sure the constructs are aligned and also
  perform automated repair & recovery based on Binding Spec assumptions.

Current code behaves incorrectly in this respect, as it does not perform
correct expanstion of 'uses/augments' in one part, and then considers
all augments in when trying to look up a statement -- easily wandering
off into augments which are not appropriate through the YANG scope.

Fix this by correctly tracking with augments are valid in a particular
scope and carefully resolving them.

As a further side-effect of this, the choice/case relationship is
reworked to prevent potential recursion problems and rather expose the
ambiguos linkages in BindingRuntimeTypes.

We also separate CompositeRuntimeType from AugmentableRuntimeType, so
there is a clear distinction which types can be targeted by Augmentable
interfaces and which cannot.

JIRA: MDSAL-731
Change-Id: I027bbfa4ea8315b11b9348f5e0928626de3103a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRemove AbstractExplicitGenerator.recursiveRuntimeType() 11/100111/3
Robert Varga [Sun, 13 Mar 2022 23:05:02 +0000 (00:05 +0100)]
Remove AbstractExplicitGenerator.recursiveRuntimeType()

A potential identified in the bug report is repetitive creation
of the same runtime type, when it clearly should be reused.
Make sure we recognize when we are dealing with the same statement
and eliminate one Optional.map() indirection.

JIRA: MDSAL-735
Change-Id: Iaa97a04f58465b302666ca082a887fde9616282a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImprove Decimal64 range support 14/100114/1
Robert Varga [Sun, 13 Mar 2022 23:55:26 +0000 (00:55 +0100)]
Improve Decimal64 range support

We have classImporter available during generation, hence we can neatly
import Decimal64, reducing boiler plate in range and value declarations.

Decimal64 also exposes a fast instantiation type with scale and unscaled
value -- use those instead of parsing strings.

Change-Id: Ieba07af36fa3d03e20fda0c65754ec2dbfeee451
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoBump yangtools to 8.0.1 06/100106/5
Robert Varga [Sun, 13 Mar 2022 15:19:47 +0000 (16:19 +0100)]
Bump yangtools to 8.0.1

There is a YANGTOOLS release for the snapshots we are using, adopt it
in preparation for our release.

Change-Id: I81cc41ed615541c44efc256290167518d89b16a4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoCorrect ActionService generics 43/99943/2
Robert Varga [Thu, 3 Mar 2022 08:49:24 +0000 (09:49 +0100)]
Correct ActionService generics

We need to allow for any Action, even for KeyedListAction. Make sure to
adjust generics accordingly and add a test.

JIRA: MDSAL-726
Change-Id: I04c8fdf1c8803647c8640bbdd10c19304336b915
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoSplit out BindingDataObjectCodecTreeNode.streamChild() 93/100093/3
Robert Varga [Sat, 12 Mar 2022 13:17:40 +0000 (14:17 +0100)]
Split out BindingDataObjectCodecTreeNode.streamChild()

BindingCodecTree does not have a way of entering the tree without
specifying an InstanceIdentifier construct. This is a mistake, as we
need more powerful addressing capabilities to be able to deal with
Notifications and other constructs.

SchemaRootCodecContext is then taught to handle Notifications specially,
now that they cannot legally come from InstanceIdentifier.

JIRA: MDSAL-730
Change-Id: I970cab36d2794472ef801cd0e0d67c264bd169f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoRefactor InstanceIdentifier.create(Iterable) 92/100092/1
Robert Varga [Sat, 12 Mar 2022 12:41:25 +0000 (13:41 +0100)]
Refactor InstanceIdentifier.create(Iterable)

This method is for things like binding/dom codec and similar users who
know what they are doing. Rename the method to 'unsafeOf()', so that the
compilation failures from the change in InstanceIdentifier.create(Class)'s
signature do not produce confusing guidance by pointing to this arcane
method.

Also document this method's purpose, with significant warning and update
it to take a List.

JIRA: MDSAL-730
Change-Id: I9def3750f16d87c11d12809e0f067daf0bf352b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoFix identityref wildcards 85/100085/7
Robert Varga [Fri, 11 Mar 2022 19:09:22 +0000 (20:09 +0100)]
Fix identityref wildcards

Identityref use Class<? extends Target> for their return types, hence
we mask unmask the ParameterizedType to Target's JavaTypeName.

JIRA: MDSAL-732
Change-Id: I96fd0ffcffcd65aa7c658ab9d881a950ba41c6cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImprove CodeHelpers coverage 90/100090/1
Robert Varga [Sat, 12 Mar 2022 07:25:59 +0000 (08:25 +0100)]
Improve CodeHelpers coverage

We have introduced a new helper, make sure it is covered by UT.

JIRA: MDSAL-722
Change-Id: I5b949c5aac60cf1b90ba98b38afdce09dd08fff4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoReuse ownGetterType 86/100086/2
Robert Varga [Sat, 12 Mar 2022 01:30:15 +0000 (02:30 +0100)]
Reuse ownGetterType

There is no point in acquiring the type again, just use the local
variable.

Change-Id: If6ea83c6a0e4c0af4f4966a85abf9eff765abf18
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoInclude namespace manipulations in error report 88/100088/1
Robert Varga [Sat, 12 Mar 2022 03:41:11 +0000 (04:41 +0100)]
Include namespace manipulations in error report

We need squashing information to make sense of what the requirement
is attempting to do, include it in toString().

Change-Id: Ieeb913680990acb5ccd8690b28c55e4a72f5836e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoEnforce InstanceIdentifier creation 63/100063/6
Robert Varga [Fri, 11 Mar 2022 06:48:14 +0000 (07:48 +0100)]
Enforce InstanceIdentifier creation

We currently allow an InstanceIdentifier to be created for any
DataObject, which is wrong, as that includes raw RpcInputs,
Notifications and the like.

Update create() method to require proper relationship with DataRoot
instances. Alternatives can be worked through instantiating a proper
builder.

Also enforce individual items to always have the proper type.

JIRA: MDSAL-370
Change-Id: I38e83760c0ec29613a9ded24c0783bef940c9b7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoModernize ExceptionReportingTest 64/100064/2
Robert Varga [Fri, 11 Mar 2022 08:05:22 +0000 (09:05 +0100)]
Modernize ExceptionReportingTest

Use assertThrows() instead of @Test(expected = ) and make sure we
do not perform active operations during class init.

Change-Id: I54b54ebe1f98d632878c9359e7dc42aa1d44d803
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoImprove internal cast 62/100062/1
Robert Varga [Fri, 11 Mar 2022 06:39:17 +0000 (07:39 +0100)]
Improve internal cast

Checking for ImmutableCollection before going to Iterable is not quite
obvious, use a cast to ImmutableCollection.

Change-Id: I3e06a81126ed24310f78e2dc97ceab23be537141
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 years agoAlways generate DataRoot interface 25/100025/2
Robert Varga [Wed, 9 Mar 2022 15:17:45 +0000 (16:17 +0100)]
Always generate DataRoot interface

Having a reliable top-level interface is quite convenient for reasoning
about the modules generated. It also allows us to make further
assumption that a ModuleRuntimeType is always present, simplifying
things at runtime.

JIRA: MDSAL-729
Change-Id: Ia83e1910f80abb82ed32760afbd083b414033eb2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>