yangtools.git
2 weeks agoSplit out isBitsType()
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 weeks agoFix Automatic-Module-Name declarations
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 weeks agoFixup BindingStreamEventWriter javadoc
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 weeks agoSuppress warning around pathArgument
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 weeks agoFix union stringValue() with Decimal64
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 weeks agoFix a typo in UnionTemplate
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 weeks agoBump versions to 9.0.2-SNAPSHOT
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 weeks agoBump yangtools to 8.0.2
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 weeks agoBump versions to 9.0.1-SNAPSHOT
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 weeks agoIgnore empty augmentations at runtime
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 weeks agoUpdate mdsal-binding-dom-codec-api modele-info
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 weeks agoUse declared statements to resolve augments
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 weeks agoOptimize AbstractCompositeRuntimeType storage
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 weeks agoRework AugmentRuntimeType and Choice/Case linkage
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 weeks agoRemove AbstractExplicitGenerator.recursiveRuntimeType()
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 weeks agoImprove Decimal64 range support
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 weeks agoBump yangtools to 8.0.1
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 weeks agoSplit out BindingDataObjectCodecTreeNode.streamChild()
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 weeks agoRefactor InstanceIdentifier.create(Iterable)
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 weeks agoFix identityref wildcards
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 weeks agoImprove CodeHelpers coverage
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 weeks agoReuse ownGetterType
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 weeks agoInclude namespace manipulations in error report
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 weeks agoEnforce InstanceIdentifier creation
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 weeks agoModernize ExceptionReportingTest
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 weeks agoImprove internal cast
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 weeks agoAlways generate DataRoot interface
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>
2 weeks agoFix StatementRepresentation javadoc
Robert Varga [Wed, 9 Mar 2022 04:53:17 +0000 (05:53 +0100)]
Fix StatementRepresentation javadoc

We have some outdated documentation, fix that up.

Change-Id: I305b58a92363830c473b1bb103dc1127de3bd3dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdopt odlparent-10.0.0/yangtools-8.0.0-SNAPSHOT
Robert Varga [Thu, 2 Sep 2021 19:23:37 +0000 (21:23 +0200)]
Adopt odlparent-10.0.0/yangtools-8.0.0-SNAPSHOT

Bump upstream versions to pick up dependency upgrades and major features
from yangtools. Also adjust code to package movements and fix test
models now that unique components are validated by YANG parser.

Change-Id: Id15dd16daea9fe80af030103069d999129b28cf6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRework BindingRuntimeTypes
Robert Varga [Fri, 29 Oct 2021 16:06:01 +0000 (18:06 +0200)]
Rework BindingRuntimeTypes

BindingRuntimeTypes serves to bring together GeneratedTypes and
SchemaNodes. We do this in a a number of different ways, but a lot of
the times this ends up looking a Type and then finding the SchemaNode
which generated it -- and then perhaps inquire children by SchemaNode
(which again is looked up in some way).

Once we have done these cross-lookups, we resolve the Type to a Class
through BindingRuntimeContext and instantiate a
DataContainerCodecPrototype, which holds these (and other) bits
together.

Current code relies on DerivableSchemaNode and SchemaNode-based lookups
to resolve these due to historical reasons. Our Generator infrastructure
already has AbstractExplicitGenerator.getOriginal() to perform the
equivalent operation.

This patch defines a RuntimeType base interface which holds together an
EffectiveStatement and a Generated type. We also define a
RuntimeTypeContainer to expose lookup methods for inquiring child
RuntimeTypes as appropriate.

BindingRuntimeTypes serves as the root of a tree hierarchy, where
RuntimeType is a leaf node and CompositeRuntimeType is an interior
node.

NodeCodecContext and its subclasses are modified to maintain a reference
to their backing RuntimeType and issue appropriate localized lookups.

JIRA: MDSAL-696
Change-Id: I45850d320e01fce0b227512b9f5f7b19331df60e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoDo not use BindingReflections to acquire augmentations
Robert Varga [Mon, 7 Mar 2022 17:38:37 +0000 (18:38 +0100)]
Do not use BindingReflections to acquire augmentations

