yangtools.git
4 years agoMerge branch 'master' of ../controller
Anil Belur [Thu, 31 Oct 2019 14:28:57 +0000 (19:58 +0530)]
Merge branch 'master' of ../controller

Change-Id: I3611c067a26521829ae9212e4be1ed44acbd7dd2

4 years agoAdd static ArgumentUtils XPath integration 25/85425/12
Robert Varga [Tue, 29 Oct 2019 21:44:25 +0000 (22:44 +0100)]
Add static ArgumentUtils XPath integration

YANG parser needs to interpret when/must expressions so that they
can be used by downstreams in their effective view.

We add static binding of rfc7950.stmt to an implementation of
YangXPathParserFactory. This makes it clear we do not need to
actually store URIs to make things useful, hence we deprecate
URIStringToImportPrefix namespace.

JIRA: YANGTOOLS-966
Change-Id: Iaf771ad5e0bcdd058fe537ed67d5c9e4e6556e81
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd YangXPathExpression.getYangVersion() 43/85443/4
Robert Varga [Wed, 30 Oct 2019 20:21:10 +0000 (21:21 +0100)]
Add YangXPathExpression.getYangVersion()

Retrofit awareness of features contained in a particular expression,
so that runtime can properly evaluate them.

Also update parser to intercept RuntimeExceptions and turn them into
checked XPathExpressionExceptions.

JIRA: YANGTOOLS-1036
Change-Id: I7beab757d6f8fa45f9064a77b6c20f2076903b8e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpose minimum YANG version for YangFunction 32/85432/2
Robert Varga [Wed, 30 Oct 2019 13:44:56 +0000 (14:44 +0100)]
Expose minimum YANG version for YangFunction

Not all YangFunctions are available when we are operating in RFC6020
mode. This patch exposes the minimum YANG version from YangFunction,
so it can be checked at runtime.

JIRA: YANGTOOLS-1036
Change-Id: Ieedd58202dd14be9da7cd079c5180e92450c9e5b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd a FIXME guide to YANGTOOLS-784 34/85334/5
Robert Varga [Tue, 22 Oct 2019 20:41:21 +0000 (22:41 +0200)]
Add a FIXME guide to YANGTOOLS-784

This just drops some clarification into code as I am in the area.
This needs to be cleaned up when the issue is addressed.

JIRA: YANGTOOLS-784
Change-Id: I988c43731480a399d6d8faa71fb00fa1acaa8d7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReinstate "Check for nested augmentations" 33/85333/5
Robert Varga [Tue, 22 Oct 2019 20:20:00 +0000 (22:20 +0200)]
Reinstate "Check for nested augmentations"

This reverts commit 02fa7531709e3c4599bc9ec23dc605a21a711bc1, effectively
re-applying 759e69d85991edb987a760165adb83fa3f2ab67b.

We also add the mechanics needed to walk the copy history backwards, as
needed to understand the copy process.

JIRA: YANGTOOLS-956
Change-Id: I96b3afb30fdcd326ef9b780ff02ccc7f1c94e07e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd lenient JsonParserStream 55/85355/1
serngawy [Tue, 15 Oct 2019 20:00:59 +0000 (16:00 -0400)]
Add lenient JsonParserStream

It is beneficial to have the JSON parser ignore unknown constructs,
so that all other data gets parsed successfully.

This patch adds JsonParserStream.createLenient() to return such
parsers.

JIRA: YANGTOOLS-1034
Change-Id: I5ec9dbbf6dc52270bf83d7c4ed6c4d16181f74a7
Signed-off-by: serngawy <m.elserngawy@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 50ba8458e9b8eb48cd47ecf8d0a0f6fb1d83d812)
(cherry picked from commit be62b4e0494ae2b551373760c4da1b03ff19df83)

4 years agoAdd OperationAsContainer @NonNull annotations 29/85229/2
Robert Varga [Sat, 19 Oct 2019 07:05:46 +0000 (09:05 +0200)]
Add OperationAsContainer @NonNull annotations

This makes working with the class easier a bit.

Change-Id: Ica69b5517b5feb9a55c20dbb9fe465ad9081ba23
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 4.0.3-SNAPSHOT 57/85257/2
Robert Varga [Sun, 20 Oct 2019 08:24:59 +0000 (10:24 +0200)]
Bump versions to 4.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: Idf713e64dae9a78c043aefa8d5075386d6be4672
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 6.0.1 92/85192/2
Robert Varga [Thu, 17 Oct 2019 22:40:25 +0000 (00:40 +0200)]
Bump odlparent to 6.0.1

This bumps odlparent to 6.0.1, picking up latest updates.

Change-Id: Ib0ee6b87c716e436c3cc009eba07022feebd3d3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix foldable trigraphs 96/85196/1
Robert Varga [Fri, 18 Oct 2019 08:22:27 +0000 (10:22 +0200)]
Fix foldable trigraphs

Sonar correctly points out the expression can be simplified, this
patch does exactly that.

Change-Id: I0ea51d18d551be0f4bd416d7b18da3eb543e0244
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup code smells reported by sonar 94/85194/1
Robert Varga [Fri, 18 Oct 2019 08:02:28 +0000 (10:02 +0200)]
Cleanup code smells reported by sonar

We are duplicating code here, so introduce a check-and-cast method
and use that from the 5 callsites.

Change-Id: Ic1b734f62cb2d79b8dd28a1fcee76cbffea72c33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse careful byte-masking/shifting in Mg Input
Robert Varga [Mon, 14 Oct 2019 08:16:02 +0000 (10:16 +0200)]
Use careful byte-masking/shifting in Mg Input

We really want to operate on byte and not int, the bytes are to
be treated as unsigned, which gets wrecked by sign extension.

