yangtools.git
14 months agoBump odlparent to 12.0.4 52/105352/6
Robert Varga [Tue, 11 Apr 2023 00:26:55 +0000 (02:26 +0200)]
Bump odlparent to 12.0.4

Adopt latest updates from upstream.

Change-Id: I9dcad627cd3c0530add6ec902f5d96a90b8f45a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMigrate users of Optional.get() 51/105351/4
Robert Varga [Sat, 8 Apr 2023 20:28:58 +0000 (22:28 +0200)]
Migrate users of Optional.get()

Optional.orElseThrow() has a more explicit name, preventing potential
confusion with Future.get() and making it clear there might be an
exception coming.

Also take the time to modernize code with local variable type inference,
instanceof patterns and similar.

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

14 months agoRemove LeafRefYangSyntaxErrorException 50/105350/2
Robert Varga [Tue, 11 Apr 2023 00:03:54 +0000 (02:03 +0200)]
Remove LeafRefYangSyntaxErrorException

This exception is not used anywhere, remove it. Also update
LeafRefContextTreeBuilder to use ArrayList.

Change-Id: I89dd0f33c6418b0ce66dd7ecbf9dd7c6c6bcc16c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoUse a Multimap for keyListeners 81/105281/2
Robert Varga [Mon, 10 Apr 2023 23:52:17 +0000 (01:52 +0200)]
Use a Multimap for keyListeners

Fix a long-standing FIXME, which improves performance when there are
listeners for distinct keys. We use ArrayDeque for potentially faster
behaviour.

Change-Id: I71ddad396469a1d3623358269f385c542a2fa941
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoSimplify StmtContext generics 39/105339/2
Robert Varga [Mon, 10 Apr 2023 18:47:37 +0000 (20:47 +0200)]
Simplify StmtContext generics

We have generic signatures that hark back to when we used .class
references for namespaces. Simplify them, which makes it clear that
addContext() is just an alias to addToNs() -- and hence can be
eliminated.

Change-Id: I34637bbe913f7e23b615cfb51a7b0b69c14507db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoSimplify InferredStatementContext.hasEmptySubstatements() 38/105338/1
Robert Varga [Mon, 10 Apr 2023 18:33:27 +0000 (20:33 +0200)]
Simplify InferredStatementContext.hasEmptySubstatements()

SonarCloud is pointing out a code smell around explicit 'false',
refactor to eliminate it.

Change-Id: I7d6eb0f902d72dcdf616b48f9b02994b7280358c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoSprinkle @NonNull annotations 33/105333/2
Robert Varga [Sat, 8 Apr 2023 20:14:38 +0000 (22:14 +0200)]
Sprinkle @NonNull annotations

Contexts should always be non-null, improve a few places where we do not
make that explicit.

Change-Id: Ia11fb8e13f98c3e4c15bf0597b2191cb8553eac2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoUse instanceof pattern 32/105332/1
Robert Varga [Sat, 8 Apr 2023 19:56:30 +0000 (21:56 +0200)]
Use instanceof pattern

This removes an unnecessary cast.

Change-Id: I5fed4dbc753f7691b89fe059cbb4f89cf0fc3600
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoTighten canReuseCurrent() contract 31/105331/2
Robert Varga [Sat, 8 Apr 2023 19:40:26 +0000 (21:40 +0200)]
Tighten canReuseCurrent() contract

The we are passing a List down and that is what substatement semantics
are: adjust the method signature to use List instead of Collection.

Change-Id: Iefa694657b4540f73452f9d492744dac5da25d14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMove substatement ordering to yang-parser-reactor 26/105326/3
Robert Varga [Sat, 8 Apr 2023 17:49:57 +0000 (19:49 +0200)]
Move substatement ordering to yang-parser-reactor

Substatement ordering should be something reactor handles, hence move it
out to make sure StatementFactory does not have to deal with this,
making the API towards StatementFactory more consistent.

Change-Id: I9106e04c22227f054be23cf4ace492ffe416ff98
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoReuse NamespaceAccess where possible 18/105318/2
Robert Varga [Fri, 7 Apr 2023 15:20:47 +0000 (17:20 +0200)]
Reuse NamespaceAccess where possible

We have a few places where we can end up looking up NamespaceAccess for
a second time. Clean those up and also improve NamespaceAccess to expose
the underlying ParserNamespace.

Change-Id: I43e582a3c6db359d1f81819ac0445ac8b33e85bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRefactor globalOrStatementSpecific() 83/105283/1
Robert Varga [Thu, 6 Apr 2023 21:42:52 +0000 (23:42 +0200)]
Refactor globalOrStatementSpecific()

Current implementation elicits a nullness warning, which is not quite
there -- at the cost of verifyNotNull().

If we refactor checks we can actually make it more performant and
transparent. This is advanteous bacause a null parent implies current is
a GLOBAL storage -- and we therefore can just check the storage type for
STATEMENT_LOCAL.

As it turns out we can refactor the loop to make it obvious, in that we
manually check parent storage. This makes the code flow nicer and more
transparent -- there are no IDE-invisible non-null guarantees. A null
parent storage indicates GLOBAL storage, hence we can bail.

A further boon is that we can simplify the StorageType check to only
compare to STATEMENT_LOCAL and

Change-Id: I5a5b7faf312db6de7f1cebe654f18e9785f58bac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRefactor global NamespaceStorage access 82/105282/5
Robert Varga [Thu, 6 Apr 2023 20:43:45 +0000 (22:43 +0200)]
Refactor global NamespaceStorage access

There is only one way we are passing BuildGlobalContext, hence there is
no reason to indirect access through GlobalStorageAccess, as there is
only one implementation of it -- which always has the result handy.