Augmentable interface exposes augmentations directly, hence we
can use it directly, without relying on reflection.

Change-Id: I21b86d581ff0a61db3975cf7655157e4e6678b1b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoTrack schema tree generator linkage
Robert Varga [Fri, 18 Feb 2022 10:49:16 +0000 (11:49 +0100)]
Track schema tree generator linkage

Runtime information requires looking up target generator for a schema
tree particant, which means that AbstractCompositeGenerator needs to
resolve QName to the original instantiation.

We already have that mechanics for the most part, as we need to perform
the lookup to resolve augment statements target.

Introduce SchemaTree{Child,Parent} decomposition of the addressing
problem, and retrofit generators to support them. This will allow us to
support lookups along the schema tree axis.

JIRA: MDSAL-696
Change-Id: I619fe9e7c0896d6d3f0f33b04d5200ca8ec30340
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoImprove information provided on failed linkage progress
Robert Varga [Fri, 4 Mar 2022 18:53:05 +0000 (19:53 +0100)]
Improve information provided on failed linkage progress

Linkage algorithm seems to have a issue with a set of proprietary
models. Rather than throwing a simple exception, add debug logging
to track which items progress and report any remaining items as
suppressed exceptions.

Change-Id: Ia7f1efe498f1ac82de35facf0188d0a2972e2b09
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBindingRuntimeTypes should be an interface
Robert Varga [Fri, 25 Feb 2022 16:06:13 +0000 (17:06 +0100)]
BindingRuntimeTypes should be an interface

We do not want to expose the internals of how this interface is
realized, make sure we split it into an interface and an implementation.

JIRA: MDSAL-696
Change-Id: Icc01bc2c66cbf57c8cbb2ff9c32ac30c373b899d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoImprove OriginalLink safety
Robert Varga [Thu, 24 Feb 2022 07:17:11 +0000 (08:17 +0100)]
Improve OriginalLink safety

The links to previous and original statement need to match our
statement, otherwise we are in trouble. While we do not verify this
at runtime (yet), improve type definitions to carry these around.

JIRA: MDSAL-696
Change-Id: I3bcc1c3b0d2e3f74a0727f8bfa6b2f1e1c578f67
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove is{List,Map}Type(Type) methods
Robert Varga [Fri, 11 Feb 2022 18:45:12 +0000 (19:45 +0100)]
Remove is{List,Map}Type(Type) methods

These methods are not used anywhere anymore remove them.

Change-Id: I993a2baf48b2603f28559688a907d1b7d7780307
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMap system-ordered leaf-lists to Set<T>
Robert Varga [Fri, 11 Feb 2022 16:35:19 +0000 (17:35 +0100)]
Map system-ordered leaf-lists to Set<T>

System-ordered leaf-lists can get re-ordered and hence the binding
mapping to java.util.List is not appropriate. Make sure we map them
to java.util.Set.

JIRA: MDSAL-722
Change-Id: I4c82736b3ef25fd1197c446aca2c9d22a59a3d96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix an eclipse warning
Robert Varga [Thu, 3 Feb 2022 15:09:32 +0000 (16:09 +0100)]
Fix an eclipse warning

<T extends Optional<?>> is not liked because of Optional being final.
Fix the warning by changing the prototype a bit.

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

2 weeks agoImprove DtaContainerCodecProtype.loadInstance()
Robert Varga [Wed, 23 Feb 2022 13:04:54 +0000 (14:04 +0100)]
Improve DtaContainerCodecProtype.loadInstance()

We have a warning creeping here, fix it.

Change-Id: I94249f7cdc8f5fabdeee44084aaf0c325d62eb61
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoHide TypeBuilderFactory subclasses
Robert Varga [Wed, 23 Feb 2022 08:54:42 +0000 (09:54 +0100)]
Hide TypeBuilderFactory subclasses

TypeBuilderFactory subclasses are being checked for Codegen subclass,
so as to add (or not) documentation. Refactor addCodegenInformation()
by moving it to the factory, with Runtime ignoring doing nothing.