Introduce an explicit mask(byte, byte) method and use it where
we are potentially sign-extending.

JIRA: CONTROLLER-1919
Change-Id: I0484f440c1589859fb268947f5a80a2b4969451e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd utility converters 97/85097/5
Robert Varga [Sun, 13 Oct 2019 08:40:36 +0000 (10:40 +0200)]
Add utility converters

This adds toUint{8,16,32,64} methods to ease conversion between
Uint types.

JIRA: YANGTOOLS-1033
Change-Id: I010a9103e2115e7808aa7d04ea9a5b41ab12ddd6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd Uint constants 96/85096/3
Robert Varga [Sun, 13 Oct 2019 08:33:56 +0000 (10:33 +0200)]
Add Uint constants

This adds TWO/TEN constants to all Uint types as well some more
javadocs.

JIRA: YANGTOOLS-1032
Change-Id: I66cce018e99fdbf4c4824415fe23f112f7e6ab53
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate old MD-SAL APIs for removal
Robert Varga [Tue, 1 Oct 2019 17:05:29 +0000 (19:05 +0200)]
Deprecate old MD-SAL APIs for removal

These APIs are slated for removal in Aluminium, make sure our
warning is more stern.

JIRA: CONTROLLER-1917
Change-Id: Ib4f7dcfd5183b87dd10b9ce2b773a59a548892c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDisable slf4j SSL link 54/85054/1
Robert Varga [Fri, 11 Oct 2019 12:01:15 +0000 (14:01 +0200)]
Disable slf4j SSL link

slf4j does not provide apidocs over TLS, link HTTP site instead.

Change-Id: I2158c043a2d9e810a329587159fc6af9d57d8e56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove CheckedFuture from RemoteSchemaProvider
Robert Varga [Thu, 10 Oct 2019 12:05:49 +0000 (14:05 +0200)]
Remove CheckedFuture from RemoteSchemaProvider

The API contract we are implementing is defined in terms of
ListenableFuture, hence we can drop the use of CheckedFuture.

Change-Id: I9d99b2e42c3995c4c11b44e595a81a93b2b31b7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd type-bound equals() to common int types 31/85031/3
Robert Varga [Thu, 10 Oct 2019 10:36:57 +0000 (12:36 +0200)]
Add type-bound equals() to common int types

This adds additional Object.equals() flavors to bind to smaller methods
when the objects are known to be of matching types (but still nullable).

JIRA: YANGTOOLS-1030
Change-Id: I4c750e135069692682ba65b21503345fc682051a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix Decimal64.equals() 30/85030/2
Robert Varga [Thu, 10 Oct 2019 10:29:23 +0000 (12:29 +0200)]
Fix Decimal64.equals()

There is a typo here, which would end up not comparing objects
properly.

Change-Id: I5cfe31887b109bbe7be6e564078f250ea6b61747
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump yangtools to 4.0.1
Robert Varga [Tue, 20 Aug 2019 14:37:51 +0000 (16:37 +0200)]
Bump yangtools to 4.0.1

This bumps yangtools to 4.0.1 as part of Magnesium MRI.

Change-Id: I1ac7d3f856af310f4e8015875223d30eac3a8276
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAddress Java-9-dependent FIXMEs 46/83746/3
Robert Varga [Mon, 19 Aug 2019 07:35:14 +0000 (09:35 +0200)]
Address Java-9-dependent FIXMEs

Since we are building for Java 11, we can use proper StringBuilder
instead of StringBuffer.

Change-Id: I1971f91e661f411560a52af0df759915278aa154
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse varhandles in InMemoryDataTree 33/84233/5
Robert Varga [Thu, 5 Sep 2019 19:38:45 +0000 (21:38 +0200)]
Use varhandles in InMemoryDataTree

We are publishing only current state, so we should be fine accessing
it through getAcquire() memory semantics.

JIRA: YANGTOOLS-1024
Change-Id: I63286a347b9305a01eb1899e310995737dfa6e7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove InMemoryDataTreeModification.isSealed() performance 61/82561/7
Robert Varga [Tue, 18 Jun 2019 21:32:22 +0000 (23:32 +0200)]
Improve InMemoryDataTreeModification.isSealed() performance

The check for the modification being sealed does not need to really
establish a barrier between individual accesses. Use VarHandles to
express that the check needs to be ordered only before seal().

JIRA: YANGTOOLS-1025
Change-Id: I86433a95c3321e3bcabec9bba0f5a772556e1af4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMinimize antlr configuration 95/84995/3
Robert Varga [Tue, 8 Oct 2019 19:56:33 +0000 (21:56 +0200)]
Minimize antlr configuration

Now hat the configuration is pretty much what the default would be,
make sure we do not override properties we do not have to.

Change-Id: Ib845fd83d2fd68ad13e73934b620f9204f4f013c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoLeafEffectiveStatement should be a DataTreeEffectiveStatement 88/84988/3
Robert Varga [Tue, 8 Oct 2019 11:21:14 +0000 (13:21 +0200)]
LeafEffectiveStatement should be a DataTreeEffectiveStatement

This is a conflicting model, which should understand it has conflicting
children.

JIRA: YANGTOOLS-857
Change-Id: I1bca05f9a3f053419d518ef2c9966978901b419f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove maven.compiler.release overrides 92/84992/4
Robert Varga [Tue, 8 Oct 2019 19:22:12 +0000 (21:22 +0200)]
Remove maven.compiler.release overrides

Now that the antlr configuration has been fixed, we can remove
the invalid overrides.

Change-Id: Id2f063a6b74be2a2e9081153ed22c275980c4114
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup yang-data-impl antlr configuration 94/84994/1
Robert Varga [Tue, 8 Oct 2019 19:31:44 +0000 (21:31 +0200)]
Cleanup yang-data-impl antlr configuration