Remove GlobalStorageAccess and introduce GlobalStorage as a
specialization of NamespaceStorage -- and pass that to
NamespaceBehaviour. This also improves coupling a bit, as there is only
a single implementation (as opposed to NamespaceStorage, which has
multiple implementations).

JIRA: YANGTOOLS-1497
Change-Id: Ica03ac855b62541ec5c52ce24044387199c75e9c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove DerivedNamespaceBehaviour 80/105280/5
Robert Varga [Thu, 6 Apr 2023 14:42:35 +0000 (16:42 +0200)]
Remove DerivedNamespaceBehaviour

DerivedNamespaceBehaviour is not used anywhere and is source of quite a
bit of head-scratching. Remove it, which allows is to solidify
NamespaceAccess to a great extent.

JIRA: YANGTOOLS-1502
Change-Id: Iba43d0f627d5df53f18e9ea4de79f0982b62d837
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoShortcut access to global NamespaceStorage 50/94650/15
Robert Varga [Thu, 6 Apr 2023 12:54:28 +0000 (14:54 +0200)]
Shortcut access to global NamespaceStorage

Most of our namespaces are stored in StorageType.GLOBAL. Accessing that
requires walking the NamespaceStorage tree completely towards its root,
which takes a lot of time.

This is highlighted by the fact that yang-parser-reactor already
performs this walk in order to find the actual behaviour, which is
stored in BuildGlobalContext -- which happens to also be the GLOBAL
NamespaceStorage object.

The result of that walk is NamespaceAccess, which is always instantiated
from a place which has immediate access to BuildGlobalContext -- either
it is BuildGlobalContext itself or it is SourceSpecificContext.

This patch introduces NamespaceBehaviour.GlobalStorageAccess, which
allows users to acquire the global NamespaceStorage and modifies
NamespaceBehaviour methods to require an instance of this interface.

NamespaceAccesss is extended to implement GlobalStorageAccess and taught
to pass itself to the backing NamespaceBehaviour.

JIRA: YANGTOOLS-1497
Change-Id: I74ac1a31176e8f3fc33875dff775965d1129391f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRefactor NamespaceBehaviourWithListeners 78/105278/4
Robert Varga [Thu, 6 Apr 2023 09:51:12 +0000 (11:51 +0200)]
Refactor NamespaceBehaviourWithListeners

There is quite a bit of confusion about what NamespaceBehaviour really
means inside yang-parser-reactor. This stems from the fact we actually
subclass NamespaceBehaviour and forward calls to a delegate in
NamespaceBehaviourWithListeners.

Refactor the class hierarchy, by renaming
NamespaceBehaviourWithListeners to NamespaceAccess, introducing explicit
access methods. These are then realized by a dedicated subclass,
BehaviourNamespaceAccess.

This provides a clear separation of concerns, also removing the need
to verify objects in ReactorStmtCtx.

JIRA: YANGTOOLS-1204
Change-Id: Ie6334e8a20359c0faf73a2150541f06f55cdd083
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove Optional from NamespaceBehaviour 75/105275/2
Robert Varga [Thu, 6 Apr 2023 11:52:05 +0000 (13:52 +0200)]
Remove Optional from NamespaceBehaviour

The criterion-based getFrom() method is unlike all others in that it
returns an Optional. Switch to returning a @Nullable.

JIRA: YANGTOOLS-1204
Change-Id: I5100f4ddac239fb8bbe8c92fa11bae1eb754db83
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRename NamespaceStorageSupport 71/105271/2
Robert Varga [Thu, 6 Apr 2023 09:34:24 +0000 (11:34 +0200)]
Rename NamespaceStorageSupport

NamespaceStorageSupport is a rather misleading name -- this actually is
an abstract implementation of NamespaceStorage. Rename it to
AbstractNamespaceStorage.

JIRA: YANGTOOLS-1500
Change-Id: I24b7bac34a116e72671d5cb447673a6b13de57ba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoSplit out NamespaceStorage(Node/Type) 70/105270/6
Robert Varga [Thu, 6 Apr 2023 07:12:43 +0000 (09:12 +0200)]
Split out NamespaceStorage(Node/Type)

The connection between NamespaceBehaviour and NamespaceStorageNode is
artifically too strong. Separate NamespaceStorageNode into a top-level
class and rename it to NamespaceStorage -- which is consistent with
argument naming in behaviours.

JIRA: YANGTOOLS-1500
Change-Id: Ie3a3bcba0f5361cf8e21f5530f152457a10bdd1d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoDisconnect NamespaceBehaviour from Identifiable 69/105269/3
Robert Varga [Thu, 6 Apr 2023 06:54:30 +0000 (08:54 +0200)]
Disconnect NamespaceBehaviour from Identifiable

NamespaceBehaviour has a ParserNamespace as its identifier. This makes
it hard to look for callers a bit -- at the end of the day all code
interacting with it already knows it is a namespace. Also perform
general cleanups while we are in the area.

JIRA: YANGTOOLS-1501
Change-Id: I540ee498d106c6c3714bd08bf73f5aa3d85a5978
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove NamespaceBehaviourRegistry 68/105268/2
Robert Varga [Thu, 6 Apr 2023 06:30:22 +0000 (08:30 +0200)]
Remove NamespaceBehaviourRegistry

This interface is an unneeded indirection. Inline
getNamespaceBehaviour() into NamespaceStorageSupport and implement it as
appropriate.

JIRA: YANGTOOLS-1499
Change-Id: I48741ce53a9ff8d52d5a4c2095641002a8d74bfc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMove NamespaceBehaviour.Registry 67/105267/3
Robert Varga [Wed, 5 Apr 2023 20:04:21 +0000 (22:04 +0200)]
Move NamespaceBehaviour.Registry