Change-Id: I724bd304de0ec1a51520e59e64b21d1060d7e013
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSeparate out notification handling
Robert Varga [Mon, 21 Feb 2022 13:34:38 +0000 (14:34 +0100)]
Separate out notification handling

This reverts another part of 073e62cf59225dbb11f80b50d59387f4830154b4
as well as 576ae2cd595f0ce17abd1f33150b068b7f0f801d, hence not allowing
Notifications to be entered through streamChild().

JIRA: MDSAL-724
Change-Id: I1b37139fcb8bd8aaf92465943a46e71069e87f3e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSeparate out RPC input/output codecs
Robert Varga [Tue, 22 Feb 2022 11:09:56 +0000 (12:09 +0100)]
Separate out RPC input/output codecs

This partially reverts 073e62cf59225dbb11f80b50d59387f4830154b4, as
leads to false sharing and corresponding problems with invalid
InstanceIdentifiers not being caught.

JIRA: MDSAL-724
Change-Id: I0ddf62efffb23e793b6727e0afcf50303f7aea74
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMark DataContainerCodecPrototype.isChoice() for removal
Robert Varga [Mon, 21 Feb 2022 17:04:44 +0000 (18:04 +0100)]
Mark DataContainerCodecPrototype.isChoice() for removal

This is an internal remnant from when we did not have a ChoiceIn
intermediate class. Mark it for removal.

JIRA: MDSAL-696
Change-Id: I50217ccfd6ff4c6c7db58e1085fa253779732e8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd negative tests for instance identifier codec
Robert Varga [Mon, 21 Feb 2022 13:03:13 +0000 (14:03 +0100)]
Add negative tests for instance identifier codec

We are about to refactor a few aspects of how things are being looked
up, make sure we cover cases which should be rejected.

JIRA: MDSAL-696
Change-Id: I8b0eddf05eadd4178951176480fa35b9753bc751
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove an unneeded line
Robert Varga [Sun, 20 Feb 2022 15:00:16 +0000 (16:00 +0100)]
Remove an unneeded line

We are at the end of the loop, no need for a continue statement.

Change-Id: I79478fcbda4820c3923fae39dfec5fe7c47a0e70
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd some Generator documentation
Robert Varga [Wed, 16 Feb 2022 18:23:22 +0000 (19:23 +0100)]
Add some Generator documentation

Add a bit of explanation on how the generator tree is organized and drop
a few FIXMEs for things we want to get rid of in the long term.

Change-Id: I7c7820aeadcce0e2a69ff3033d5c2efc75b2dda3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix uses/augment linkage
Robert Varga [Fri, 21 Jan 2022 06:10:37 +0000 (07:10 +0100)]
Fix uses/augment linkage

Our previous fix for MDSAL-715 switched the resolution logic to a unified
approach based on linked augmentation. Unfortunately it missed the fact
that linking the groupings also had the side-effect of setting the
augment target, which in turn populates 'augments' list.

Our failure to do so ends up wrecking lookups in the case where we have
an uses-augmented node further augmented by a module-augment.

Fix this by intertwining original and augment linkage, so that a subtree
root (such as module) pays attention to augments which need to resolve
before descending to recursive linkage.

JIRA: MDSAL-718
Change-Id: I7bd6cbed636267d35113888ddd35f0c6d9411043
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 7d9c7b3cfcf6bc62e2da8670e6faa607ed9050b6)

2 weeks agoBump yangtools to 7.0.14
Robert Varga [Sun, 13 Feb 2022 09:22:14 +0000 (10:22 +0100)]
Bump yangtools to 7.0.14

Pick up fixes from upstream.

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

2 weeks agoBump byte-buddy to 1.12.8
Robert Varga [Thu, 10 Feb 2022 23:26:22 +0000 (00:26 +0100)]
Bump byte-buddy to 1.12.8

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.2
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.3
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.4
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.5
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.6
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.7
https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.8

Change-Id: I660d0fff4a67b33202bdb70b56ee546d63ac15d3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoDo not allow wildcards in Action.invoke()
Robert Varga [Thu, 10 Feb 2022 09:32:22 +0000 (10:32 +0100)]
Do not allow wildcards in Action.invoke()