This fixes up a long-standing issue with how antlr is configured,
fixing javadoc plugin interaction in the process.

Change-Id: I5c6ad385196f237b5a5eae110948cbf2ae2792e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup yang-xpath-impl antlr configuration 93/84993/1
Robert Varga [Tue, 8 Oct 2019 19:28:16 +0000 (21:28 +0200)]
Cleanup yang-xpath-impl antlr configuration

This fixes up a long-standing issue with how antlr is configured,
fixing javadoc plugin interaction in the process.

Change-Id: I4c94aa50c44dc5fc6268d94739e50ef27e868cde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup yang-parser-rfc7950 antlr configuration 90/84990/2
Robert Varga [Tue, 8 Oct 2019 17:08:15 +0000 (19:08 +0200)]
Cleanup yang-parser-rfc7950 antlr configuration

This fixes up a long-standing issue with how antlr is configured,
fixing javadoc plugin interaction in the process.

Change-Id: Ia077b7b2f777203baea8aad3400abd484e3e6801
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove jacoco/surefire configration 89/84989/1
Robert Varga [Tue, 8 Oct 2019 15:33:03 +0000 (17:33 +0200)]
Remove jacoco/surefire configration

This configuration does not seem to serve any purpose, remove it.

Change-Id: I1b0c714fbb9f347011d6e4869d64886fecf11c62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoClose JSON root context when the writer is closed 82/84982/1
Robert Varga [Mon, 7 Oct 2019 15:19:34 +0000 (17:19 +0200)]
Close JSON root context when the writer is closed

We should be closing the root context when we are closed, not when
a its child is closed -- otherwise it would be impossible to write
multiple children of the root context.

Since we are in the area, also centralize some QName/ContainerNode
creation.

JIRA: YANGTOOLS-1029
Change-Id: I599fb5ad1ad8e36a441dff761984d5406e401d55
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit f8e3d9af24d8d5d1eeca6a714d29f9822537a773)

4 years agoUse ReusableNormalizedNodeReceiver
Robert Varga [Fri, 27 Sep 2019 05:12:32 +0000 (07:12 +0200)]
Use ReusableNormalizedNodeReceiver

This simplifies some APIs by using ReusableStreamReceiver, as it
is an API-level construct rather than a particular implementation.

Change-Id: Id9d14d512ac7150a3e71c104577546e219cd86d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRepresent large number types as strings 75/84775/11
Mario Abraham [Fri, 27 Sep 2019 09:00:08 +0000 (11:00 +0200)]
Represent large number types as strings

A value of the int64, uint64 and decimal64 type is
represented as a JSON string related to rfc 7951.

Issue-ID: YANGTOOLS-1027
Change-Id: Ic6aea0a0f97e042ed40d2e0be323557750401621
Signed-off-by: Mario Abraham <mario.abraham@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoShortcut Collections.sort() 61/84961/1
Robert Varga [Mon, 7 Oct 2019 09:12:01 +0000 (11:12 +0200)]
Shortcut Collections.sort()

We have a concrete List implementation, hence we can use List.sort()
directly.

Change-Id: I4baa0f41ee34479b5a915d6e3670029553b48b82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpecialize JSONInstanceIdentifierCodec 21/84921/1
Robert Varga [Sat, 5 Oct 2019 11:16:57 +0000 (13:16 +0200)]
Specialize JSONInstanceIdentifierCodec

We do not want to force RFC7951 to instantiate the old lhotka-02
codec if we are not using it. Make JSONInstanceIdentifierCodec
an abstract class and specialize it as
Lhotka02JSONInstanceIdentifierCodec, so we have two distinct
concrete classes.

Change-Id: Icb30d97ec9134e8dc368775e48b93ef042ed9121
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 4.0.2-SNAPSHOT 75/84875/1
Robert Varga [Wed, 2 Oct 2019 12:12:32 +0000 (14:12 +0200)]
Bump versions to 4.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: Ic8984f84bd1c3258cd4084110d5486085c498cbe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix Uint64 cache lookup 73/84873/1
Robert Varga [Wed, 2 Oct 2019 11:13:13 +0000 (13:13 +0200)]
Fix Uint64 cache lookup

Looking up a value which has its 32 least significant bits set to
zero will lead to Uint64.ZERO being returned. This also affects other
values which have LSB bits set so that they match cache length.

Fix this by comparing the long value with cache length, so we get
an accurate check.

JIRA: YANGTOOLS-1028
Change-Id: I33bf061e5ff486beaf034cab7827f93e93003489
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoConvert yang-common to a JPMS module 19/84019/6
Robert Varga [Tue, 27 Aug 2019 21:03:20 +0000 (23:03 +0200)]
Convert yang-common to a JPMS module

This drops plugin configuration in favor of declaring a module. It
allows us to ditch metainf-services as ServiceLoader bindings are
now explicit.

Change-Id: Ie160bbf551f4bbca424978215400c78d4b305334
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake concepts an explicit module 20/83920/7
Robert Varga [Thu, 22 Aug 2019 18:05:03 +0000 (20:05 +0200)]
Make concepts an explicit module

This adds module-info, turning concepts into a full-pledged module.

Change-Id: I3225cb148364818ff2ff1c0abac0ebf90c4f198c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove AbstractRegistration.isClosed() performance 60/82560/6
Robert Varga [Tue, 18 Jun 2019 21:23:03 +0000 (23:23 +0200)]
Improve AbstractRegistration.isClosed() performance

The check for the registration being closed does not need to be
ordered with other access, except close(). Using VarHandles, we
can express the check in terms for getAcquire().