This concept is not referenced in yang-parser-spi and evolving it has
potential to reap major benefits. Rehost it as
NamespaceBehaviourRegistry pending it removal.

JIRA: YANGTOOLS-1499
Change-Id: Ib9f8aba1fc9dc757f2435c131a6abac8a8c91d48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoDisconnect StatementSupportBundle/NamespaceBehaviour.Registry 63/105263/3
Robert Varga [Wed, 5 Apr 2023 19:42:37 +0000 (21:42 +0200)]
Disconnect StatementSupportBundle/NamespaceBehaviour.Registry

StatementSupportBundle is a very concrete class and
NamespaceBehaviour.Registry is a general interface. There is a
connection between them in that other Registry implementations are using
StatementSupportBundle -- but other than that, there is just the
self-similar binding to StatementSupportBundle.parent.

Disconnect these two classes to allow them to go their separate ways.

JIRA: YANGTOOLS-1498
Change-Id: I177b11def897f15b1be7e251d2f1712386a102f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoAdd java.io.Serial annotation 64/105264/1
Robert Varga [Wed, 5 Apr 2023 20:03:12 +0000 (22:03 +0200)]
Add java.io.Serial annotation

Exceptions or not, tying Serializable to its constructs is always good.

Change-Id: I1386a521c093e72d17b656d7aa1b3480141feca7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoAdd ReactorStmtCtx.getStorageNodeType() 62/105262/2
Robert Varga [Wed, 5 Apr 2023 18:50:22 +0000 (20:50 +0200)]
Add ReactorStmtCtx.getStorageNodeType()

The value here is shared by all subclasses except for
RootStatementContext, reduce code duplication.

Change-Id: I958b105afe109d3d55756d98f47b4845685dccb6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove SourceSpecificContext.getRoot() 61/105261/3
Robert Varga [Wed, 5 Apr 2023 17:19:59 +0000 (19:19 +0200)]
Remove SourceSpecificContext.getRoot()

The lifecycle here is a tad wild. Make sure the BuildContext has a
well-defined API to SourceSpecificContext and thus we prevent leakage of
SourceSpecificContext internals.

Change-Id: Ic0e4d1799dd0c3248fe50a6e3837d33fd04015bb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoHide SourceSpecificContext.getYangVersion() 60/105260/2
Robert Varga [Wed, 5 Apr 2023 17:31:15 +0000 (19:31 +0200)]
Hide SourceSpecificContext.getYangVersion()

This method is only used internally, hide it.

Change-Id: I8c1d1b2a9c55969c50c8c6f5286b8f43cdceb849
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoClean up NamespaceStorageSupport 59/105259/4
Robert Varga [Wed, 5 Apr 2023 15:54:35 +0000 (17:54 +0200)]
Clean up NamespaceStorageSupport

We have:
- needlessly public methods
- missing explicit final marker
- single-caller methods

Clean all that up.

Change-Id: If0a9bb8fb60a39fc4520cb110188596771272141
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoClean up NamespaceStmtCtx 58/105258/3
Robert Varga [Wed, 5 Apr 2023 15:47:56 +0000 (17:47 +0200)]
Clean up NamespaceStmtCtx

NamespaceStmtCtx.namespaceItem() has a useless generic capture for key
argument. Remove it and update javadocs and argument names.

Change-Id: Id6cf25c19d26252fdea512fb42a10cf66290e527
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove NamespaceStmtCtx.get(All)FromNamespace() 57/105257/3
Robert Varga [Wed, 5 Apr 2023 15:31:23 +0000 (17:31 +0200)]
Remove NamespaceStmtCtx.get(All)FromNamespace()

We have a slight overlap in method, address the two TODOs and remove the
methods.

Change-Id: Ief3143075c7518d59a6d6838e0ca7d77b5f7e087
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoAdd YangTextSchemaContextResolver feature support 37/105037/22
matus.matok [Mon, 27 Mar 2023 11:31:23 +0000 (13:31 +0200)]
Add YangTextSchemaContextResolver feature support

YangTextSchemaContextResolver does not provide a facility to control the
set of supported features. Add
YangTextSchemaContextResolver.registeredFeatures() and a specialized
Set<QName> implementation to provide backwards-compatible way of
specifying features.

The specialized implementation does not completely conform to
Set.equals()/Set.hashCode() specification and we therefore need to dance
a bit around it.

JIRA: YANGTOOLS-1463
Change-Id: I443d42a6859ce97f238117fabdb7bbdd42488ee5
Signed-off-by: matus.matok <matus.matok@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoUse a switch expression in SubstatementValidator 56/105256/1
Robert Varga [Wed, 5 Apr 2023 15:28:35 +0000 (17:28 +0200)]
Use a switch expression in SubstatementValidator

An expression implies exhaustiveness, which iis a tad more defensive.

Change-Id: I5d76093a1e45e152b1e57e5c320d8a77b539bbf9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove obsolete FIXME 55/105255/1
Robert Varga [Wed, 5 Apr 2023 15:12:04 +0000 (17:12 +0200)]
Remove obsolete FIXME

Namespace type captures were removed in commit 81b0bd062d5, hence this
FIXME is no longer relevant.

Change-Id: Iece723604116d7327084b492473aa95e4be4ebc9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoClean up YangTextSchemaContextResolver 48/105248/2
Robert Varga [Wed, 5 Apr 2023 00:12:06 +0000 (02:12 +0200)]
Clean up YangTextSchemaContextResolver

Use local variable type inference and instanceof patterns to reduce
clutter a bit.

Change-Id: I955bdc8c133631cabeac138d0509b03cd679ad5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoHide RootStatementContext 37/105237/2
Robert Varga [Tue, 4 Apr 2023 22:16:39 +0000 (00:16 +0200)]
Hide RootStatementContext