Wildcard invocations do not make sense, as they could match any number
of instances. Document such attempts as throwing IAE.

Change-Id: I23780fee31c2f6c60d883764c046703ee92687f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSimplify original tracking
Robert Varga [Sun, 30 Jan 2022 00:22:23 +0000 (01:22 +0100)]
Simplify original tracking

Rather that having a quad-state 'prev' field typed to Object, potentially
containing an OriginalLink, make its state logically tri-state typed
with AbstractExplicitGenerator. The resolved generator is then carried in
an explicit field.

JIRA: MDSAL-718
Change-Id: I357a1ad6037a9c5288bdf2ec84dd90882cbcf76a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 920cf1a12439db41aa42f6830d2c64767d1a1499)

2 weeks agoEnforce explicit generator linkage
Robert Varga [Fri, 28 Jan 2022 23:06:59 +0000 (00:06 +0100)]
Enforce explicit generator linkage

We are keeping the original pointer as a simple nullable field. This can
result in us confusing an unresolved generator with an original, leading
to potential badness.

Refactor the AbstractExplicitGenerator to track incremental resolution,
catching invalid accesses.

JIRA: MDSAL-718
Change-Id: Ie67fa4d08d0887f301948e3d03d846ed9ee1d628
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 681fe0e73028fd39ec844a83386b2eede2376b5f)

2 weeks agoImprove AugmentedTypeTest
Robert Varga [Sat, 29 Jan 2022 01:53:32 +0000 (02:53 +0100)]
Improve AugmentedTypeTest

Eclipse is warning of an always-false equality check in this test suite.
Fix this by performing a proper type comparison, eliminating use of
assertTrue().

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

2 weeks agoBump odlparent/yangtools to 9.0.13/7.0.13
Robert Varga [Wed, 26 Jan 2022 16:32:38 +0000 (17:32 +0100)]
Bump odlparent/yangtools to 9.0.13/7.0.13

Pick up latest fixes from upstream.

Change-Id: I4cd88e9d8371b8cd3f4cfdc4f004d93f0eb3cf3b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoGeneratorReactor.linkOriginalGenerator() should be stateless
Robert Varga [Tue, 25 Jan 2022 12:01:22 +0000 (13:01 +0100)]
GeneratorReactor.linkOriginalGenerator() should be stateless

linkOriginalGenerator() does not need to modify GeneratorReactor, make
it static, so that we can disconnect the state manipulation.

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

2 weeks agoRemove GeneratorReactor.leafGenerators
Robert Varga [Tue, 25 Jan 2022 11:49:48 +0000 (12:49 +0100)]
Remove GeneratorReactor.leafGenerators

This field is completely unused, remove it.

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

2 weeks agoImprove GeneratorReactor timing
Robert Varga [Mon, 24 Jan 2022 09:37:29 +0000 (10:37 +0100)]
Improve GeneratorReactor timing

Parts of generation are not covered by timer, make sure we measure the
entire execution.

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

2 weeks agoRemove remaining concepts.(Checked)Builder references
Ivan Hrasko [Tue, 30 Nov 2021 10:53:40 +0000 (11:53 +0100)]
Remove remaining concepts.(Checked)Builder references

To complete elimination of concepts.(Checked)Builder usage
we have to remove references from manually created Builder
classes and Types.java as well.

JIRA: MDSAL-690
Change-Id: I4a4129bf006d99cf430af6c4d08234208b6620d4
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoSimplify leaf access
Robert Varga [Wed, 12 Jan 2022 12:47:53 +0000 (13:47 +0100)]
Simplify leaf access

We do not need to go through the entryset -- just use Map.values(),
eliminating the need for one object indirection.

Change-Id: I5a5226d4b6b256d998e0a30de52bc89e01d1a16d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAlign argument names of getLeafNodes()
Robert Varga [Wed, 12 Jan 2022 11:58:04 +0000 (12:58 +0100)]
Align argument names of getLeafNodes()

Naming here is off: the class and schema do not correspond to each
other, but they are not in parent/child relationship, either.