Change-Id: Idf685e8adafbe102c4c65f735d872a1f4b801188
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 4.0.1-SNAPSHOT 48/84848/1
Robert Varga [Tue, 1 Oct 2019 12:21:01 +0000 (14:21 +0200)]
Bump versions to 4.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: I91bf47f8d49bb07de626fb059e22a67234c2974d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix EffectiveStatement namespace access 36/84836/4
Robert Varga [Tue, 1 Oct 2019 09:05:48 +0000 (11:05 +0200)]
Fix EffectiveStatement namespace access

We really want to use empty maps and optionals in this interface
contract -- do that now.

Change-Id: Ibfc72d29ff24c592e2a81ad894bb0b9f8f683f6d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove DataTreeCandidateNodes.fromNormalizedNode() 31/84831/3
Robert Varga [Tue, 1 Oct 2019 08:35:10 +0000 (10:35 +0200)]
Remove DataTreeCandidateNodes.fromNormalizedNode()

This has been replaced by written(), remove it now.

Change-Id: Ie4e939cef75240a72556df7599d492dc2033db39
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate DataSchemaContextTree.getChild() for removal 32/84832/2
Robert Varga [Tue, 1 Oct 2019 08:37:29 +0000 (10:37 +0200)]
Deprecate DataSchemaContextTree.getChild() for removal

This strengthens deprecation, preparing for its removal.

Change-Id: I97e8fbe1953d103eceb1fa37181f2caa84820d90
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove AugmentToChoiceNamespace 35/84835/2
Robert Varga [Tue, 1 Oct 2019 08:44:33 +0000 (10:44 +0200)]
Remove AugmentToChoiceNamespace

This namespace has been deprecated for removal, as it is not used
anywhere. Remove it now.

Change-Id: Ia199971ab5651fbf4eac74528668b74fd738e403
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove ImplicitCaseSchemaNode 34/84834/2
Robert Varga [Tue, 1 Oct 2019 08:42:44 +0000 (10:42 +0200)]
Remove ImplicitCaseSchemaNode

As noted in deprecation noticed, this class is a former remnant,
we can remove it safely.

Change-Id: I9c730a14299a318664eab76b70ea72aee439f964
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPush out FIXMEs to 5.0.0 33/84833/4
Robert Varga [Tue, 1 Oct 2019 08:34:46 +0000 (10:34 +0200)]
Push out FIXMEs to 5.0.0

This another round of pushing out FIXMEs.

Change-Id: I4163a08d275ff4c608bc0678a220c6436a215d4d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSwitch BasicCodeGenerator to use EffectiveModelContext 16/84816/2
Robert Varga [Mon, 30 Sep 2019 18:13:17 +0000 (20:13 +0200)]
Switch BasicCodeGenerator to use EffectiveModelContext

This rolls out EffectiveModelContext to codegen plugins, so they
can take advantage of it.

JIRA: MDSAL-435
Change-Id: I94d7385d29962e281a55b5e0522f7bc198648175
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake DataTree take EffectiveModelContext 15/84815/4
Robert Varga [Mon, 30 Sep 2019 15:46:13 +0000 (17:46 +0200)]
Make DataTree take EffectiveModelContext

This deprecates setSchemaContext() in favor of
setEffectiveModelContext(), so that users are encouraged to
migrate.

JIRA: MDSAL-435
Change-Id: If859130e204a058f89c2fee04d4be69969215399
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAllow startAnyxmlNode() to handle differing object models 07/84807/6
Robert Varga [Mon, 30 Sep 2019 09:40:29 +0000 (11:40 +0200)]
Allow startAnyxmlNode() to handle differing object models

Anyxml can have a number of underlying object models, with the most
common being DOMSource. This changes the entrypoint to work the same
as anydata, allowing implementations to support different models.

Change-Id: I06ec1e5d46e7bc2287b239ea97811d58544c8c2b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpose EffectiveModelContext from YangParserTestUtils 14/84814/3
Robert Varga [Mon, 30 Sep 2019 15:41:27 +0000 (17:41 +0200)]
Expose EffectiveModelContext from YangParserTestUtils

We want to start using effective statements for as many operations
as possible -- make sure it is convenient to do so.

JIRA: MDSAL-435
Change-Id: I480475f40356d097c6769253aac0b18453d94153
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPush out FIXMEs to 5.0.0 11/84811/3
Robert Varga [Mon, 30 Sep 2019 14:45:32 +0000 (16:45 +0200)]
Push out FIXMEs to 5.0.0

We are not going to address these in 4.0.0 timeframe, push them out
to 5.0.0.

Change-Id: I73b9ba42c552c88758866d325b76fe9aebc3b569
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRename MountPointStreamWriter to StreamWriterMountPointExtension 06/84806/1
Robert Varga [Mon, 30 Sep 2019 09:37:28 +0000 (11:37 +0200)]
Rename MountPointStreamWriter to StreamWriterMountPointExtension

This better reflects the fact this is not a standalone interface,
but rather is an extension to NormalizedNodeStreamWriter.

Change-Id: I8cc0b9d91c95e227877b75e6a333ca830e1e0eeb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRename NormalizedMetadataStreamWriter to StreamWriterMetadataExtension 05/84805/1
Robert Varga [Mon, 30 Sep 2019 09:32:47 +0000 (11:32 +0200)]
Rename NormalizedMetadataStreamWriter to StreamWriterMetadataExtension

Naming here is quite inconsistent -- we should be explicit about this
interface being a NormalizedNodeStreamWriter extension.

Change-Id: I44fb52d06899785c6e9c8d1eb405343f89908160
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoIntegrate AnydataExtension 96/84096/3
Robert Varga [Fri, 30 Aug 2019 12:50:06 +0000 (14:50 +0200)]
Integrate AnydataExtension

anydata is the same as anyxml, it should be integrated into
NormalizedNodeStreamWriter. Also update FIXME around
startAnyxmlNode() and domSourceValue().

