Robert Varga [Tue, 1 Dec 2020 21:41:57 +0000 (22:41 +0100)]
Cleanup ListKeysTest
Use assertThrows()/assertThat() to make the test simpler and more
expressive.
Change-Id: I088cd411b1e8ee0e00491a187d7b5881f494cbbb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 1 Dec 2020 13:42:15 +0000 (14:42 +0100)]
Fire AbstractPrerequisite listeners as soon as they resolve
We seem to be stuck with listeners not firing, leaving references
which need to be cleared. Ensure we fire phase listeners as soon
as they are satisfied -- repurposing tryApply() for its logical
purpose.
JIRA: YANGTOOLS-1192
Change-Id: I87d1700e2cc80bfa3fbb5be9a8dc938d6fe55c17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
d70f2e9f13755ea7c3aac1f0c8d8a6b0b0861368)
Robert Varga [Mon, 30 Nov 2020 16:33:22 +0000 (17:33 +0100)]
Tag internally-reused statements
This call site was missed by the previous audit, make sure we
create a replica of the reused statement.
JIRA: YANGTOOLS-1190
Change-Id: I08b0e1cd7b3697ff1261fc7bb7984c1223959ad3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 30 Nov 2020 07:50:33 +0000 (08:50 +0100)]
Search effective statements instaead of StmtContexts
When we are searching for the appropriate namespace/prefix, we want
to be referring to the effective statements we have at hand rather
than dropping back to StmtContext.
JIRA: YANGTOOLS-1186
Change-Id: Ic2c3c94498ef11f807a56e3dd533b31c28c97f26
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 29 Nov 2020 21:50:22 +0000 (22:50 +0100)]
Make Mutable.replicaAsChildOf() non-default
We really want to strongly bind to this contract, make sure it is
non-default.
Change-Id: I6616567abf3800f0a4ec91b43d256460f66e7bcc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 29 Nov 2020 21:16:08 +0000 (22:16 +0100)]
Isolate statement reuse sites
Augment wants to do something atypical: it assumes its state cannot
be further inferred into at both source and target context place and
it wants the same EffectiveStatement to emerge at both places.
This violates SchemaPath rules on one side of the equation or the
other, but seems to work for the intended case.
As it turns out, we are already doing something similar in the reactor,
but here we are taking the guidance of StatementSupport in the form
of CopyPolicy.
Make sure all users of this mechanics are calling into
Mutable.replicaAsChildOf(), where the reactor can properly capture
the lifecycle transition. This includes 'deviate' statement as well.
JIRA: YANGTOOLS-1190
Change-Id: Ic0032c50a1abbc65265dcbc038f72598761e9c36
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 29 Nov 2020 23:14:23 +0000 (00:14 +0100)]
Case statement's config is inherited from DataSchemaNode
The check here goes through StmtContext.allSubstatementsStream()
when it already has all the substatements built. Look at the
effective children rather than contexts.
JIRA: YANGTOOLS-1186
Change-Id: Iff835d781e182c7987ad50802b62a46cc72a2d59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 29 Nov 2020 23:04:56 +0000 (00:04 +0100)]
Clean up NameCollisionWithinCaseTest
Use assertThrows() to properly catch exceptions, cleaning up related
Sonar complaints.
Change-Id: I23a956f008db6ca53329627ef190fc74b0055a33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 17:44:26 +0000 (18:44 +0100)]
Split out AugmentInferenceAction
We will need to specialize augment inference to do the right thing
in all circumstances. This patch splits it out into a standalone
class, so it is clearer what is being used where.
JIRA: YANGTOOLS-1190
Change-Id: Ied0ed3bd12c9639a45435c8f0ab615df844012d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 18:20:46 +0000 (19:20 +0100)]
More deprecated method migration
Sweep extension supports for use of deprecated methods.
Change-Id: Ibe405e78f499cc1c1f213b02363a34fd2e224c55
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 16:02:43 +0000 (17:02 +0100)]
Enforce augment statement argument well-formedness
'augment' statement has dual use, depending on where it is declared.
Each use requires a different schema node identifier:
- plain augment requires SchemaNodeIdentifier.Absolute
- uses/augment requires SchemaNodeIdentifier.Descendant
Make sure we enforce proper parsing, so that our argument will end
up being correctly captured (and can be used for further reasoning).
JIRA: YANGTOOLS-1189
Change-Id: I4e628fd1aee29e103a045cfe90bae58f91ce32ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 10:29:19 +0000 (11:29 +0100)]
Eliminate AbstractEffectiveModule.schemaTreeNamespace
We already have DefaultWithDataTree.WithSubstatements's indices,
hence there is no point in re-doing the same work.
Eliminate duplication and defer to our superclass.
JIRA: YANGTOOLS-1188
Change-Id: I9fd775be737ef603be7ae2a914dda2c2d87bf8a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 09:49:40 +0000 (10:49 +0100)]
Do not use StatementSourceReference in AbstractDeclaredEffectiveStatement
We are depending on yang-parser-spi mechanics in what is supposed to be
(relatively) dumb DTOs. Replace this use with a dedicated
SubstatementIndexingException and wrap it in statement supports as
appropriate.
JIRA: YANGTOOLS-1187
Change-Id: I4306bbdfb167b7431bc810a242fa3773f3ec6124
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 08:48:36 +0000 (09:48 +0100)]
Migrate coerceStatementArgument() callers
This is a mass migration of callers, deprecating the method
in the process.
Change-Id: I41f44da5c9c460ce971f5c75f4f8b3998a12ecaf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 08:35:38 +0000 (09:35 +0100)]
Migrate getStatementArgument() callers
This is a mass migration of callers, deprecating the method
in the process.
Change-Id: I7e1f736e707971415c8ce5dbdc75ada6b037092d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 08:28:01 +0000 (09:28 +0100)]
Migrate coerceRawStatementArgument() callers
This is a mass migration of callers, deprecating the method
in the process.
Change-Id: I6a056f0cc9af2e872f85f41fb94c89035fa84ba4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 08:18:13 +0000 (09:18 +0100)]
Migrate rawStatementArgument()/getStatementSourceReference() callers
This is a mass migration of callers, deprecating the two methods
in the process.
Change-Id: Ibda969a84d5a45b624d581e10ed5706b4066625f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 04:35:55 +0000 (05:35 +0100)]
Migrate get{PublicDefinition,StatementSource} callers
This is a mass migration of callers, deprecating the two methods
in the process.
Change-Id: Ia7b49a57269eecf5751d669a3fd31dad68b07cb1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 04:20:46 +0000 (05:20 +0100)]
Speed up StmtContextUtils.hasAncestorOfTypeWithChildOfType()
Representation is an invariant, make sure we acquire it only once
rather than on each check.
Change-Id: I13214cd09d4c812e8c57a28ce47335f77209897d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 03:31:37 +0000 (04:31 +0100)]
Refactor AbstractAugmentStatementSupport.copyFromSourceToTarget()
We already have per-version supports, hence can easily specialize
handling of mandatory/when statements. Introduce an abstract
method to facilitate this -- allowing us to remove an explicit
check for yang-version.
Change-Id: Id8cbcd085c851606ac1bfbbb26e771f778edfbdf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 03:11:18 +0000 (04:11 +0100)]
Further StmtContext/CommonStmtCtx merge
Declared/Effective representation can easily be picked up from
the public definition, hence it has a natural place in CommonStmtCtx.
This rehost allows us to fix a few warnings we have been working
around.
Also introduce BoundStmtCtx, which binds the argument, as parsed
by the corresponding support. This allows us to unify argument handling
between StmtContext and EffectiveStmtCtx.Current.
JIRA: YANGTOOLS-1185
Change-Id: Ie2a02ade0616206ff2f677e15bfb8b92878ffbba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 03:15:12 +0000 (04:15 +0100)]
StmtContextUtils.parseNodeIdentifier() is augmentation-agnostic
This special-casing code for augmentation history was used when we
did not have BaseQNameStatementSupport.adaptArgumentValue() and used
the parser in context which are not adapted.
Since we have no callers actually hitting this special case, we can
remove it.
Change-Id: Ieaca3ec844fa8e4bc7b28db6732d94d7120e0fdd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 02:02:28 +0000 (03:02 +0100)]
Remove StmtContext.getSchemaPath()
Access is restricted to EffectiveStmtCtx.Current and this getter
is not really used anymore. Migrate the javadoc to its new place
and remove it from public view.
JIRA: YANGTOOLS-1185
Change-Id: I646e61d70fe4def1af8bb2fdd60d2501a121209c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 02:16:04 +0000 (03:16 +0100)]
Split IfFeatureStatementSupport
We are using version-dependent argument parsing, which is indicating
this support should have two subclasses, one for each version.
This speeds up processing, as we do not have to lookup the version
and can rely on reactor statement binding to bind the correct support.
Change-Id: I9257760f333af44d063143a95bc4898f63120005
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 01:29:19 +0000 (02:29 +0100)]
Add EffectiveStmtCtx.root()
Allowing access to CommonStmtCtx view of root is advantageous, as
it allows us to side-step the need to go to StmtContext world.
JIRA: YANGTOOLS-1186
Change-Id: I9ba40ec037f25b07b7f01fd994f60ff78c3c15bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Nov 2020 00:36:52 +0000 (01:36 +0100)]
Convert type checking in AbstractTypeStatementSupport
The effective version of a statement is dictated by the version we
are bound to -- hence is subject to support subclasses. This removes
a user of EffectiveStmtCtx.yangVersion(), making it less useful.
JIRA: YANGTOOLS-1185
Change-Id: Ia27b6982057e3e683f26ccc60cefb58bbb3eb1d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Nov 2020 12:49:56 +0000 (13:49 +0100)]
Add CommonStmtCtx
The idea here is that EffectiveStmtCtx represents an effective view,
whereas StmtContext is an inference view. They share some bits at
the very least.
This patch splits out the common stateless bit, which is not affected
by any sort of interpretation on our part into CommonStmtCtx. This
information is always available and valid.
JIRA: YANGTOOLS-1185
Change-Id: Ia852195811bbd3ec0091fa54488ada230e7f6245
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 26 Nov 2020 22:59:55 +0000 (23:59 +0100)]
Move use of EffectiveStmtCtx.caerbannog()
Is it turns out a lot of our logic can be migrated to plain
EffectiveStmtCtx.Current access, reducing the number of warnings
and potential exposure of StatementContextBase internals.
JIRA: YANGTOOLS-1186
Change-Id: Ic5dd688c75a0d0e2285b4bef9f1c77f059d09c1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Nov 2020 09:14:21 +0000 (10:14 +0100)]
Narrow down SuppressFBWarnings in ModelProcessingPhase
We are suppressing a single null assignment, make sure we minimize
the scope of suppression.
Change-Id: Ie7b62be11964df2553268eb9f49cca1e2c8538b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Nov 2020 09:13:15 +0000 (10:13 +0100)]
Fixup yang-parser-rfc7950 module
We are exposing things from reactor, make sure to capture that in
'requires transitive'.
Change-Id: Iaa0412c114996cec55596e672a8d130cef742e73
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 21:26:02 +0000 (22:26 +0100)]
Reformulate StatementContextFactory.createEffective()
We need a better handle on what state is being accessed during
createEffective() invocation.
This is achieved by isolating this state into EffectiveStmtCtx,
which gets passed to StatementFactory.createEffective() along
with single-use streams of declared and effective statements.
This interface is then implemented by a proxy in front of a
StatementContextBase, providing effective isolation.
There are a few places which still require direct access to
the underlying StmtContext, but those are limited and subject
to elimination. All of them access backing context through
Current.cearnbannog(), making it easy to spot.
JIRA: YANGTOOLS-1161
Change-Id: I950c466d02c75be1e21a9d0606b990d35e4ca5c2
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 25 Nov 2020 02:34:26 +0000 (03:34 +0100)]
Speed up StmtContextUtils.getModuleQNameByPrefix()
We are looking up root twice here. Cache the lookup for reuse,
skipping one traversal.
Change-Id: I4ead06fa82b2ef822cbee0a2761bd90674bc1676
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Nov 2020 12:19:56 +0000 (13:19 +0100)]
Fixup collections return implementations
Adjust nullness annotations to fix Eclipse-reported errors.
Change-Id: I664c651e9bf10fd9d91bae00cc31edf86f9fda0c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 22 Nov 2020 15:21:35 +0000 (16:21 +0100)]
Speed up SchemaTracker.startContainerNode()
Eclipse spotted a potential shortcut in expression, make sure we
take it.
Change-Id: Ief68daa77ac98de3698b9df0627061353055434f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 22 Nov 2020 12:39:36 +0000 (13:39 +0100)]
Update MutableTreeNode methods
Rename addChild() to putChild() and make it return previous child
if this was a replace operation. Also update removeChild() to return
removed child.
JIRA: YANGTOOLS-1182
Change-Id: I0c601f4b6b9d99bcc403b6928f6e8c9bfef36a34
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 22 Nov 2020 10:13:16 +0000 (11:13 +0100)]
Update StoreTreeNode methods
StoreTreeNode.getChild() is forcing users to work on optional,
which is introducing no small amount of complexity. Furthermore it
is not inline with our naming -- that method should be findChild()
at the very least.
JIRA: YANGTOOLS-1181
Change-Id: Ie1c69664c46a9f83154730835d42dcb93778b4a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 20 Nov 2020 20:16:16 +0000 (21:16 +0100)]
Add MinMaxElementsValidationFailedException
The refactor we've done makes switch exceptions easy, migrate
MinMaxValidation to a dedicated exception.
JIRA: YANGTOOLS-1177
Change-Id: I005575c93d5683b7fb42428d06f6f052152bc1d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 20 Nov 2020 20:05:16 +0000 (21:05 +0100)]
Report a dedicated exception on unique failure
Rather than using plain IllegalArgumentException, report a dedicated
exception derived from SchemaValidationFailedException. Also refactor
UniqueValidation a bit.
Change-Id: If24d97aebab516a461f673c169fa41f9447e0413
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 20 Nov 2020 19:55:11 +0000 (20:55 +0100)]
Fix ListModificationStrategy child handling
We have an obviously bad cast here, correct that.
JIRA: YANGTOOLS-1180
Change-Id: I706a5335e899e182e4651e9134f608a6e7094c37
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 20 Nov 2020 15:54:59 +0000 (16:54 +0100)]
Hide UniqueValidator methods
Our contract is quite crisp, make sure we hide static utility
methods.
JIRA: YANGTOOLS-1177
Change-Id: I9718b7a05cc44906d710a93beaaddd8c12ae93bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Nov 2020 14:41:30 +0000 (15:41 +0100)]
Add UniqueValidation
This is a simplement implementation with a stateless external enforcer,
similar to what MinMaxElementsValidation does. The test suite is split
out of If3b94a085be034de28e341ac900142b021cd2a88 and adapted a bit.
JIRA: YANGTOOLS-1177
Change-Id: I3914497981db0281ab8f32dee12a102ce729022e
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 19 Nov 2020 21:30:20 +0000 (22:30 +0100)]
Split out AbstractValidation
MinMaxElementsValidation performs a useful role as a template for
how we can create simple subtree validations. Split the common bits
into AbstractValidation and elinate code duplication by doing some
trickery.
JIRA: YANGTOOLS-1177
Change-Id: I5adbed16e85f9752a0ce5061b0159c8124583346
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Nov 2020 14:58:36 +0000 (15:58 +0100)]
Unify ModificationApplyOperation.toString()
Not all ModificationApplyOperation subclasses provide useful
information in toString(). Make sure all of them do.
JIRA: YANGTOOLS-1176
Change-Id: Id93f2899dcedd8c289b093c1e126c09108eefb4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Nov 2020 14:24:24 +0000 (15:24 +0100)]
Reduce list/map/entry strategy confusion
Lists with a key are called 'Map' and contain 'MapEntry'
Lists without a key are called a 'List' and do not have an entry
strategy (yet).
Change-Id: I0321eaebf1541a86778c63a2eaa68bdffcd8672a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Nov 2020 11:24:49 +0000 (12:24 +0100)]
Propagate @NonNull collection annotations
We do not allow nulls in our collections. Add the appropriate
annotation to trim down downstream false positives.
Change-Id: Iceaf2bdd6a82b0ad73035ab86d06f283e46c42c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Nov 2020 12:33:10 +0000 (13:33 +0100)]
Fix get{Min,Max}Elements() usage
These return a nullable, UTs should be using
assertEquals(Object, Object) to compare them.
Change-Id: I6d6aefc94695c5118b4ec4552f64bb45b45dcdc8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Nov 2020 12:49:09 +0000 (13:49 +0100)]
Clean up argument checking
We have a few nullness reports, use coerceArgument() when we
are implying a requirement.
Change-Id: I9854f77eeb28945a6cac9fe86695a145eab0687d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Nov 2020 12:46:36 +0000 (13:46 +0100)]
Remove an orElse(null) indirection
We do not need to update foundNode() if we do not find anything,
hence sync on optional directly. Improves interactions and solves
an Eclipse warning.
Change-Id: Ibc553d50d48ccd22480bdc33163364bc8a509c83
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Nov 2020 12:12:55 +0000 (13:12 +0100)]
Fix annotation imports
We are propagating @NonNull towards our users and are using
@SuppressFBWarnings (which we don't propagate).
JIRA: YANGTOOLS-934
Change-Id: I9e6fc6edb79b7d29f98201b074ca32295b33f646
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Nov 2020 11:24:25 +0000 (12:24 +0100)]
Correct NonNull annotation
We are using the wrong annotation here, fix that.
Change-Id: Ic3c68239f41ada9dfdcc68f9861ce0a142442d89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 17 Nov 2020 00:31:33 +0000 (01:31 +0100)]
Remove AbstractDeclaredStatement's dependency on StmtContext
As part of the effort to share code, remove StmtContext use in
AbstractDeclaredStatement.
JIRA: YANGTOOLS-1162
Change-Id: I128da9235a5dae956f9cce852679fe515577a703
Signed-off-by: Michal Banik <michal.banik@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 16 Nov 2020 19:49:10 +0000 (20:49 +0100)]
Convert yang-data-impl to a JPMS module
This is a mostly straightforward conversion except we need to move
some files around to allow them to be loaded by external libraries
during UT.
JIRA: YANGTOOLS-1175
Change-Id: Iacecd4157e34c58d35bd2dc495eb178d7e3c86a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 16 Nov 2020 23:03:20 +0000 (00:03 +0100)]
Fixup rfc8528-data-api module-info
We depend on annotations, make sure to express that.
Change-Id: Ifbd45b538808382228631635d24bd0dac273406c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 16 Nov 2020 23:01:10 +0000 (00:01 +0100)]
Fixup yang-data-api module-info
We have a couple of dependencies we want to express explicitly,
do that now.
Change-Id: I1e40cab18f0ab10ff08764f6df15dcdf3ec1a23f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 16 Nov 2020 20:16:24 +0000 (21:16 +0100)]
Drop dependency on javax.xml.bind
All we need is a lenient Base64 decoder. Drop the dependency
on javax.xml.bind and use plain java.base-provided one.
JIRA: YANGTOOLS-1174
Change-Id: If02fce547142f3d5b17d8529716d5b266a50a3a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 15 Nov 2020 23:00:21 +0000 (00:00 +0100)]
Move OrderedByStatement.Ordering
This closed enumeration is a core YANG construct, similar to
Revision, QName, types, etc. which we host in yang-common.
This patch moves it there, adjusting all references.
JIRA: YANGTOOLS-1173
Change-Id: I25e3341604c939a9ab8635a15edf903c0359d818
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Michal Banik [Tue, 3 Nov 2020 16:53:09 +0000 (17:53 +0100)]
Deprecate DeclaredStatement constructors utilizing StmtContext
In preparation for promotion, add alternative constructors which
take the appropriate fields already-extracted from StmtContext.
Also migrate invisible classes.
JIRA: YANGTOOLS-1162
Change-Id: I30b41bf5450e7fba0d24fd00fca5f91f364eb3fb
Signed-off-by: Michal Banik <michal.banik@pantheon.tech>
Robert Varga [Fri, 13 Nov 2020 22:05:42 +0000 (23:05 +0100)]
Do not use @NonNullByDefault in ItemOrder
Using @NonNullByDefault limits usability, remove it again.
JIRA: YANGTOOLS-1170
Change-Id: I656c04203f48406142977fb6aaa2cab8bb435f78
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 13 Nov 2020 12:30:50 +0000 (13:30 +0100)]
Add ItemOrder concept
This is a generalized contract for container-like classes, expressing how contained
items contribute to equality contract of the container.
The defined values are ItemOrder.Ordered and ItemOrder.Unordered. For convenience,
these are also exposed as ItemOrder.itemOrder(), reporting the implemented class
of ItemOrder.
JIRA: YANGTOOLS-1170
Change-Id: Ic67926c2146696ecb4be6f664720e842f363c6b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 13 Nov 2020 11:19:55 +0000 (12:19 +0100)]
Clean up UnmodifiableCollection constants
Do not use a static initializer block, as we can trivially
initialized the fields.
Change-Id: Ieaf80300749165a132673ede60bd01c7428193bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 13 Nov 2020 06:59:47 +0000 (07:59 +0100)]
Refactor AbstractIdentifiable
There are cases when we specify Identifiable<T>, but really want
to stack that definition to provide a subclass of T as the identifier.
Redefine AbstractIdentifiable to allow that, with the simple case
of exact match being handled by AbstractSimpleIdentifiable.
Change-Id: Ieb88f2185fa9c83749dfec0c5114c2a67868230a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 01:20:00 +0000 (02:20 +0100)]
Perform partial substatement initialization
When we have a request for a schema tree participant, we should not
force materialization of
We should not need to initialize all substatements when we are being
asked for a single one.
Side-step this need by keeping a separate map of statements we have
initialized and meshing it together if need be.
JIRA: YANGTOOLS-1160
Change-Id: I8e014650272409ba30e528341dcba9c05311971b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 11 Nov 2020 21:17:10 +0000 (22:17 +0100)]
Remove SchemaNodeIdentifierNamespace
This namespace was never implemented and we have a better
replacement. Remove it.
JIRA: YANGTOOLS-1169
Change-Id: I6b40fc1a681c45f57ebac115658f452f7e871d9d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Nov 2020 16:16:01 +0000 (17:16 +0100)]
Graduate ChildSchemaNodeNamespace as SchemaTreeNamespace
This is a @Beta construct in yang-parser-rfc7950, but it provides
a crucial link between statements and namespaces.
In terms of semantic change, this is a direct replacement for the SPI
idea that there is a SchemaNodeIdentifierNamespace. While that namespace
allowed lookup based on SchemaNodeIdentifier, while
SchemaTreeNamespace follows QName addressing -- i.e. we are changing
the addressing mode and allowing more flexible walks.
This is a strictly speaking API-breaking change, but since it enables
reactor/parser-rfc7950 interactions and is allowed under @Beta API
change rules, we will backport this to otherwise stable branches.
Existence of this namespace allows us to neatly tie it with
OnDemandSchemaTreeStorageNode.
JIRA: YANGTOOLS-1168
Change-Id: I9b1c30d21f7021d4c21f3e5a519f6cd1539871ad
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 11 Nov 2020 20:58:03 +0000 (21:58 +0100)]
Import annotations to yang-parser-rfc7950
Do not rely on upstreams for these, use them explicitly.
Change-Id: Id0a5216d2612fd516861ce9b0155283ff8ef4d2b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Nov 2020 11:27:57 +0000 (12:27 +0100)]
Remove log4j from yang-data-impl tests
We are not interacting with the logger, just use slf4j-simple, as
it serves the purpose we need.
Change-Id: If9931e1370dd1449457f8e32d3a8c3b2ca3bee2b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Nov 2020 11:19:27 +0000 (12:19 +0100)]
Do not pull in logback into yang-model-util-ut
logback is not used for anything, just use slf4j-simple, which is
the default.
Change-Id: Ia647429db419d7f37596f5a5fbbe717b421b6dc0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 2 Feb 2020 15:05:22 +0000 (16:05 +0100)]
Remove StmtContextUtils.producesDeclared()
This method is not used anywhere, remove it.
Change-Id: I4a5095593bcb7556fbcf1f15524eff0a70b2a3c6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 29 Oct 2020 20:19:15 +0000 (21:19 +0100)]
Add RootStmtContext marker interface
This is a useful marker which we can expose in APIs, i.e. for
users which already have a RootStmtContext available. The thinking
here is that, for example, Lookups in global context are shorter
from root than from any old context.
JIRA: YANGTOOLS-1158
Change-Id: Ib69d70ded9d4b46524be21fb5524311b427d9245
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 09:20:48 +0000 (10:20 +0100)]
RootStatementContext should be final
We do not want to inherit from root, hence this class should be
final.
Change-Id: I90d7103c0c0dc111f99f0f8d82c4e1da5d715223
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 6 Nov 2020 11:55:56 +0000 (12:55 +0100)]
Bump versions to 7.0.0-SNAPSHOT
This opens the next major version development.
Change-Id: Ibf8e8b8a58a4b7e213567de03284f6f7479425a2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 6 Nov 2020 10:54:05 +0000 (11:54 +0100)]
Bump versions to 6.0.2-SNAPSHOT
This starts the next development iteration.
Change-Id: I6e2beb8719a845c84d832cff3464d03cefd1c958
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 6 Nov 2020 10:07:26 +0000 (11:07 +0100)]
Bump odlparent to 8.0.1
Pick up latest upgrades, allowing us to ditch a few declarations.
Change-Id: I5ace375fd8d746f13fa7eb83a525203503b3cf33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Nov 2020 16:42:29 +0000 (17:42 +0100)]
Remove unused SourceSpecificContext methods
These package-private methods are not used, remove them.
Change-Id: I245f4c7d874d5cd3c716f9685fc9f5a4c54679c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Nov 2020 11:53:04 +0000 (12:53 +0100)]
Fix PhaseModificationInNamespacePath effects
PhaseModificationInNamespacePath is a set of requirements, working
along the parent->child axis. As we are resolving individual steps
we have to mark each as being impacted by this mutation, not only
the ultimate target.
This ensures that parent statements are not allowed to complete
until the mutation is resolved one way or another -- thus ensuring
proper parent/child phase completion transitions.
JIRA: YANGTOOLS-1160
Change-Id: I87cd682d32cb9ce3397883f2ac1a61a0bc9c8664
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Nov 2020 18:48:09 +0000 (19:48 +0100)]
Refactor StatementContextBase.effective access
In order to correctly synchronize substatement and stage completion
view, we need all accesses from StatementContextBase towards its
.effective field guarded.
This patch audits all callers and instantiates an
ensureEffectiveSubstatements() guard around all accesses.
We also introduce effectiveChildrenToComplete(), which communicates
the effective children which should be processed.
InferredStatementContext returns as empty list from this method
if it is not materialized. This acts as an explicit guard, which
is extensible with local state later.
JIRA: YANGTOOLS-784
Change-Id: I235bc15d315ddee71c20f3875412d8d05803a716
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Nov 2020 10:31:55 +0000 (11:31 +0100)]
Fix mis-ordered requires
This edit passed through review, fix it up.
Change-Id: I2298ecd1fba3c1cf8b4306589abcc2b087501bb7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 9 Mar 2018 00:05:41 +0000 (01:05 +0100)]
Fix transitive if-feature augments
We cannot just ignore augments, as they drive namespace population.
Instead of that, let's populate target nodes, but make sure they
are marked as unsupported.
This allows ChildSchemaNodeNamespace-driven lookups to find the resulting
node, but does not allow it to materialize as an EffectiveStatement.
JIRA: YANGTOOLS-859
Change-Id: Ib817e6e20563005427471098bf6ff2991fb60e01
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
miroslav.kovac [Fri, 30 Oct 2020 16:29:28 +0000 (17:29 +0100)]
Use StmtContext.findSubstatementArgument() for isConfiguration()
We are only interested in having the appropriate argument, hence
we can use provided utility to not force the StmtContext to be
materialized.
JIRA: YANGTOOLS-1156
Change-Id: Idf292794225792afd8df1019c9106362a94ed5a4
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 2 Nov 2020 15:37:49 +0000 (16:37 +0100)]
Fix StmtContext.findSubstatementArgument()/hasSubstatement()
When we are searching for a substatement we should also mind that
it can have its effective statement built. If we do not, we can end
up picking a statement which has been disabled by deviate.
Change-Id: I27743b5acbb2f617497d329423b239f363c54258
JIRA: YANGTOOLS-1157
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 18 Feb 2017 13:34:02 +0000 (14:34 +0100)]
Deprecate old interfaces CodeGenerator interfaces
BasicCodeGenerator and BuildContextAware should be deprecated, as
we have a generalized FileGenerator replacement for them.
JIRA: YANGTOOLS-1148
Change-Id: I0cd0bcfd2314605188b9bfb2204298e2c7eea7a6
Signed-off-by: Robert Varga <rovarga@cisco.com>
Robert Varga [Mon, 2 Nov 2020 11:29:16 +0000 (12:29 +0100)]
Centralize project scanning
We want to relocate scanning to outside of reactor built, as we do
not want to do it twice.
JIRA: YANGTOOLS-1147
Change-Id: I675b8c1165df608b07dd1abb0930e1028b0165e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Illia [Mon, 26 Oct 2020 16:15:39 +0000 (18:15 +0200)]
Add LazyCollections.lazyAdd for Sets
This will be used for GenerateType field, which is set of specified
getters.
JIRA: MDSAL-426
Change-Id: I691aa13c88147828890e0639441f607515053af8
Signed-off-by: Illia <illia.ihushev@pantheon.tech>
Robert Varga [Mon, 12 Nov 2018 10:54:14 +0000 (11:54 +0100)]
Use plugin-generator-api in yang-maven-plugin
Rework plugin execution so that we can use both old-style and
new-style plugins by introducing GeneratorTask. This is then
specialized for both worlds.
We rework the multi-version support so that we run reactor assemply
twice if needed -- for each requested mode separately.
JIRA: YANGTOOLS-1147
Change-Id: I494ad899fabfb065c91537019698fdb131e0f1f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 31 Oct 2020 11:06:21 +0000 (12:06 +0100)]
Remove check for when being copied
We have 'when' explicitly excluded, hence we can never observe
it in validation. Eliminate this dead code.
Change-Id: I4a4fb4c1e2a3d888e02f2db0e49671993e2985ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 31 Oct 2020 08:57:10 +0000 (09:57 +0100)]
Fixup module definitions
We require org.slf4j for most operations, make sure we record that.
Change-Id: If3f5a6f5eb7c16543cc51874eac24e988653c49c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 20:34:33 +0000 (21:34 +0100)]
Add a requirement on annotations
Do not rely to get these transitively, add a requires static.
Change-Id: Ibf06934bcdf808e1bdc47cdb8097adc9d5650606
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
miroslav.kovac [Fri, 30 Oct 2020 11:36:14 +0000 (12:36 +0100)]
Add StmtContext.findFirstSubstatementArgument()
Introduce utility methods to StmtContext, so that individual
implementations can provide optimized version, which does not
walk all children.
InferredStatementContext used this facility to defer to protype,
side-stepping the need to materialize substatements.
JIRA: YANGTOOLS-1157
Change-Id: I9e618d3a51f68ed03a76c718b657be38e5cedb5d
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 22 Aug 2020 18:27:23 +0000 (20:27 +0200)]
Defer substatement initialization in InferredStatementContext
InferredStatementContext is initializing its substatements rather
eagerly in its constructor. We now have all the tools we need to
defer this instantiation until the substatements are really needed.
JIRA: YANGTOOLS-784
Change-Id: Iafc23c22b15efdf46fde3adfc210c246e8d086bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 09:08:51 +0000 (10:08 +0100)]
Clarify NamespaceStorageSupport.getParentNamespaceStorage()
This override does seemingly nothing, but in fact splits invocation
groups to two -- those going to SourceSpecificContext and those
going to a NamespaceStorageSupport subclass. More specifically, if
a caller knows it is talking to NamespaceStorageSupport, JIT does
will not consider SourceSpecificContext an implementation.
Furthermore, SourceSpecificContext, as an implementation class,
guarantees it will return BuildGlobalContext.
Change-Id: Ia285f9d7745a9c114d3dd3214c2b82a651db3ce0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 09:33:02 +0000 (10:33 +0100)]
Tighten {Inferred,Substatement}Context.getParentNamespaceStorage()
These two methods are guaranteed to return StatementContextBase,
express that in their return type.
Change-Id: I586c9f4ac88a42b094ed2061d0f698b6ce312d60
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 09:16:05 +0000 (10:16 +0100)]
Require org.slf4j in yang-parser-reactor
Do not rely on require transitive, explictly spell out we need
logging.
Change-Id: I97d0841311b8468b48a22201cdee58474545e97e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 08:58:24 +0000 (09:58 +0100)]
BuildGlobalContext should be final
We do not inherit from this class by design, make sure that bit
is captured for JIT to see.
Change-Id: I198e741d041ea45b685ed39024e17caf57f8bca0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 01:26:11 +0000 (02:26 +0100)]
Reactor requires org.eclipse.jdt.annotation
We are using these, let's not rely on them coming in transitively.
Change-Id: I00822ab34d6040905144adc6305e02f85adf40ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 01:25:28 +0000 (02:25 +0100)]
Use coerceStatemntArgument for YinElementStatement
yin-element requires an argument, it is fair to coerce it and get
rid of a nullness warning.
Change-Id: I1196d0b099a3ba4f481229c9a9259ee9aee1b5f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Oct 2020 08:10:24 +0000 (09:10 +0100)]
StorageSpecific.storageType is private and final
Somehow this field escaped our usual attention, make sure it's
properly final and private.
Change-Id: I9bcace1fbb14432f19f4b9a81b5c71c6b86f6f02
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 29 Oct 2020 22:58:34 +0000 (23:58 +0100)]
Add requires org.slf4j
We are directly using logging, do not rely on 'requires transitive'.
Change-Id: I7e78465bc3632abfa1622304cfa723e6a9f504cf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 29 Oct 2020 16:51:17 +0000 (17:51 +0100)]
Recheck fields when cleaning up listeners
We may end up in a situation where we trigger multiple times, in
which case we can end up with mutated state and therefore cannot
rely on fields being non-null.
JIRA: YANGTOOLS-1155
Change-Id: I5607843d1e02483faa387a5630f3c4c06a3be62a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 29 Oct 2020 13:19:58 +0000 (14:19 +0100)]
Centralize Abstract{Input,Output}StatementSupport.parseArgumentValue()
As we have reduced the number of implementations of this method,
by introducing the default implementation, we are down to three
possible implementations under BaseSchemaTreeStatementSupport.
Add a level of indirection through Function<QNameModule, QName>, which
allows us to combine the two implementations into a single one residing
in BaseOperationContainerStatementSupport.
Change-Id: Ia5232d356ce2141800a950e6222cdc2174cd926b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 29 Oct 2020 13:13:12 +0000 (14:13 +0100)]
Add BaseSchemaTreeStatementSupport.parseArgumentValue()
Almost all subclasses of BaseSchemaTreeStatementSupport do the same
thing for parseArgumentValue(). Centralize the default behaviour there,
while allowing input/output statements to do their own thing.
JIRA: YANGTOOLS-1154
Change-Id: I7a3daf3a9c90eefadc1cad8043af3a2e7b9065e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>