Change-Id: I3f48ce0beaa446fcf4829fb3faaf24d075516ba2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoInline create{Notification,Rpc}DataContext()
Robert Varga [Wed, 12 Jan 2022 10:51:50 +0000 (11:51 +0100)]
Inline create{Notification,Rpc}DataContext()

We have two methods invoked only from caching loader, inline them,
so that we can eliminate some checks and make visibility obvious.

Change-Id: Id910192224e9a51217f70e125ed58daf08958ab1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoClarify BindingReflections.getChildrenClassToMethod()
Robert Varga [Wed, 12 Jan 2022 10:33:15 +0000 (11:33 +0100)]
Clarify BindingReflections.getChildrenClassToMethod()

Keys in the returned map are not any classes, but are guaranteed to be
DataContainers. Document that fact.

Change-Id: Ieac66637f9d5e6c2a9869304fd7a36b376ed5b05
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoReference SchemaContext.NAME directly
Robert Varga [Tue, 11 Jan 2022 14:33:16 +0000 (15:33 +0100)]
Reference SchemaContext.NAME directly

SchemaContext.getQName() is deprecated, reference the name directly.

Change-Id: Icb22924175667221144fae225296c1be3ea4c758
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix raw Notification warnings
Robert Varga [Tue, 11 Jan 2022 13:44:17 +0000 (14:44 +0100)]
Fix raw Notification warnings

binding.Notification now takes a generic argument, fix a round of raw
references.

Change-Id: I62eed2951a43367e06c69855aaa6a9e43df99392
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove concepts.Builder reference from Builders
Ivan Hrasko [Tue, 30 Nov 2021 10:38:17 +0000 (11:38 +0100)]
Remove concepts.Builder reference from Builders

In order to better localize callers of build() method, remove
reference to concepts.Builder from Xtend BuilderTemplate.

JIRA: MDSAL-690
Change-Id: I7f068fe2e99afd5bc39f187253d8e2917c2a6e75
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix DataObject builer javadoc references
Robert Varga [Mon, 10 Jan 2022 09:54:31 +0000 (10:54 +0100)]
Fix DataObject builer javadoc references

We have a few mis-references generated in documentation, fix them up.

Change-Id: I3040adeb6ec10ca46395212324df29dbe292a82d
Signed-off-by: Ivan Hrasko <ivan.hrasko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRefactor augment generator linkage
Robert Varga [Tue, 21 Dec 2021 13:22:03 +0000 (14:22 +0100)]
Refactor augment generator linkage

The uses/augment and module/augment cases are quite different from
the perspective how we map their argument reference to generators.

The uses/augment case is quite simple, as it refers to grouping's nodes,
not augmentations. The only variation we need to account for is the
skip back to the defining grouping.

The module/augment case, on the other hand, is more complex, as it can
refer to augmentations -- hence it need to account for changes namespace
changes along uses/grouping as well as back from grouping child to
augmentations.

JIRA: MDSAL-715
Change-Id: I7425301afa6de566d985d19450ccfc64ea527119
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse Empty.value() instead of Empty.getInstance()
Robert Varga [Mon, 22 Nov 2021 13:09:34 +0000 (14:09 +0100)]
Use Empty.value() instead of Empty.getInstance()

Empty..getInstance() is going away, do not generate references to it.

Change-Id: I9322032c8b4c6741d2608948fc98711f3ce2573c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump odlparent/yangtools to 9.0.9/7.0.10
Robert Varga [Sun, 19 Dec 2021 09:42:19 +0000 (10:42 +0100)]
Bump odlparent/yangtools to 9.0.9/7.0.10

Pick up latest fixes from upstream.

Change-Id: I90601e17bd7c2e502ad98077df6f52e401125f66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoDo no use reflection to obtain opaque value ctor
Robert Varga [Wed, 8 Dec 2021 16:03:25 +0000 (17:03 +0100)]
Do no use reflection to obtain opaque value ctor

We can do all the lookups and access via java.lang.invoke, let's
not bring java.lang.reflect to the party.