Change-Id: Ia39515a884d1a6883fce72444b8371c4d9f7b9c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake DataTreeTip.prepare() throw a checked exception 01/84801/3
Robert Varga [Mon, 30 Sep 2019 08:02:45 +0000 (10:02 +0200)]
Make DataTreeTip.prepare() throw a checked exception

Not all validation can be done during validate() phase, hence
allow validation failures to be reported cleanly.

Change-Id: I88dbe90c2e4b2fc79fad836939183fa43151ae6c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix StoreTreeNode.getChild() return type 99/84799/3
Robert Varga [Mon, 30 Sep 2019 07:57:50 +0000 (09:57 +0200)]
Fix StoreTreeNode.getChild() return type

We should be returning Optional<? extends T> here, so that the
interface can be properly specialized.

Change-Id: Ia3a84c6426e924299a10ea03d435fb584b685c47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpose EffectiveModelContext from YangTextSchemaContextResolver 98/84798/3
Robert Varga [Mon, 30 Sep 2019 05:22:03 +0000 (07:22 +0200)]
Expose EffectiveModelContext from YangTextSchemaContextResolver

This is another step towards migrating away from SchemaContext.

JIRA: MDSAL-435
Change-Id: I1fc6cca79fdfdcbcb45092a402b5b1f3ea9ab206
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd EffectiveModelContextListener 96/84796/2
Robert Varga [Mon, 30 Sep 2019 05:05:48 +0000 (07:05 +0200)]
Add EffectiveModelContextListener

This is a replacement for SchemaContextListener, managing
EffectiveModelContext.

JIRA: MDSAL-435
Change-Id: Icf7c68381d69875a6ea6030ac665d45a7c26ae5f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate FIXMEs 95/84795/1
Robert Varga [Mon, 30 Sep 2019 05:05:26 +0000 (07:05 +0200)]
Update FIXMEs

This just pushes FIXMEs out to 5.0.0.

Change-Id: Ief679ea949dd995154c9c26ca90dbe0f2d0829eb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRename Any{Data,Xml}SchemaNode to Any{data,xml}SchemaNode 87/84787/1
Robert Varga [Fri, 27 Sep 2019 14:09:55 +0000 (16:09 +0200)]
Rename Any{Data,Xml}SchemaNode to Any{data,xml}SchemaNode

This improves naming consistency, as the statements are called
'anydata' and 'anyxml', not 'any-data' nor 'any-xml'.

Change-Id: I5b2563cddba3b39d4b8faa891b85505b61af18b4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd odl-guava dependency 77/84777/1
Robert Varga [Fri, 27 Sep 2019 09:45:56 +0000 (11:45 +0200)]
Add odl-guava dependency

odl-yangtools-util is pulling in guava, is should depend on
odl-guava to get it.

Change-Id: I7514cf9fe69fa14e042c95bbcc93e4882ac1ae0f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd uint adaptation to AbstractNormalizedNodePruner
Robert Varga [Wed, 25 Sep 2019 15:34:53 +0000 (17:34 +0200)]
Add uint adaptation to AbstractNormalizedNodePruner

When migrating from old snapshots to magnesium format we have to
make sure we also legacy uint mapped values, so that after recovery
we end up with proper types being present.

JIRA: CONTROLLER-1919
Change-Id: I86ee49efee0d6c0519680197ea3e3985b1566e0c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRework AbstractNormalizedNodePruner
Robert Varga [Tue, 14 May 2019 08:15:19 +0000 (10:15 +0200)]
Rework AbstractNormalizedNodePruner

This refactors NormalizedNodePruner to use
ReusableImmutableNormalizedNodeStreamWriter for creation of the
actual NormalizedNode tree.

It simplifies the implementation and allows the reuse of minor
optimizations like LeafInterner.

JIRA: CONTROLLER-1889
Change-Id: I93bd00bcff13245d808f7adf6122a6c20156e9fd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSwitch default stream output to Sodium SR1
Robert Varga [Wed, 25 Sep 2019 06:01:47 +0000 (08:01 +0200)]
Switch default stream output to Sodium SR1

This flips the switch and uses Sodium SR1 format for all unversioned
users. Also updates tests to reflect new expected stream sizes.

JIRA: CONTROLLER-1919
Change-Id: I9973bb93f469c1b59533ce580c795cd30c9edda4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEliminate reference to YangInstanceIdentifier.EMPTY
Robert Varga [Wed, 25 Sep 2019 14:45:57 +0000 (16:45 +0200)]
Eliminate reference to YangInstanceIdentifier.EMPTY

This constant has been removed, migrate to its replacement.

Change-Id: I0937b4602552ec8101132319889bc92e63de06cb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRename AnyXmlNode to DOMSourceAnyxmlNode 91/83591/22
Andrii Mazurian [Tue, 13 Aug 2019 09:59:44 +0000 (12:59 +0300)]
Rename AnyXmlNode to DOMSourceAnyxmlNode

Rename AnyXmlNode to DOMSourceAnyxmlNode, as that reflects its place
in the object hierarchy. NormalizedNodeWriter is extended with stub
support for other object models, yet DOMSource is the only one
supported at this time.

JIRA: YANGTOOLS-976
Change-Id: I962c910557a14dad5f88fa4e69146606e21fddc4
Signed-off-by: Andrii Mazurian <a.mazuryan@gmail.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd Magnesium stream version
Robert Varga [Wed, 25 Sep 2019 06:07:50 +0000 (08:07 +0200)]
Add Magnesium stream version

This is a variant of Sodium SR1 streaming format, which does not
allow presence of BigInteger tokens, as those values are superseded
by Uint64.