This class is not used anywhere and its capabilities are already
available via RootStmtContext. Hide it from the outside world, which
fixes a module-related warning.

Change-Id: Ia234accce1814004224a7fb58ad3886fbe1ff4ef
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoImprove findFirstDeclaredSubstatement() 36/105236/1
Robert Varga [Tue, 4 Apr 2023 22:04:25 +0000 (00:04 +0200)]
Improve findFirstDeclaredSubstatement()

Remove a raw Class cast, which in turn removes the need to do unchecked
casts.

Change-Id: I4f3a58e78dc6c87866d7878383169f9efefbde94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoImprove mutatesCtxImpl() 35/105235/1
Robert Varga [Tue, 4 Apr 2023 21:54:25 +0000 (23:54 +0200)]
Improve mutatesCtxImpl()

Remove raw type cast, which removes the need for suppressions.

Change-Id: Ibab30378d693b28bbf85e3ba92607e71aa3eba84
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoImprove EffectiveInstances.attachCopy() 34/105234/1
Robert Varga [Tue, 4 Apr 2023 21:44:52 +0000 (23:44 +0200)]
Improve EffectiveInstances.attachCopy()

Use local variable type inference to reduce code clutter.

Change-Id: I52d3450d87aefbd1ae3bb806fbfd37aee52c979f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove an explicit cast from unmaskUndeclared() 33/105233/1
Robert Varga [Tue, 4 Apr 2023 21:41:43 +0000 (23:41 +0200)]
Remove an explicit cast from unmaskUndeclared()

Use an instanceof pattern to have the return readily-cast.

Change-Id: I253fc8848f828e76fb421a86430b490646bc1d9a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoImprove StatementContextBase.wrapWithOriginal() 32/105232/1
Robert Varga [Tue, 4 Apr 2023 21:28:17 +0000 (23:28 +0200)]
Improve StatementContextBase.wrapWithOriginal()

We can use local variable type inference to reduce warnings and also
instanceof pattern to remove an explicit cast.

Change-Id: I80572a5392b9a94ed46fa6fdf28cb4a21580995c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoModernize IfFeatureExpr 30/105230/2
Robert Varga [Tue, 4 Apr 2023 17:53:17 +0000 (19:53 +0200)]
Modernize IfFeatureExpr

Use local variable type inference to ditch some of the verbosity. Also
use a switch expression and add a few comments.

Change-Id: I2d1dd40028b00c756cd7e85a6b3086b6f0c63ed4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoImprove StmtContextUtils.checkFeatureSupport() 29/105229/1
Robert Varga [Tue, 4 Apr 2023 17:40:47 +0000 (19:40 +0200)]
Improve StmtContextUtils.checkFeatureSupport()

FeatureStatement is defined to have a IfFeatureExpr, bind directly to
it. This removes the dependency on Predicate, removes the need to
suppress warnings and allows the JVM to more aggressively optimize.

Change-Id: I2e9a0ed68298dd5e08738bba42a4fff0c97505a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoModernize StmtContextUtils 28/105228/1
Robert Varga [Tue, 4 Apr 2023 17:39:58 +0000 (19:39 +0200)]
Modernize StmtContextUtils

Use local variable type inference to simplify code.

Change-Id: If693e1474ee9ac675400d1092840dfc8e0238e17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMigrate yang-model-ri to JUnit 5 96/105096/3
Robert Varga [Wed, 29 Mar 2023 08:40:58 +0000 (10:40 +0200)]
Migrate yang-model-ri to JUnit 5

This is a straightforward migration.

Change-Id: I7957e83e2bd47da07194dc207aa2fd221d8acedc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMigrate yang-model-spi to JUnit5 95/105095/2
Robert Varga [Wed, 29 Mar 2023 08:34:28 +0000 (10:34 +0200)]
Migrate yang-model-spi to JUnit5

This is mostly a rewrite-driven migration.

Change-Id: Icb01d01d7cd3daa37fbdfff8b5cd932eb75e4c58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoSimplify YangParserConfiguration.equals() 70/105070/1
Robert Varga [Mon, 27 Mar 2023 19:59:01 +0000 (21:59 +0200)]
Simplify YangParserConfiguration.equals()

Use an instanceof pattern to use a simple expression.

Change-Id: Idacf5673ccde383027edcc105da72fbafce9f2f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoMigrate yang-model-util to JUnit5 54/104654/6
Robert Varga [Wed, 1 Mar 2023 11:43:31 +0000 (12:43 +0100)]
Migrate yang-model-util to JUnit5

This is an automated conversion, with migration away from Hamcrest where
useful.

Change-Id: I762d9e7b124e0b07511b847ee594e9386cae1f4d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 months agoRemove 'throws IOException' declaration 09/105009/1
Robert Varga [Fri, 24 Mar 2023 12:27:46 +0000 (13:27 +0100)]
Remove 'throws IOException' declaration

This is a code smell reported by Sonar, fix it.

Change-Id: I0a4f2155f0fbf8f69ccd7bc4a1f25202b1fc4bbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMigrate yang-model-api to JUnit5 86/104886/2
Robert Varga [Wed, 15 Mar 2023 13:10:00 +0000 (14:10 +0100)]
Migrate yang-model-api to JUnit5

This is a rather trivial migration.

Change-Id: I37f6d307a83967028c75dbfb4d57b86000f0a9f8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoOptimize StmtContextUtils.isMandatoryNode() 89/104889/1
Robert Varga [Wed, 15 Mar 2023 17:50:22 +0000 (18:50 +0100)]
Optimize StmtContextUtils.isMandatoryNode()

Use instanceof pattern and a switch expression to remove an explicit
cast and make the implementation less verbose.