Change-Id: I7528a469270d384fbbbd9680cffe227129cf4d39
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse a shared type for Pattern
Robert Varga [Tue, 7 Dec 2021 15:37:05 +0000 (16:37 +0100)]
Use a shared type for Pattern

We are looking up the type here multiple times, which is not entirely
efficient. Add a constant to hold the type.

Change-Id: I5da339cd21c5944c13ed2eb66f15b9ae61d56b46
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse BindingTypes instead of rollin input/output types
Robert Varga [Tue, 7 Dec 2021 09:13:28 +0000 (10:13 +0100)]
Use BindingTypes instead of rollin input/output types

We have well-known constants covering ConcreteTypes for RpcInput and
RpcOutput. Use them directly, reducing startup time a bit.

Change-Id: I145c4de2db0d3769f6926200f8e8afe6461a445f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoVerify no schema/type overlap
Robert Varga [Fri, 3 Dec 2021 15:31:20 +0000 (16:31 +0100)]
Verify no schema/type overlap

We could end up overwriting previous Schema->Type mapping, let's make
sure we never do that, as that could end up in all sorts of disasters.

Change-Id: Ie4e1682af9c5d59e8ec70b263f0f239f69dd3603
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove BindingRuntimeContext.getActionIdentifier()
Robert Varga [Wed, 1 Dec 2021 14:37:00 +0000 (15:37 +0100)]
Remove BindingRuntimeContext.getActionIdentifier()

This method is left unused, remove it to prevent confusion to users.

JIRA: MDSAL-712
Change-Id: Ic924877f255dc9b2ccafaa64866deefd45a81f17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix action invocation and registration
Robert Varga [Thu, 25 Nov 2021 15:28:33 +0000 (16:28 +0100)]
Fix action invocation and registration

Binding actions involving groupings are a bit more complicated when it
comes to DOM mapping. An instantiated Action can correspond to any
number of ActionEffectiveStatements, but we skimped that over and used
the SchemaPath (and after that, an invalid SchemaNodeIdentifier) to
identify them.

Correct this by requiring users to provide an ActionSpec, which is a
combination of an Action interface and a corresponding instantiation
path.

JIRA: MDSAL-712
Change-Id: I632c0f51b2e71fa1b0a04e43d5b1c50286430b21
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoNarrow Notification.implementedInterface() return type
Robert Varga [Tue, 19 Oct 2021 11:59:00 +0000 (13:59 +0200)]
Narrow Notification.implementedInterface() return type

All Notification interfaces should provide their own identity here,
make sure there is no confusion about that.

Change-Id: I9fb7f82fcee7acd38aa05b38a2721ef62f8a1750
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 9.0.0-SNAPSHOT
Robert Varga [Sun, 14 Nov 2021 19:29:17 +0000 (20:29 +0100)]
Bump versions to 9.0.0-SNAPSHOT

This starts the next major development iteration.

Change-Id: I2e86b89f44c05f9b22bc6fa44bf7f3b983bc3f0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump byte-buddy to 1.12.1
Robert Varga [Sun, 7 Nov 2021 18:16:11 +0000 (19:16 +0100)]
Bump byte-buddy to 1.12.1

https://github.com/raphw/byte-buddy/releases/tag/byte-buddy-1.12.1
plus the preceding items.

Change-Id: Ie785b9e131369a35584f68a9c9b32ee536b5cead
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse Map.entry() in BindingCodecContext
Robert Varga [Fri, 29 Oct 2021 16:05:21 +0000 (18:05 +0200)]
Use Map.entry() in BindingCodecContext

We are not using nulls, let's use an immutable entry.

Change-Id: I1d2fdd64b8396f991a267c429cf5822d9ada5fa1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoImprove CompilationTestUtils
Robert Varga [Thu, 28 Oct 2021 15:53:16 +0000 (17:53 +0200)]
Improve CompilationTestUtils

We can perform better asserts, let's do that.

Change-Id: I671e1a0425d74b2f87a398102fba9cd890b9efc6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd missing requires on yang-common
Robert Varga [Thu, 28 Oct 2021 16:00:36 +0000 (18:00 +0200)]
Add missing requires on yang-common