JIRA: CONTROLLER-1919
Change-Id: I1dc5c7376bf1ecf105e965e42d74806ed99ab9b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd LithiumSR1 input/output support
Robert Varga [Mon, 9 Sep 2019 08:29:57 +0000 (10:29 +0200)]
Add LithiumSR1 input/output support

This is a code drop of both DataInput and DataOutput for Sodium SR1
streaming format. It uses its own dedicated tokes, along with quite
a few of stateful encoding rules.

Where Lithium did encoding did not perform any look-behind except
for LeafSetEntryNodes and only maintained simple coding tables,
this coder maintains simple 'parent' state tracking.

While the state tracking is not mandated on the encoder side, some
amount of tracking is required in the decoder side to provide full
coverage of coding constructs.

Two examples of this are:
- parent QName references, which are expanded to cover not only
  LeafSet/LeafSetEntry, but also UnkeyedList/UnkeyedListEntry
  and most importantly Map/MapEntry pairs
- Map/MapEntry tracking is also important for coding leaf nodes
  which represent keys -- in those cases emitting the leaf value
  is superfluous, as it can be looked up from MapEntry's predicates

Also this state tracking is maintained on-stack, thus making issues
related with it nigh impossible (unlike the Lithium LeafSetEntry
bugs).

JIRA: CONTROLLER-1919
Change-Id: I5fcf85a76750301cd3f8bcbd505baa0f95397cb5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd Magnesium encoding tokens
Robert Varga [Fri, 20 Sep 2019 08:07:10 +0000 (10:07 +0200)]
Add Magnesium encoding tokens

Changes to how uint8/16/32/64 types are mapped results in the need
to transfer the new value types. These represent 4 brand new tokens,
which need to be handled.

One option would be to fork NeonSR2 and modify it, somehow dealing
with value lookups (i.e. Uint8 is not valid in SR2 stream, but tokens
are shared across Lithium/NeonSR).

Another option is to create a streaming format from scratch, coming
up with a completely new family of tokens and encoding rules. This
is attractive, as both current formats have three deficiencies:

1) they encode MapEntry key values twice, once in the leaf itself
   and once in the entry's NodeIdentifierWithPredicates
2) they are '0-happy', i.e. they do not recognize that integer codes
   and sizes are typically much smaller than the 4-byte range and thus
   much of the stream is just small ints encoded as 4 bytes
3) while they are simple and straighforward, they also end up wasting
   bits -- the four token families (codes, value types, node types,
   path argument types) each have at most 15 distinct values, and
   hence the bytes used to transmit them have 4 empty bits (or more)

Hence we take the other option and design a streaming format with
brand new tokens, which are structured to carry as much more
information per byte.

This is done by combining 'type' information with forward coding
hints, for example:

- a Boolean leaf value would previously require 2 bytes:
    (byte)    ValueTypes.BOOL_TYPE
    (byte)    true/falseIn the new tokens
  whereas new tokens express this in one byte:
    (byte)    LeafValue.BOOLEAN_{FALSE,TRUE}
- a byte[5] value would require 10 bytes to encode:
    (byte)    ValueTypes.BINARY_TYPE
    (int)     length
    (5 bytes) bytes
  whereas new tokens express this in 6 bytes:
    (byte)    ValueTypes.BINARY_0 + 5 (works up to 127)
    (5 bytes) bytes

A similar approach is taken when encoding NormalizedNode types. Here
we recognize there are only 14 node types (currently) and hence we
can provide up to 4 additional bits for information about how the
node's identifier is encoded.

For PathArguments, we also use separate coding, where the format
is flexible based on the 4 types on identifiers there are, each
having slightly different format. Most notable here is the integration
of QName reference coding (for normal PathArguments) and integrated
set size coding (for AugmentationIdentifiers).

This this patch adds just the token definitions, along with basic
documentation and version declaration.

JIRA: CONTROLLER-1919
Change-Id: I9f6f58a7cb77d9d98c46e13b8dc6955c8e3c0737
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 6.0.0 84/84684/1
Robert Varga [Tue, 24 Sep 2019 06:44:29 +0000 (08:44 +0200)]
Bump odlparent to 6.0.0

This switches to using a released version of odlparent.

Change-Id: Ia9f2c27b38b851abe98f9b90b13d38dee1d46c59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRework PathArgumentTypes lookup
Robert Varga [Fri, 30 Aug 2019 09:08:37 +0000 (11:08 +0200)]
Rework PathArgumentTypes lookup

This lookup relying on final methods, which is not a correct
assumption, with NodeIdentifierWithPredicates having at least two
properly-hidden implementations.

Rework the lookup in terms of instanceof checks, which saves a table
lookup and unboxing operation.

Change-Id: Ia6b272715d19e432e7e0839b6294035e12b1d293
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove Neon SR2 tokens into its own class
Robert Varga [Fri, 20 Sep 2019 17:42:15 +0000 (19:42 +0200)]
Move Neon SR2 tokens into its own class

Same as with base Lithium tokens, these can create confusion about
where they are used. Make sure we encapsulate them in their own
class, so no confusion ensues.

JIRA: CONTROLLER-1919
Change-Id: I197b9118a5d9a09562db0a899bb6b8dc0dfae28b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRename ValueTypes to LithiumValue
Robert Varga [Fri, 20 Sep 2019 17:59:04 +0000 (19:59 +0200)]
Rename ValueTypes to LithiumValue

These constants are only used in Lithium-based streams, make sure
we reflect that in the name of the class, so they do not end up
being confused.

JIRA: CONTROLLER-1919
Change-Id: I2e880b825d82b8a9b76008248d7663eab4bc1d71
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRename PathArgumentTypes to LithiumPathArgument
Robert Varga [Fri, 20 Sep 2019 17:55:39 +0000 (19:55 +0200)]
Rename PathArgumentTypes to LithiumPathArgument