Change-Id: Ic4800aac65469565f4aead71a740f96aa3d126bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove StmtContextUtils.getRootModuleQName() 88/104888/2
Robert Varga [Wed, 15 Mar 2023 17:27:35 +0000 (18:27 +0100)]
Remove StmtContextUtils.getRootModuleQName()

This method has been deprecated in previous release, remove it.

Change-Id: Id4e89f488c02cab92cefa224ebd4131b848524dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoAdd an StmtContextUtils.getModuleQName() overload 87/104887/2
Robert Varga [Wed, 15 Mar 2023 17:25:42 +0000 (18:25 +0100)]
Add an StmtContextUtils.getModuleQName() overload

We have getRootModuleQName(), which unfortunately ends up polluting
returns with nulls. Add a getModuleQName(), which does not tolerate
null argument and therefore results in a non-null return.

Migrate users and depreate getRootModuleQName() for removal.

Change-Id: Ie28ef812cab87917fbe2b6eb07142c39b857fff1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoCheck requested schema tree statement namespace 97/104197/11
Sangwook Ha [Fri, 27 Jan 2023 22:24:14 +0000 (14:24 -0800)]
Check requested schema tree statement namespace

When we have a reactor when two children of an InferredStatementContext
differ only in namespace, we cannot blindly service
requestSchemaTreeChild().

Check whether the namespaces match, as we can only materialize
statements that match our targetModule.

JIRA: YANGTOOLS-1480
Change-Id: I4d9c6e6361fe2d5383e6de43e3c1bb54bac4e935
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFix bits/instance-identifier value serdes 45/103945/18
Robert Varga [Fri, 6 Jan 2023 15:30:27 +0000 (16:30 +0100)]
Fix bits/instance-identifier value serdes

Bits and instance-identifier values need to be recognized. Fix their
serialization and parsing and enable tests.

JIRA: YANGTOOLS-1473
Change-Id: If5b40d4642e4d8353e8dfad492166987fc3c536b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
15 months agoFix identity-ref value parsing/serialization 44/103944/18
Robert Varga [Fri, 6 Jan 2023 15:30:27 +0000 (16:30 +0100)]
Fix identity-ref value parsing/serialization

When encountering a QName value in a leaf, a leaf-list or implied as the
value of a key, we need to properly encode it. The same is true when
parsing, where we have to consult current namespace mapping.

As a side-effect of this, we are also fixing the case of a leaf-list
entry referenced in a path argument -- which is important for all
non-String types.

JIRA: YANGTOOLS-1473
Change-Id: Id50ebd9a3c0c1378f1af8451b86c66e323757eba
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
15 months agoFix String value parsing/serialization 41/103941/24
Robert Varga [Fri, 6 Jan 2023 15:30:27 +0000 (16:30 +0100)]
Fix String value parsing/serialization