We are referencing types from yang-common, make sure we require them
and not get them transitively.

Change-Id: Id93e890e3a303b4199e7ae2f2809e29b02f81b7a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 8.0.8-SNAPSHOT
Robert Varga [Tue, 26 Oct 2021 19:36:06 +0000 (21:36 +0200)]
Bump versions to 8.0.8-SNAPSHOT

This starts the next development iteration.

Change-Id: I55d485d6a4ad9de8147d2deee1ec56ca3f3b7e8c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup BindingTypesTest
Robert Varga [Fri, 22 Oct 2021 11:39:23 +0000 (13:39 +0200)]
Cleanup BindingTypesTest

Use assertThrows() instead of @Text(expected), not that it really
matters here.

Change-Id: I8c8ac3d0c5fc99eebaaaae9c5d0943244e9498f6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRequire checker.qual
Robert Varga [Fri, 22 Oct 2021 10:17:35 +0000 (12:17 +0200)]
Require checker.qual

We are using the annotations here, but do not pull in the corresponding
module. Fix that.

Change-Id: Idc25a01c5ba0068763f45f11ddcdfb75a1aae3ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump versions to 8.0.7-SNAPSHOT
Robert Varga [Wed, 20 Oct 2021 20:13:08 +0000 (22:13 +0200)]
Bump versions to 8.0.7-SNAPSHOT

This starts the next development iteration.

Change-Id: Idd52a361f4d44df5bc4cac63d6f6b2b98797d4b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoUse HierarchicalIdentifier
Robert Varga [Thu, 14 Oct 2021 18:29:19 +0000 (20:29 +0200)]
Use HierarchicalIdentifier

We have a number of identifiers which do not actually implement
Identifier concept but rather Path. We have a replacement for Path,
so let's use it, improving contracts the process of doing so.

Change-Id: Idf506084d1b67993f4a7d37efd23b5fca234375f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoBump odlparent/yangtools
Robert Varga [Wed, 20 Oct 2021 20:12:22 +0000 (22:12 +0200)]
Bump odlparent/yangtools

Adopt odlparent-9.0.7, yangtools-7.0.9.

Change-Id: I5bafc485191739b184a46c4a3db532a00b50b554
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup mdsal-binding-generator packaging
Robert Varga [Sat, 16 Oct 2021 15:09:23 +0000 (17:09 +0200)]
Cleanup mdsal-binding-generator packaging

We just ditched utilities depending on it, hence we do not need to
pull it anymore. Also adjust dependencies to silence warnings.

Change-Id: If09662e7a49d0df34aadf23a63193d48f3e75044
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove mdsal.binding.yang.types
Robert Varga [Sat, 16 Oct 2021 14:52:56 +0000 (16:52 +0200)]
Remove mdsal.binding.yang.types

This package is not exported by us and therefore not accessible by
anyone. We have just ditched its last user, ditch the package as well,
along with its test suite.

Change-Id: Ida72524105d0134395c06c48a994fc86893567d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMigrate ConfigTypeProvider tests
Robert Varga [Sat, 16 Oct 2021 13:16:03 +0000 (15:16 +0200)]
Migrate ConfigTypeProvider tests

There are a few remaining tests, migrate them and inhume
AbstractTypeProvider et al.

Change-Id: I1aa96547dfa67ef7dc48f8ef948656fab0405ca4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove a chunk of AbstractTypeProvider
Robert Varga [Sat, 16 Oct 2021 13:06:45 +0000 (15:06 +0200)]
Remove a chunk of AbstractTypeProvider

We now have no references to some of the code, remove it before
we proceed further. Also hide methods not called externally, so
they will be identified as unused.

Change-Id: I351355657eb8cd2e19c18d553c18a0590cef8a9d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoExpand DefaultBindingGeneratorTest
Robert Varga [Sat, 16 Oct 2021 13:00:05 +0000 (15:00 +0200)]
Expand DefaultBindingGeneratorTest

We have fixed the test model (as it was invalid). Add an explicit test
for the now-unresovled grouping leaf type and also restore the original
negative test.