These tokens are only used in Lithium-based streams, but the global
name is slightly confusing. Rename to LithiumPathArgument, which
makes the context more obvious.

JIRA: CONTROLLER-1919
Change-Id: I2b92be4c469de8dffba6e071449b5ae947b9ace8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRename NodeTypes to LithiumNode
Robert Varga [Fri, 20 Sep 2019 17:54:04 +0000 (19:54 +0200)]
Rename NodeTypes to LithiumNode

This makes it clear these constants are only used in Lithium
encoding.

JIRA: CONTROLLER-1919
Change-Id: I1fb44f49d3409fdd007fe58dc6ce92b0eb6744b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove Lithium tokens to their own class
Robert Varga [Fri, 20 Sep 2019 17:36:10 +0000 (19:36 +0200)]
Move Lithium tokens to their own class

TokenTypes assumes singularity, which can create confusion, as we
have multiple multiple distinct sets. This separates out
Lithium-specific tokens into their own class.

JIRA: CONTROLLER-1919
Change-Id: Id8c47be7c432b44980dbeac8ef41d430c64e5490
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate from YangInstanceIdentifier.EMPTY
Robert Varga [Fri, 30 Aug 2019 09:10:53 +0000 (11:10 +0200)]
Migrate from YangInstanceIdentifier.EMPTY

This migrates to the replacement empty() method.

Change-Id: I32ca026a33835edb16f8e1e6142e9192c880076b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSeparate out AbstractNormalizedNodeDataInput
Robert Varga [Tue, 17 Sep 2019 21:35:14 +0000 (23:35 +0200)]
Separate out AbstractNormalizedNodeDataInput

As we are going to introduce a streaming format for Magnesium, which
uses very different token set, it is convenient to have a common
base class which does not have conotations about what the tokens are.

We provide a baseline counterpart to AbstractNormalizedNodeDataOutput
and base AbstractLithiumDataInput on it. The asymmetry of
writeYangInstanceIdentifier() is fixed by moving it to
AbstractLithiumDataOutput.

Change-Id: I55d318349f2c89508f3834c8ca5b69e69b7171b1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoGet rid of Strings.repeat() 83/84483/2
Robert Varga [Sun, 15 Sep 2019 22:02:49 +0000 (00:02 +0200)]
Get rid of Strings.repeat()

Java 11 is giving us String.repeat(), which has better performance
characteristics than Guava's Strings.repeat(). Ditch Guava in favor
of Java 11.

Change-Id: Ic5b8b507802f577a28b6b8df7c79e1e50efa779b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTake advantage of ValueNode in NormalizedNodes 85/84485/2
Robert Varga [Sun, 15 Sep 2019 22:10:56 +0000 (00:10 +0200)]
Take advantage of ValueNode in NormalizedNodes

We can perform a single instanceof check instead of two to check
for LeafNode and LeafSetEntryNode. Also cleanup checks to remove
superfluous type arguments.

Change-Id: Id9964088ff0751217175cf1a8c6f13009a0276e8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup requireNonNull() use in NormalizedNodes 84/84484/2
Robert Varga [Sun, 15 Sep 2019 22:07:49 +0000 (00:07 +0200)]
Cleanup requireNonNull() use in NormalizedNodes

Take advantage of the non-null return to save a tiny bit of bytecode.

Change-Id: Ie43b7ccc15dd96cd320eb74c0b0a2d5a0dd8a4da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd missing @Override 82/84482/1
Robert Varga [Sun, 15 Sep 2019 22:02:02 +0000 (00:02 +0200)]
Add missing @Override

LoggingNormalizedNodeStreamWriter.domSourceValue() is missing
an annotation for some reason. Fix that.

Change-Id: I01741c2a28de11f2a86562e588db15882dbe0912
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSimplify Uint range checks 77/84477/1
Robert Varga [Sun, 15 Sep 2019 17:48:10 +0000 (19:48 +0200)]
Simplify Uint range checks

This saves a single instruction (and a stack slot) in the hot path,
while penalizing exceptional path, by not giving it the constant
string.

As exceptions are expected to be (relatively) rare, this should not
hurt much and if for some reason it does, we can always revert.

Change-Id: Ibd926732f49b0d0692f0c894166f4427a49d7f7d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unneeded masking in Uint{8,16}.valueOf() 76/84476/1
Robert Varga [Sun, 15 Sep 2019 17:31:20 +0000 (19:31 +0200)]
Remove unneeded masking in Uint{8,16}.valueOf()

As we are checking the range of the input, we can just narrow input
value, saving us a few instructions in the process.

Change-Id: I2ff52b1a75565da76804e4f02114249200e7d841
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoChange Uint* IAE messages 75/84475/1
Robert Varga [Sun, 15 Sep 2019 17:02:28 +0000 (19:02 +0200)]
Change Uint* IAE messages

As we are rolling out Uint* as replacements to widened binding
representations, there is a potential useability regression in that
the excepion reported no longer contains the range of allowed
values.

This patch changes the reporting structure, so that the binding
format is retained, while also optimizing the checks a bit.

While we are in the area, fix Uint32/Uint64's failure to throw
NPE on null strings.

Change-Id: Ib482d2e632e7e4f4fbc16f047e70d8077aa9341a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize anyxml output
Robert Varga [Thu, 12 Sep 2019 15:33:59 +0000 (17:33 +0200)]
Optimize anyxml output

We do not need to instantiate a new factory every time we perform
encoding, keep the factory as a shared constant.

Change-Id: Ideff56076a1516784cd82f67438e5b740c4d3eeb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd NodeIdentifierWithPredicates.containsKey() 43/84343/3
Robert Varga [Thu, 12 Sep 2019 15:16:05 +0000 (17:16 +0200)]
Add NodeIdentifierWithPredicates.containsKey()