When encoding user-supplied values from user we need to be mindful of
their actual content: we cannot just use single quotes (') everywhere,
as the value itself can contain a single quote, in which case the
resulting string would have unbalanced quotes and nominally unparseable.

Adjust both sides of the serialization picture to account for this and
use YANG section 6.1.3 for escaping rules.

JIRA: YANGTOOLS-1473
Change-Id: I0df9beaf720a78682b6bde606a1359e7f1a09df8
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoUpdate test suite 73/104873/11
Robert Varga [Tue, 14 Mar 2023 07:49:38 +0000 (08:49 +0100)]
Update test suite

Change I6226cc8ebe48acc03a62309efec2ab205549e0fb has a few deficiencies
in the models and test consistency. Improve the tests before we start
addressing the issues.

JIRA: YANGTOOLS-1473
Change-Id: Ie1f4e5fa99a8258abe09c005d352dd971a98c051
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove AbstractImmutableNormalizedNodeBuilder 66/104866/3
Robert Varga [Mon, 13 Mar 2023 22:48:19 +0000 (23:48 +0100)]
Improve AbstractImmutableNormalizedNodeBuilder

We are accessing fields twice, which elicits an Eclipse warning about
nullability. While this cannot really happen, as the fields cannot
become null once they have been non-null, we can improve the code by
essentially providing our alternative to checkState().

Change-Id: I9263cba1a2e9b46377556de423227ee02c003982
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove ImmutableAnydataNodeBuilder null safety 65/104865/2
Robert Varga [Mon, 13 Mar 2023 22:47:39 +0000 (23:47 +0100)]
Improve ImmutableAnydataNodeBuilder null safety

Use a @NonNull annotation to fix an Eclipse warning.

Change-Id: Ibe8f8cf18c3ea7a402fac8e27c2a30b28604c6dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove OperationDefinition guarantees 82/104882/1
Robert Varga [Tue, 14 Mar 2023 20:11:39 +0000 (21:11 +0100)]
Improve OperationDefinition guarantees

We guarantee non-nullness across the board, use @NonNullByDefault
to express that.

Change-Id: I2838ff15dfe33384adc8a80a08add69200b7124c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove baseline SchemaNode in AbstractContainerSchemaNode 81/104881/1
Robert Varga [Tue, 14 Mar 2023 20:09:08 +0000 (21:09 +0100)]
Remove baseline SchemaNode in AbstractContainerSchemaNode

Creating proxies without a backing store does not make sense: enforce
the invariant.

Change-Id: Idceec078783b9419d990cded38d18b7bbc002775
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSimplify RpcContainerSchemaNode.getChildNodes() 80/104880/1
Robert Varga [Tue, 14 Mar 2023 19:58:02 +0000 (20:58 +0100)]
Simplify RpcContainerSchemaNode.getChildNodes()

RPC guarantees input and output being non-null, eliminate dead code
pointed out by Eclipse.

Change-Id: Ic8d0ed02bffbec7c66eeb63e964e17e8ac4a2a79
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMake AbstractContainerSchemaNode generic 79/104879/1
Robert Varga [Tue, 14 Mar 2023 20:02:50 +0000 (21:02 +0100)]
Make AbstractContainerSchemaNode generic

This is a private superclass shared by two subclasses, which each store
the same object in an additional field. Make the superclass generic,
eliminating a field.

Change-Id: I27552291dd1f2d9bae45ba883ae6d28f28e78870
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMigrate yang-data-util to JUnit5 76/104876/1
Robert Varga [Tue, 14 Mar 2023 13:50:39 +0000 (14:50 +0100)]
Migrate yang-data-util to JUnit5

This is mostly automated conversion, but also ditch
assertThat()/instanceOf() in favor of assertInstanceOf().

Change-Id: I4de1cb05a358cb694e2b68537179feeb08e76267
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove XmlCodecFactory a bit 75/104875/1
Robert Varga [Tue, 14 Mar 2023 12:37:00 +0000 (13:37 +0100)]
Improve XmlCodecFactory a bit

Remove an unneeded cast in test code by exposing the fact that
instanceIdentifierCodec() operates on YangInstanceIdentifier.

JIRA: YANGTOOLS-1473
Change-Id: Ib915a0b4c93674e1e266359070bb6b06da20094c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoInline NamespaceStorageSupport.accessNamespaces() 56/104856/3
Robert Varga [Mon, 13 Mar 2023 18:26:21 +0000 (19:26 +0100)]
Inline NamespaceStorageSupport.accessNamespaces()

We have multiple callers, but all of duplicate the functionality
of getLocalNamespace(). Inline accessNamespaces() into
getLocalNamespace() and adjust users to use that instead duplicating its
code.

This removes a the need for a number of warning suppressions and makes
it clearer as to what is going on.

Change-Id: Ia210c6275b64093063eaf58a67412e94c3a29419
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoUse an instanceof pattern 55/104855/3
Robert Varga [Mon, 13 Mar 2023 18:21:06 +0000 (19:21 +0100)]
Use an instanceof pattern

InferredStatementContext uses check-and-cast, which we can simplify for
Java 17.

Change-Id: I7bba54874bd19ff0de79d665879003c82b3e8cac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoUse local variable type inference a bit more 53/104853/1
Robert Varga [Mon, 13 Mar 2023 17:00:48 +0000 (18:00 +0100)]
Use local variable type inference a bit more

Reduce verbosity by using local variable type inference.

Change-Id: I8e02d0642b6e28052332a5f5dd5e9601442af8db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove a naked cast 52/104852/1
Robert Varga [Mon, 13 Mar 2023 17:00:07 +0000 (18:00 +0100)]
Remove a naked cast

We have a utility to perform a checked cast, use that instead to improve
defensiveness.

Change-Id: Id20c0690bc36ecd3eea0fc902c727d78450bdccd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDo not emit phase in AbstractPathPrerequisite 43/104843/4
Robert Varga [Mon, 13 Mar 2023 14:48:56 +0000 (15:48 +0100)]
Do not emit phase in AbstractPathPrerequisite

This is always a constant, remove it from toString()

Change-Id: Ifc914d800093ad2d1084bc25466e92fde2ce7da2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove AbstractPathPrerequisite.modPhase 42/104842/4
Robert Varga [Mon, 13 Mar 2023 14:47:01 +0000 (15:47 +0100)]
Remove AbstractPathPrerequisite.modPhase

AbstractPathPrerequisite always operates on EFFECTIVE_MODEL, inline
the constant, simplifying interactions a bit.

Change-Id: I916fef0f476969620a7cfc7010de30e9633eb72b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoEliminate ModelActionBuilder.requiresCtxPath() 41/104841/4
Robert Varga [Mon, 13 Mar 2023 14:41:58 +0000 (15:41 +0100)]
Eliminate ModelActionBuilder.requiresCtxPath()

There is only a single user of this method, which specifies
EFFECTIVE_MODEL argument, which the implementation hard-codes instead of
using the argument.

Introduce requiresEffectiveCtxPath() which makes the processing phase
implicit and inline the phase to prerequisite implementations.

Change-Id: I9072fe022600f0b24179aaad08c05cfcce2604e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFix augment/deviate mechanics 91/104291/5
Sangwook Ha [Mon, 30 Jan 2023 21:50:33 +0000 (13:50 -0800)]
Fix augment/deviate mechanics

Parsing of YANG models with a deviation fails if the deviation target
node is conditionally augmented based on a feature.

The problem is we are reusing are reusing setUnsupported() for two
cases: when the feature is not supported and when the target is not
available.

Separate the second case into a separate boolean, and if the target is
available, propagate children to target as unsupported -- which makes
namespace resolution work correctly and deviate properly sees the
children as unsupported.

JIRA: YANGTOOLS-1485
Change-Id: I954185dd0067667faae8073e222f07b65907e675
Signed-off-by: Sangwook Ha <sangwook.ha@verizon.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSimplify ModifierImpl.contextImpl() 44/104844/2
Robert Varga [Mon, 13 Mar 2023 15:04:36 +0000 (16:04 +0100)]
Simplify ModifierImpl.contextImpl()

Use an instanceof pattern to make the check we are making more
transparent.

Change-Id: If6d92be744e1e063f96feb7428c09c4984cf2c9a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRehost file deletion 14/104814/1
Robert Varga [Thu, 9 Mar 2023 19:26:24 +0000 (20:26 +0100)]
Rehost file deletion

YangToSourceState is a simple DTO, but we really want to host some
utilities here. Wiping output files is one of them.

This also means we never deal with a null state, making
IncrementalBuildSupport simpler.

JIRA: YANGTOOLS-745
Change-Id: I6c5190275742c8518149cac70dfe7586f579e451
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoExecute yang-maven-plugin during incremental builds 12/104612/25
Robert Varga [Sun, 26 Feb 2023 20:36:02 +0000 (21:36 +0100)]
Execute yang-maven-plugin during incremental builds

We have all the bits and pieces to deal with incremental builds, enable
execution when just partial changes occur.

JIRA: YANGTOOLS-745
Change-Id: I0971d09476a0a5dcd842636fa61567e2d0ef05f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoImprove FileState.ofFile() overheads 13/104813/1
Robert Varga [Thu, 9 Mar 2023 19:12:17 +0000 (20:12 +0100)]
Improve FileState.ofFile() overheads

We do not need the actual bytes read, hence we loop using a small-ish
buffer.

JIRA: YANGTOOLS-745
Change-Id: I2e35e3965c0a30a3d8368eeee45f5485a1765d29
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoIntegrate IncrementalBuildSupport 41/103141/71
Ruslan Kashapov [Tue, 8 Nov 2022 09:39:35 +0000 (11:39 +0200)]
Integrate IncrementalBuildSupport

IncrementalBuildSupport guides incremental/resumed execution, in that it
compares inputs to previous state as well as carefully updating output
to match the intended codegen output.

The process is sensitive to losing previously-generated files, but
allows persistent files to be updated. If some files magically
appear/disappear, we trigger a generation cycle.

JIRA: YANGTOOLS-745
Change-Id: I6f8cbf03a52542e8c20fd1383d459056272f951a
Signed-off-by: Ruslan Kashapov <ruslan.kashapov@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDefine FileGeneratorArg equality 12/104812/2
Robert Varga [Thu, 9 Mar 2023 18:07:42 +0000 (19:07 +0100)]
Define FileGeneratorArg equality

We are relying on equality to detect changes. Make sure that equality is
not identity.

JIRA: YANGTOOLS-745
Change-Id: I13b62b12ed9af7e80c4c3e883730b7e5e39e0240
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoFix CapturingOutputStream size accounting 11/104811/2
Robert Varga [Thu, 9 Mar 2023 18:02:02 +0000 (19:02 +0100)]
Fix CapturingOutputStream size accounting

Superclass bulk write method is off-loading to the single-byte write
method, leading to us seeing the size as double of what it is.

Rework the class so we forward methods directly, which has the added
benefit of improving performance.

JIRA: YANGTOOLS-745
Change-Id: I725a0771c807228b193eb1cea16abc5725cd70b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDelete previous output state on execution skip 09/104809/3
Robert Varga [Thu, 9 Mar 2023 15:47:57 +0000 (16:47 +0100)]
Delete previous output state on execution skip

Address two FIXMEs related to wiping actual state: when there are no
input files or no code generators, we should be wiping all of our
previous state.

JIRA: YANGTOOLS-745
Change-Id: Iaf1a7d9d3f8993af75ace5b8092c5e3c2f6f2bde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDitch use of Files.createParentDirs() 10/104810/2
Robert Varga [Thu, 9 Mar 2023 15:54:31 +0000 (16:54 +0100)]
Ditch use of Files.createParentDirs()

We have Files.createDirectories() which has a tad nicer behaviour,
use that instead of a Guava utility.

JIRA: YANGTOOLS-745
Change-Id: I766469340fe8628ed70a2dd933c89191f661f70f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMove model addition out of the loop 08/104808/1
Robert Varga [Thu, 9 Mar 2023 14:32:27 +0000 (15:32 +0100)]
Move model addition out of the loop

Normalized names for YANG files in the project should be output outside
of the per-generator task.

JIRA: YANGTOOLS-745
Change-Id: Id15d9ba6a5786eb54fb39d0c9f50c62672df82f0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoCompare existing and generated output 07/104807/3
Robert Varga [Thu, 9 Mar 2023 13:08:20 +0000 (14:08 +0100)]
Compare existing and generated output

Before we overwrite a particular file we need to make sure that update
is actually needed. This adds the smarts to suppress such modifications
and notify BuildContext only when things change.

JIRA: YANGTOOLS-745
Change-Id: I17760f3342112343cd67f248d6374fd37710284d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSimplify DEFAULT_PARSER_FACTORY instantition 99/104799/4
Robert Varga [Tue, 7 Mar 2023 23:17:54 +0000 (00:17 +0100)]
Simplify DEFAULT_PARSER_FACTORY instantition

Use a plain assignment in a try/catch block. This favors the usual
case of no problem at instantiation.

Change-Id: I04b56aac2feae11078c5ca4bc42aa010cbf0cce0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoSimplify YangProvider 98/104798/2
Robert Varga [Tue, 7 Mar 2023 23:10:53 +0000 (00:10 +0100)]
Simplify YangProvider

This is a stateless abstract class. Turn it it into a simple functional
interface and move the default implementation to YangToSourcesProcessor,
simplifying test invocations.

Change-Id: Iaaf1d76092bc3a52d7364363a2852309e44f9648
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoEliminate YangProvider.setResource() 97/104797/1
Robert Varga [Tue, 7 Mar 2023 22:48:07 +0000 (23:48 +0100)]
Eliminate YangProvider.setResource()

ProjectFileAccess is a better place for this method, as it pertains
to a Project and we are already doing the same thing there.

The result is a bit better integration with YangToSourcesProcessor.

JIRA: YANGTOOLS-745
Change-Id: I768d49271a24ef93c4b6b9136cc7d276a83eaed2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove GeneratedDirectories 96/104796/1
Robert Varga [Tue, 7 Mar 2023 22:28:31 +0000 (23:28 +0100)]
Remove GeneratedDirectories

GeneratedDirectories is useless as a separate object because its
instance methods have a single caller site. Inline the users, so we
remove one level of indirection.

This exposes the duplication of "generated-sources" name, which needs to
be further centralized, depending on how things pan out looking.

JIRA: YANGTOOLS-745
Change-Id: Ie7706cda2a661c6c1c7983e0edc67826dc21ee06
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMerge GeneratorTask(Factory) 95/104795/3
Robert Varga [Tue, 7 Mar 2023 21:39:10 +0000 (22:39 +0100)]
Merge GeneratorTask(Factory)

GeneratorTask is hidden behind a mostly-useless factory, merge the two
concepts to simplify interactions. This enables us to better integrate
with build cycle.

JIRA: YANGTOOLS-745
Change-Id: I30db56e60c69ee2893999e41764ca6a6071e632b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoEncapsulate GeneratorTask 94/104794/2
Robert Varga [Tue, 7 Mar 2023 21:33:13 +0000 (22:33 +0100)]
Encapsulate GeneratorTask

The distinction between GeneratorTask and GeneratorTaskFactory is very
moot. Simplify the interface to YangToSourcesProcessor, which enables us
to merge the two classes.

JIRA: YANGTOOLS-745
Change-Id: I672b3f0bc420baccfd8d7601c7420fd1b6bebcab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoRemove ParserConfigAware 93/104793/1
Robert Varga [Tue, 7 Mar 2023 21:26:31 +0000 (22:26 +0100)]
Remove ParserConfigAware

This is a useless indirection, of which one implementation is completely
unused. Remove it, paving the way for further simplification.

JIRA: YANGTOOLS-745
Change-Id: Ie6084a2ef1afee68d9f8f4cc5bec9a9b8a356d8e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoEncapsulate project directory access 92/104792/3
Robert Varga [Tue, 7 Mar 2023 20:47:37 +0000 (21:47 +0100)]
Encapsulate project directory access

The access fact that a GeneratorTask has accessed a particular project
directory needs to be mediated. Add ProjectFileAccess to act as an
intermediary, so that the fact we generate files and Project
modifications can be disconnected.

JIRA: YANGTOOLS-745
Change-Id: Ib550a9c30936444a0077b6f08a3f1e85184173a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDo not use optional in createReactor() 91/104791/1
Robert Varga [Tue, 7 Mar 2023 18:29:45 +0000 (19:29 +0100)]
Do not use optional in createReactor()

We only ever return non-empty, codify that fact.

JIRA: YANGTOOLS-745
Change-Id: I25c2d791f024a44bcf0417379dfb30951393ef32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoDo not pass BuildContext to GeneratorTask 90/104790/1
Robert Varga [Tue, 7 Mar 2023 18:21:20 +0000 (19:21 +0100)]
Do not pass BuildContext to GeneratorTask

We have previously decomposed OutputStream creation and refresh
notification. Now move the refresh notification processing to
YangToSourcesProcessor.

This improves the plugin in that:
- WriteTask is simpler (and smaller in some runtimes)
- BuildContext interactions are more localized
- BuildContext executes on the initial thread, improving its
  confinement

JIRA: YANGTOOLS-745
Change-Id: Ia192dbe5134349a78f2290bbf7a9b7ff9d236746
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoInline generateSources() 89/104789/1
Robert Varga [Tue, 7 Mar 2023 18:07:36 +0000 (19:07 +0100)]
Inline generateSources()

This method has direct interactions with output collection. We are set
to change that integration and this inlining has the added benefit of
removing one intermediate collection.

JIRA: YANGTOOLS-745
Change-Id: Ice993375011fd31a3ec80771b0a3d056b921cb68
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoObsolete Sodium SR1 streams 51/102951/8
Robert Varga [Fri, 28 Oct 2022 23:03:27 +0000 (01:03 +0200)]
Obsolete Sodium SR1 streams

We nominally support reading Sodium SR1 streams, but do not support writing
them out.

JIRA: YANGTOOLS-1492
Change-Id: Iec194a9f411f926996175781eeeb770a5f6884a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoObsolete Neon SR2 streams 50/102950/7
Robert Varga [Fri, 28 Oct 2022 22:44:28 +0000 (00:44 +0200)]
Obsolete Neon SR2 streams

We nominally support reading Neon SR2 streams, but do not support writing
them out.

JIRA: YANGTOOLS-1492
Change-Id: Ia4655366357ce68f9dd18492f77c1f297658d26d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoObsolete Lithium streams 49/102949/4
Robert Varga [Fri, 28 Oct 2022 22:33:55 +0000 (00:33 +0200)]
Obsolete Lithium streams

We nominally support reading Lithium streams, but do not support writing
them out.

JIRA: YANGTOOLS-1492
Change-Id: Ibb820b5ee19ccb188dd1d0603eefe5133e1ff403
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoAdd AbstractQName.unbind() 08/104208/4
Robert Varga [Tue, 31 Jan 2023 22:43:44 +0000 (23:43 +0100)]
Add AbstractQName.unbind()

Acquiring a simple, namespace-free UnresolvedQName.Unqualified is
usefule in a few contexts, where we for convenience now require
AbstractQName (and document we only use its localName).

Introduce AbstractQName.unbind(), which returns an Unqualified object,
so that these users can be more expressive and can use direct equals
comparisons.

Change-Id: I1a485e05d2bb13c2012fc017a6b30795a8891a80
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
15 months agoMove QNameAwareData{Input,Output} 78/104778/1
Robert Varga [Mon, 6 Mar 2023 14:55:42 +0000 (15:55 +0100)]
Move QNameAwareData{Input,Output}

Having these interfaces in QName makes it harder to interact with QName,
as they end up being completed into context where we have static
methods.

Change-Id: I8bf3e5bf8f414fcbee60b7120f7ccb7a9acedc33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>