Change-Id: I14c0d734ee8990f9ad9ac8f8c58f37cafae34990
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove RuntimeTypeProvider
Robert Varga [Sat, 16 Oct 2021 11:55:10 +0000 (13:55 +0200)]
Remove RuntimeTypeProvider

Migrate all disabled tests which rely on it and remove it. This
increases our assertion coverage and reduces the amount of code we lug
around.

Change-Id: I5ecd83b953f021786a7fb9bd8a228c67e528ea7b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoReduce code duplication a tiny bit
Robert Varga [Fri, 15 Oct 2021 19:55:51 +0000 (21:55 +0200)]
Reduce code duplication a tiny bit

The 'else' part of CaseNodeCodecContext's return is the same as
overridden method, hence call super instead of duplicating code.

Also add a few FIXMEs to guide our intent going forward.

JIRA: MDSAL-697
Change-Id: I7dd9576da217f1a186e9298346ee62aa2ede45d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoAdd a ModuleAugmentGenerator FIXME
Robert Varga [Fri, 15 Oct 2021 18:32:52 +0000 (20:32 +0200)]
Add a ModuleAugmentGenerator FIXME

Since we will be dealing with getOriginal(), it seems we had some
dead code from conversion. This might prove useful in what we need
to achieve here.

JIRA: MDSAL-696
Change-Id: I8af7f2277f5adc9c08b304d4f8693fc43ece6778
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoRemove getOriginalIfPossible()
Robert Varga [Fri, 15 Oct 2021 18:31:06 +0000 (20:31 +0200)]
Remove getOriginalIfPossible()

We already have originalNodeOf(), which does precisely the same thing
as we just transplanted.

Change-Id: Ibcafaa23027be1e52e4bb1d8c1f752683fab1aff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup AbstractBindingRuntimeContext.getAvailableAugmentationTypes()
Robert Varga [Fri, 15 Oct 2021 16:01:22 +0000 (18:01 +0200)]
Cleanup AbstractBindingRuntimeContext.getAvailableAugmentationTypes()

We are performing lookups along augmentation instantiation axis using
APIs which are going away. Cleanup the code and move the traversal to
BindingRuntimeTypes.

Leave a FIXME for getting the required intelligence from
GeneratorReactor as well as some sorely-needed documentation as to what
exactly is going on.

JIRA: MDSAL-695
Change-Id: I6dd7ad7807546091bfbc5cced48b574d6bff49e2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoCleanup findChildSchemaDefinition()
Robert Varga [Fri, 15 Oct 2021 13:46:04 +0000 (15:46 +0200)]
Cleanup findChildSchemaDefinition()

Now that we have the search and codec check split out, we can clean up
some of the logic to ditch if-else blocks. Also fixes a potential NPE.

Change-Id: I2a341d06bd3abfc39d7ecfaaf876e6617ddea037
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoMove grouping/instantiation lookup code
Robert Varga [Fri, 15 Oct 2021 12:56:29 +0000 (14:56 +0200)]
Move grouping/instantiation lookup code

DatObjectCodecContext should not be concerned with relationships
between parent and child, certainly not to the point of dealing with
where an original grouping leaf is instantiated.

The natural place for this logic is BindingRuntimeContext or
BindingRuntimeTypes, as those get their indices from
mdsal-binding-generator -- which is the core component understanding
these relationships.

Also ditch use of Optionals for tracking walk through dependencies,
which clears up some ugly casts.

Change-Id: I72bfa499794b55c0c6266462b36df56c2ac085c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
2 weeks agoFix GeneratorReactor.mapToGenerator()
Robert Varga [Sun, 5 Sep 2021 22:48:00 +0000 (00:48 +0200)]
Fix GeneratorReactor.mapToGenerator()

GeneratorReactor.mapToGenerator() relies on EffectiveStatements having
an identity, as it looks up only based on statement.

Rework the logic to operate on SchemaInferenceStack's state, which
provides hierarchical path which should match Generator layout. This
turns out to be a simple delegator job, but we need to switch matching
strategies when we go along the grouping or augment axis.

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