This is a useful check, which can be performed via getValue()
and checking for null return, but implementations can perform
it a wee bit more quickly.

Change-Id: I2182870ca3cfba082c6cebafe947643d5e191f4a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove Lithium-specific logic from AbstractNormalizedNodeDataOutput
Robert Varga [Wed, 11 Sep 2019 20:09:49 +0000 (22:09 +0200)]
Move Lithium-specific logic from AbstractNormalizedNodeDataOutput

The binding to TokenTypes and co. are really part of
AbstractLithiumDataOutput, as different serialization streams
versions can use completely different tokens and sizing.

Change-Id: I703c1da26ee2f99dee406e4de26db702beb05a06
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove ensureHeaderWritten() from writeNode()
Robert Varga [Wed, 11 Sep 2019 20:05:19 +0000 (22:05 +0200)]
Remove ensureHeaderWritten() from writeNode()

This updates documentation of AbstractNormalizedNodeDataOutput
to make it clear that the NormalizedNodeStreamWriter aspect of
it is an implementation detail and that the stream has been
header-initialized by the time any of those methods are called.

The clarification renders calling ensureHeaderWritten() from
writeNode() superfluous, as at that point it is guaranteed to
be a no-op.

Change-Id: I85a5c1304849fe5bc737fa51bd4b40ff2dd8c08c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReorganize AbstractNormalizedNodeDataOutput
Robert Varga [Wed, 11 Sep 2019 15:44:47 +0000 (17:44 +0200)]
Reorganize AbstractNormalizedNodeDataOutput

This reorganizes AbstractNormalizedNodeDataOutput so that it
implements all NormalizedNodeDataOutput with final methods,
deferring implementation as need to abstract methods.

This way we have precisely one implementation of public methods,
making it easy to audit for correctness. Furthermore it eliminates
writeAugmentationIdentifier() override in NeonSR2 writer.

It also introduces writeQNameInternal(), which skips header checks,
as the call sites have already performed those checks.

Change-Id: Icb4a7e994c04e3d52bd561d99c7743dfdfd88738
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSplit out AbstractLithiumDataInput
Robert Varga [Sun, 8 Sep 2019 18:26:18 +0000 (20:26 +0200)]
Split out AbstractLithiumDataInput

This splits out AbstractLithiumDataInput and disconnects Lithium
and NeonSR2 reader implementations. This allows Neon SR2 to be loaded
without Lithium, thus reducing the number of actual possible
implementations at runtime.

Change-Id: I90863c342d7bbea4946fd27d25dfb822efb4ed6e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup PathArgumentTypes
Robert Varga [Wed, 11 Sep 2019 13:09:13 +0000 (15:09 +0200)]
Cleanup PathArgumentTypes

Do not use long qualifiers for individual types, preferring
importing them. Also drop public modifiers, as this class is
package-private. Finally import static checkArgument().

Change-Id: I267d0f5675911b2d9990e8f7c3fdd49265c10d8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAbstractNormalizedNodeDataOutput fails to write out header
Robert Varga [Wed, 11 Sep 2019 14:06:59 +0000 (16:06 +0200)]
AbstractNormalizedNodeDataOutput fails to write out header

In case AbstractNormalizedNodeDataOutput is used in a way, where
NormalizedNodeDataOutput.writePathArgument() is the first method
invoked, the stream header would not be output, leading to it
being unreadable.

Change-Id: I4ababb360129b2ef673d0546333599dd10fbdd9e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse Optional.isEmpty() 92/84292/2
Robert Varga [Tue, 10 Sep 2019 13:08:57 +0000 (15:08 +0200)]
Use Optional.isEmpty()

This is Java 11 addition, a shorthand for !isPresent(). This allows
us to be a bit more concise.

Change-Id: I99461863e8ae292d0ebea9cc40a5bab2e0805dfb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse {Byte,Short}.compareUnsigned 85/84285/4
Robert Varga [Tue, 10 Sep 2019 04:47:42 +0000 (06:47 +0200)]
Use {Byte,Short}.compareUnsigned

Java 9 has these utility methods, use them instead of custom-brewing
an equivalent.

Change-Id: I774f2c0dcfa9f602830a1c98761b36520613bd52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpose NodeIdentifierWithPredicates.Singleton 71/84271/2
Robert Varga [Mon, 9 Sep 2019 05:00:40 +0000 (07:00 +0200)]
Expose NodeIdentifierWithPredicates.Singleton

Exposing this implementation allows users dealing with serialization
to use Singleton.singleEntry() and skip allocation of a Set.

Change-Id: I3d5941fc62a9ce9766b3bb15eb86e5c9f45af60b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTighten AbstractLithiumDataOutput.writeString()
Robert Varga [Sat, 7 Sep 2019 09:55:28 +0000 (11:55 +0200)]
Tighten AbstractLithiumDataOutput.writeString()

We can only ever pass nulls from Revision encoding, refactor to
make that clear (and enforced) in code. This more clearly defines
the context of TokenTypes.IS_NULL_VALUE and where it can be emitted.

Change-Id: I14045c9fc3eaf04b4bde858d322de45d3160de26
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove NormalizedNodeOutputStreamWriter
Robert Varga [Sat, 7 Sep 2019 09:22:39 +0000 (11:22 +0200)]
Remove NormalizedNodeOutputStreamWriter

This class is tied to NeonSR2 serialization format through subclassing,
where it really is a package-private detail. This leads to two concrete
classes being in existence for a particular format, which simply does
not make sense.

Eliminating this subclass allows us to make Neon SR2 final, thus arriving
and monomorphic or bimorphic invocation of all methods based on whether
we have seen Lithium (well, Oxygen) format at runtime.

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