yangtools.git
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 agoAdd an explicit namespace sharing test
Robert Varga [Tue, 24 Sep 2019 13:16:15 +0000 (15:16 +0200)]
Add an explicit namespace sharing test

This adds a test to target QName/QNameModule/String reference
differentiation.

JIRA: CONTROLLER-1919
Change-Id: Iad736a81f627da4a04753b380acb530ccc8ba219
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 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 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 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 agoAdd a 100K-entry test
Robert Varga [Thu, 19 Sep 2019 21:59:24 +0000 (23:59 +0200)]
Add a 100K-entry test

This adds a test for serialization of a Map of 100K entries,
each of which has the key leaf and a simple constant non-key leaf.
Unlike other tests, this quantifies how well the encoding works
when faced with large maps.

JIRA: CONTROLLER-1919
Change-Id: I306e5175ba595a0967432393766f8317e7205492
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd encoding size asserts
Robert Varga [Thu, 19 Sep 2019 19:20:16 +0000 (21:20 +0200)]
Add encoding size asserts

There is a number of places where we check serialize/deserialize
operations through ByteArrayOutputStream. In order to check stability
(and evolution) of our serialization formats, it is useful to check
the sizes of the intermediate bytes.

JIRA: CONTROLLER-1919
Change-Id: I171894ba3791245a53fe39c2d3238d2341d8ffc4
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 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 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>
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>
4 years agoDisconnect {Lithium,NeonSR2} implementations
Robert Varga [Sat, 7 Sep 2019 07:54:32 +0000 (09:54 +0200)]
Disconnect {Lithium,NeonSR2} implementations

We will need to define two new serialization formats: one
sharing object value serialization (for NeonSR3) and one
disconnected from it (for Magnesium).

In order to maintain scalability with so many formats, we want
to avoid JIT considering implementations which were not referenced
at runtime. This should make CHA and method dispatch more
efficient.

Since we are isolating things, we also pull ValueTypes lookups
and keep it in the same class for easier understanding.

Change-Id: I3db4e9633db4a75016e17ac31bb38452bcb9f42a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDisconnect {Lithium,NeonSR2} implementations
Robert Varga [Sat, 7 Sep 2019 07:54:32 +0000 (09:54 +0200)]
Disconnect {Lithium,NeonSR2} implementations

We will need to define two new serialization formats: one
sharing object value serialization (for NeonSR3) and one
disconnected from it (for Magnesium).

In order to maintain scalability with so many formats, we want
to avoid JIT considering implementations which were not referenced
at runtime. This should make CHA and method dispatch more
efficient.

Since we are isolating things, we also pull ValueTypes lookups
and keep it in the same class for easier understanding.

Change-Id: I3db4e9633db4a75016e17ac31bb38452bcb9f42a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoLower ValueTypes constant visibility
Robert Varga [Sat, 7 Sep 2019 07:01:43 +0000 (09:01 +0200)]
Lower ValueTypes constant visibility

This is a package-private class, hence 'public' is superfluous.

Change-Id: I4dd03b3ff1ae0cc4cc11f823cbd9538e6932d6b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate uint implementations a bit 64/84264/1
Robert Varga [Fri, 6 Sep 2019 18:32:22 +0000 (20:32 +0200)]
Update uint implementations a bit

Constructor should be private and Integer.toString() is better
than String.valueOf() because it is an intrinsic.

Change-Id: I7e5da76b90add67e479c8d673ad0c696a74907dc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate Class.newInstance() user 14/84214/1
Robert Varga [Thu, 5 Sep 2019 09:35:19 +0000 (11:35 +0200)]
Migrate Class.newInstance() user

Class.newInstance() is deprecated since Java 9, migrate to explicit
constructor invocation.

Change-Id: Ifc2e67aa4a56a9ccc306eb540100ebc299eb00c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd UintConversions 13/84213/2
Robert Varga [Thu, 5 Sep 2019 07:56:46 +0000 (09:56 +0200)]
Add UintConversions

This adds utility conversion methods for Java/Guava equivalents,
so that transitioning to/from these is easier on the users.

JIRA: YANGTOOLS-1018
Change-Id: Ibcd0cd908cd85c0f038206f96e667a144569582b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate and document Uint 74/84174/5
Robert Varga [Tue, 3 Sep 2019 11:35:38 +0000 (13:35 +0200)]
Update and document Uint

This updates Uint classes to expose ZERO/ONE/MAX_VALUE and documents
their methods.

Caching is reworked to work on tunable statically-populated caches,
where Uint8 is always fully cached. This mirrors what is being done
for boxing purposes on java.lang.Byte, etc.

On top of the statically-populated caches, each type has a dedicated
Interner instance, which can be efficiently consulted using intern().

JIRA: YANGTOOLS-1018
Change-Id: Ic25b5ac685c920f7d82d588309a543f9a8eb43b7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSwitch encoding unsigned type normalization to Uint* types 47/83947/20
Robert Varga [Fri, 23 Aug 2019 17:42:34 +0000 (19:42 +0200)]
Switch encoding unsigned type normalization to Uint* types

Using Java native types for unsigned values is wasteful especially
in case of uint32 and uint64. Furthermore it leads to uncertainty
between int16/uint8, int32/uint16 and int64/uint32.

This is a partial switch, where we retain java.lang types for
signed entities, but switch the unsigned ones.

JIRA: YANGTOOLS-1018
Change-Id: I0eeb1d343d77d05c4e00cb6919c128042ab31eb1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoHide Immutables.KNOWN_IMMUTABLES 31/84131/1
Robert Varga [Mon, 2 Sep 2019 15:28:10 +0000 (17:28 +0200)]
Hide Immutables.KNOWN_IMMUTABLES

This constant should not be leaked to the outside world, hide it
and make it an ImmutableSet.

Change-Id: If05dc0bb5b9915a371913bd6cc0c9ecb0d253c89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize immutable lookups 30/84130/1
Robert Varga [Mon, 2 Sep 2019 15:25:37 +0000 (17:25 +0200)]
Optimize immutable lookups

We have a number of private Set/Map/Lists which we are using for
lookups. These typically are backed by Immutable implementations,
hence we can propagate the type knowledge to improve bytecode
generation and make JIT's life easier.

Change-Id: I7f90393b8bc76196deced50f1800c3f99424fa1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoVerify leaf node squashing 95/84095/1
Robert Varga [Fri, 30 Aug 2019 12:11:09 +0000 (14:11 +0200)]
Verify leaf node squashing

There is a very slight possiblity of somebody playing tricks
to inject Leaf node with a DataContainerChild value, in which case
decoding would break. Verify this does not happen.

JIRA: YANGTOOLS-1019
Change-Id: Idbd6457817b9db5f2b2d4b3fafce57169ace6ec1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFixup LazyLeafOperations 89/84089/3
Robert Varga [Fri, 30 Aug 2019 08:58:33 +0000 (10:58 +0200)]
Fixup LazyLeafOperations

LazyLeafOperations.isEnabled() allows code to query whether leaf nodes
are being treated as expendable, hence assumptions about them being
equal on identity can be violated. We retrofit the check into tests we
modified before.

Furthermore users of getValue() expect it to work with identities,
even when it is being specialized to a Collection. The expectation here
is that the same collection will be returned from NormalizedNode,
which we are violating. Fix this up by introducing a new implementation
class, which hides this difference and defers equality to the backing
map.

JIRA: YANGTOOLS-1019
Change-Id: Icf62619c3ea5a1c994c6547a0674b36d707248d3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFixup RpcResult definitions 72/84072/1
Robert Varga [Thu, 29 Aug 2019 15:28:41 +0000 (17:28 +0200)]
Fixup RpcResult definitions

The 'errors' are a List and the list is always present, which
has goodness for users.

Change-Id: I44fad2f48fe8882eb5cb98b1c099a547659f77c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove useless method generic arguments 67/84067/1
Robert Varga [Thu, 29 Aug 2019 13:46:53 +0000 (15:46 +0200)]
Remove useless method generic arguments

These arguments are not used, remove them.

Change-Id: Ibd8140b68d012c662a7670ab0ae8639d9a0134fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not retain leaf nodes in containers by default 15/84015/9
Robert Varga [Tue, 27 Aug 2019 14:04:55 +0000 (16:04 +0200)]
Do not retain leaf nodes in containers by default

Leaf nodes are observed to dominate our memory footprint. This
patch modifies immutable implementations of NormalizedNodeContainers
such that they eliminate any leaf nodes when they are stored, retaining
only the encapsulated value. Leaf nodes are then re-created on access
as needed.

Note this changes two aspects of operation:

1) looking up a leaf will yield a new object every time it is invoked,
   hence callers must not rely on on returned objects to be identical.

2) getValue() is operating on the backing map's entrySet() and requires
   its transformation. This means that multiple iterations over values
   will not necessarily yield same objects.

Neither of these violates effective immutability contract of NormalizeNode,
as the returned objects will compare as equal.

This behavior can be switched off at runtime by setting the system property:

    org.opendaylight.yangtools.yang.data.impl.schema.nodes.lazy-leaves=false

JIRA: YANGTOOLS-1019
Change-Id: I00fc3ac0b64290068e8a6e4c8972454729fa9011
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove YangInstanceIdentifier.EMPTY 46/84046/6
Robert Varga [Wed, 28 Aug 2019 18:59:36 +0000 (20:59 +0200)]
Remove YangInstanceIdentifier.EMPTY

This constannt has been deprecated for removal -- now we remove it.

Change-Id: I0808a8e8ebe455275bf6fcc24edae8126a4087c2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove references to YangInstanceIdentifier.EMPTY 49/84049/2
Robert Varga [Wed, 28 Aug 2019 20:40:14 +0000 (22:40 +0200)]
Remove references to YangInstanceIdentifier.EMPTY

The constant is going away, update javadocs to reflect that.

Change-Id: Ie0415cbd1afd375b14a6c62d097f288ed2193613
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate YangInstanceIdentifier.EMPTY for removal 45/84045/4
Robert Varga [Wed, 28 Aug 2019 18:57:15 +0000 (20:57 +0200)]
Deprecate YangInstanceIdentifier.EMPTY for removal

As a JDK9 extension, mark the constant for removal.

Change-Id: I931d870cedef109526bef2f3c6336b1bc2256158
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate YangInstanceIdentifier.EMPTY 44/84044/4
Robert Varga [Wed, 28 Aug 2019 18:21:39 +0000 (20:21 +0200)]
Deprecate YangInstanceIdentifier.EMPTY

This runtime constant forces instantiation of a subclass, leading
to a SpotBugs warning. A static accessor works just as well --
hence YangInstanceIdentifier.empty()

Change-Id: I67b562b176f17d3c327b4589b673017f513f98f5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd Builder.build() override 39/84039/2
Robert Varga [Wed, 28 Aug 2019 14:24:23 +0000 (16:24 +0200)]
Add Builder.build() override

This override stops the unchecked exception from leaking into
IDE-generated implementations.

Change-Id: I7c4fc039e6d0c468ce08cf1647c82473cf6d9096
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate away from @ConstructorProperties 38/84038/2
Robert Varga [Wed, 28 Aug 2019 14:01:09 +0000 (16:01 +0200)]
Migrate away from @ConstructorProperties

ListenerNotificationQueueStats is meant for consumption in
java.management and therefore it does not need java.desktop
to work -- this is very important for JDK 9+ modular deployments.

Change-Id: I0e7715113ede968db05aacef136e35649cdfa492
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoHide AbstractIdentifier.getValue() 80/82980/10
Robert Varga [Tue, 9 Jul 2019 20:27:30 +0000 (22:27 +0200)]
Hide AbstractIdentifier.getValue()

AbstractIdentifier is a utility wrapper class, hence it should not
have a public surface users should be interested it. Anybody relying
on .getValue() who is not a subclass should expose a domain-specific
getter method.

Change-Id: I64af4b385055d92c6499d62879c77e77216d4b39
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup ValueTypes lookup
Robert Varga [Wed, 28 Aug 2019 12:56:04 +0000 (14:56 +0200)]
Cleanup ValueTypes lookup

Change type of TYPES to ImmutableMap, so we are binding to a concrete
class when looking up. Also clean up initialization to follow fluent
builder pattern.

Finally inline requireNonNull() call into the invocation, so that its
return value is not wasted.

Change-Id: I4487bd43232131ca548441f4c8901a8c5dc60efa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCorrect cache sizing for Uint types 32/84032/1
Robert Varga [Wed, 28 Aug 2019 09:05:19 +0000 (11:05 +0200)]
Correct cache sizing for Uint types

There is an off-by-one error in these, fix that up.

Change-Id: I7031e8b59bc2c35741d53d663aba3951f6ee2862
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpose Uint*.{MIN,MAX}_VALUE constants 25/84025/1
Robert Varga [Wed, 28 Aug 2019 00:19:20 +0000 (02:19 +0200)]
Expose Uint*.{MIN,MAX}_VALUE constants

These contants are useful for outside users, as they allow them
to reference known invariants.

Change-Id: I28467737a2dfe5cac811e7ecbc9ead75c47d1344
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix SchemaContextProvider nullness 94/83994/4
Robert Varga [Mon, 26 Aug 2019 14:33:49 +0000 (16:33 +0200)]
Fix SchemaContextProvider nullness

SchemaContextProvider needs to return a schemacontext, or throw
an ISE.

Change-Id: I098c09a77a261f81b2b4b31207733169563aa936
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd a singleton NodeIdentifierWithPredicates 04/82604/20
Robert Varga [Thu, 20 Jun 2019 14:12:07 +0000 (16:12 +0200)]
Add a singleton NodeIdentifierWithPredicates

Heap dumps from OFP-centric load shows that single-predicate
identifiers are dominating the workload. This adds a dedicated
class to handle those cases.

The upshot of a dedicated class vs. a singleton map is a reduction
of one object, i.e. with SharedSingletonMap we get:

NodeIdentifierWithPredicates (24/32b)
SharedSingletonMap (24/32b)

whereas a dedicated class does only:

NodeIdentifierWithPredicates.Singleton (32/40b)

Which reduces total storage requirements from 48/64 bytes down to
32/40 bytes, saving 16/24 bytes (33/37.5%).

Change-Id: I3172ab9435d67adc12ae1734f9ad35f1dc8f891f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize ImmutableNodes.leafNode() 14/84014/2
Robert Varga [Tue, 27 Aug 2019 14:13:19 +0000 (16:13 +0200)]
Optimize ImmutableNodes.leafNode()

This eliminates instantiation of a temporary builder and shortcuts
to creating the leaf node directly.

Change-Id: I66256b46ef0de1aa3745bb90e70d41a2bd29d419
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeduplicate MapNode key leaf values
Robert Varga [Mon, 26 Aug 2019 20:44:30 +0000 (22:44 +0200)]
Deduplicate MapNode key leaf values

When we are encountering a leaf node inside a MapEntryNode, it can
be a leaf corresponding to a key -- in which case its value is
already present in NodeIdentifierWithPredicates and we do want to
de-duplicate those objects.

JIRA: CONTROLLER-1908
Change-Id: I2ed65c311f9921aa77c9f23bd1f7681d7f11355a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove common code to startNode()
Robert Varga [Tue, 27 Aug 2019 09:34:34 +0000 (11:34 +0200)]
Move common code to startNode()

We are duplicating null checks in all entrypoints which lead to
startNode(). We can centralize these in startNode(), leading to
denser code and fixing Sonar warnings.

Change-Id: I3f2a0c53216179e9d25624a3e3139340eff551fa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix YangInstanceIdentifier.PathArgument definition 09/84009/1
Robert Varga [Tue, 27 Aug 2019 10:30:10 +0000 (12:30 +0200)]
Fix YangInstanceIdentifier.PathArgument definition

Javadoc and nullness guarantees do not match implementation behaviour,
align them.

Change-Id: Ifd981021a9261f06fc605d15d6790518e3915735
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRename SodiumNormalizedNode* classes
Robert Varga [Mon, 26 Aug 2019 22:08:05 +0000 (00:08 +0200)]
Rename SodiumNormalizedNode* classes

These are implementing Neon SR2 serialization format, hence they
should be named as such.

Change-Id: Iaa509e3490b420b8005a2724105bf99b53d95cf2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDrop public modifier from NodeTypes
Robert Varga [Mon, 26 Aug 2019 21:17:51 +0000 (23:17 +0200)]
Drop public modifier from NodeTypes

The class itself is not visible outside of the package, there is no
point to declare the constants as public.

Change-Id: I4136a71c538452aba33a5abb3337e0f8fc7e8da8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSwitch serialization format to NIPv2 55/82655/9
Robert Varga [Fri, 21 Jun 2019 23:51:14 +0000 (01:51 +0200)]
Switch serialization format to NIPv2

This format retains control over the entries being emitted,
so that we are in control of what implementation is being used
for retaining the entries. We adopt a reconstruction strategy,
where the maps are constructed the same way they are in production
code.

Change-Id: Ic08267c4b2424307a60d2fdccc9b6896c487c29a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd utility PotentialSchemaSource constructor 86/83986/1
Robert Varga [Mon, 26 Aug 2019 12:32:46 +0000 (14:32 +0200)]
Add utility PotentialSchemaSource constructor

It is useful for users to use pre-defined acquisition costs, this
adds a utility so users do not have to call Costs.getValue().

Change-Id: Ib44352784076493a317dcee0aa64d108301a6305
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCentralize serializeImpl() 66/83966/1
Robert Varga [Mon, 26 Aug 2019 09:15:13 +0000 (11:15 +0200)]
Centralize serializeImpl()

All subclasses of AbstractIntegerStringCodec are doing the same
thing in the serialization path, make sure we squash them to
the same implementation.

Change-Id: I98cc8738720ccf38a441a09a069dc48edb5b25ed
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix Serializer/Deserializer/Codec concepts 49/83949/9
Robert Varga [Fri, 23 Aug 2019 18:43:01 +0000 (20:43 +0200)]
Fix Serializer/Deserializer/Codec concepts

Base Codec/Serializer/Deserializer classes need to express the fact
the an implementation can throw an exception. This is important for
proper use of checked exception in implementation domains -- for example
it is natural to throw a XMLStreamException when executing in the
context of StAX streaming.

This prevents user surprises when an XML stream throws an unhandled
IAE exception. All implementations are converted with prejudice to
explicitly not allow null.

JIRA: YANGTOOLS-1017
Change-Id: I5d24a36028ae6aef5b244e13c5f9e8b0643f14f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate TypeDefinitionAwareCodec 48/83948/1
Robert Varga [Fri, 23 Aug 2019 19:30:14 +0000 (21:30 +0200)]
Update TypeDefinitionAwareCodec

Note that the factory can return null, annotate as such and document
that @Nullable should be eliminated.

Change-Id: I63c4703ef9b63ce1a7fccb70b32beb23398be748
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix a theoretical IM_BAD_CHECK_FOR_ODD 99/83899/1
Robert Varga [Thu, 22 Aug 2019 13:02:53 +0000 (15:02 +0200)]
Fix a theoretical IM_BAD_CHECK_FOR_ODD

While the size of a collection cannot be negative, this keeps
SpotBugs happy about the check.

Change-Id: Ic84a9f147b9d933efc66766617f6271fcf1eddc1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRely on framework to unregister XPathParserFactory 98/83898/1
Robert Varga [Thu, 22 Aug 2019 12:57:38 +0000 (14:57 +0200)]
Rely on framework to unregister XPathParserFactory

This simplifies the code a bit while also squashing two SpotBug
violations.

Change-Id: Ie3f146568510a949e3c7d332c95c59b90f17c7b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoEnable spotbugs in yang-model-export 97/83897/1
Robert Varga [Thu, 22 Aug 2019 12:44:39 +0000 (14:44 +0200)]
Enable spotbugs in yang-model-export

SpotBugs is getting confused by our use of checkArgument, not
understanding we will catch nulls. Refactor the code removing
the violation and remove enforcement override.

Change-Id: I787359c01f2761448cb4f3d33aea0baf5e642ed8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemome YinExportUtils.prefixToNamespace() 96/83896/1
Robert Varga [Thu, 22 Aug 2019 12:41:07 +0000 (14:41 +0200)]
Remome YinExportUtils.prefixToNamespace()

This method is correctly flagged as unused, remove it along with
getModuleNamespace() which is orphaned after its removal.

Change-Id: I3f410ef802a7e9c4dc89d5671fde775030683353
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unneeded spotbugs/checkstyle declarations 87/83887/2
Robert Varga [Thu, 22 Aug 2019 10:57:31 +0000 (12:57 +0200)]
Remove unneeded spotbugs/checkstyle declarations

checkstyle/spotbugs are enabled by default by odlparent, there is
no point in keeping these declarations.

Change-Id: I2852f8521457785afb70aee4ac379e099f6fb153
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDisable SpotBugs enforcement on select artifacts 86/83886/3
Robert Varga [Thu, 22 Aug 2019 10:42:41 +0000 (12:42 +0200)]
Disable SpotBugs enforcement on select artifacts

odlparent has started enforcing SpotBugs by default, but some of
our artifacts are not ready for that. Disable enforcement through
the odlparent property and document why we are disabling it.

Change-Id: Ie8d3e43b26efd75e70223dde2b4555865ce25001
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix checkstyle 85/83885/3
Robert Varga [Thu, 22 Aug 2019 10:41:27 +0000 (12:41 +0200)]
Fix checkstyle

This fixes issues found by checkstyle.

Change-Id: Iecab9171c2d4d63cf564139c714a4552d069636b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix modernization issues
Robert Varga [Tue, 20 Aug 2019 19:06:59 +0000 (21:06 +0200)]
Fix modernization issues

This fixes issues pointed out by Modernizer, which mostly boil
down to using Objects.requireNonNull() and direct java.util
collections.

Change-Id: Id32530a6722cd101f96c23f6a745f91b2f09e2f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate NodeIdentifierWithPredicates.getKeyValues()
Robert Varga [Tue, 20 Aug 2019 19:17:57 +0000 (21:17 +0200)]
Migrate NodeIdentifierWithPredicates.getKeyValues()

Change-Id: Iea47db72483111eea40374c23d7be0da33f67728
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpand MapAdaptor javadoc 92/83792/1
Robert Varga [Tue, 20 Aug 2019 12:17:21 +0000 (14:17 +0200)]
Expand MapAdaptor javadoc

This fixes a few warnings around javadoc completes of MapAdaptor.

Change-Id: I6bb7b6354530b4ad47a07b4b0358c720b80b4230
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake sure readOnly field is initialized 87/83787/3
Robert Varga [Tue, 20 Aug 2019 11:49:28 +0000 (13:49 +0200)]
Make sure readOnly field is initialized

Make sure the readOnly field is forced to be initialed to null
by making it a volatile.

Change-Id: I366835a8009fe6fe21992b374f959bfcefcde18e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRelax read-only snapshot memory fencing 67/83767/1
Robert Varga [Mon, 19 Aug 2019 15:07:09 +0000 (17:07 +0200)]
Relax read-only snapshot memory fencing

With Java 9 we can use VarHandles to reduce memory ordering guarantees
from volatile to acquire/releases.

Use this facility to disconnect ReadOnlyTrieMap from other volatiles,
potentially helping the compiler to do a better job optimizing.

Change-Id: Ibd266a5a341bcdaae25702476610c10eeb0ea374
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 6.0.0-SNAPSHOT 83/83383/17
Robert Varga [Mon, 5 Aug 2019 09:27:39 +0000 (11:27 +0200)]
Bump odlparent to 6.0.0-SNAPSHOT

We will need some JDK11 work done, for that we'll use odlparent
snapshots for a while.

Due to MJAVADOC (and underlying JDK-8220702) we keep the target of
yang-data-impl and yang-parser-rfc7950 at 8.

Change-Id: I3da91a8a6b1dfd4cc40c7e0e9fdd527733da5331
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoGeneralize ForwardingIdentityObject 17/83717/3
Robert Varga [Fri, 16 Aug 2019 17:01:18 +0000 (19:01 +0200)]
Generalize ForwardingIdentityObject

Wrapping objects in identity comparison is useful, and there
seems to be no readily-avaible utility. This introduces an
extension to ForwardingObject and a simple utility class to
implement its construct.

JIRA: YANGTOOLS-1016
Change-Id: If0d7a2f731b0a294570f8ba39ce5da7236e2c752
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix schema-ref traversal 85/83685/1
Anna Bencurova [Thu, 15 Aug 2019 12:17:34 +0000 (14:17 +0200)]
Fix schema-ref traversal

When traversing schema-mount definitions, we need to account for
schema-ref being a choice and hence its children are not directly
reachable.

JIRA: YANGTOOLS-1015
Change-Id: Iaa9ddbf33c172c433cb323166e5b1bcea5eea649
Signed-off-by: Anna Bencurova <Anna.Bencurova@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd @SuppressModernizer 15/83415/9
Robert Varga [Tue, 6 Aug 2019 08:42:49 +0000 (10:42 +0200)]
Add @SuppressModernizer

We are mucking with modernizable constructs on purpose, add
suppressions to keep modernizer quiet.

Change-Id: Ia25640be14f1943a976c4edda6247124986a9d15
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove PrefixToModule.isPreLinkageMap() 08/83408/9
Robert Varga [Tue, 6 Aug 2019 07:24:24 +0000 (09:24 +0200)]
Remove PrefixToModule.isPreLinkageMap()

This property is not used anywhere, remove it.

Change-Id: I4e1674f5b4a00b68e6d3b40b62ebc2a3fcc95573
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSwitch to using java.util.Base64 17/83417/5
Robert Varga [Tue, 6 Aug 2019 10:43:54 +0000 (12:43 +0200)]
Switch to using java.util.Base64

This follows modernizer recommendation of using java.util.Base64
instead of Guava's BaseEncoding.

Change-Id: I72a49503980fb615ce27d2e3d0a84cbb1b033236
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd more modernization 20/83420/1
Robert Varga [Tue, 6 Aug 2019 11:16:15 +0000 (13:16 +0200)]
Add more modernization

This nails down a missed use of Lists.newArrayList(), fix that.

Change-Id: I0587e92bed503e642b1d003cb10a6947b98ff7a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoApply modernization 14/83414/2
Robert Varga [Tue, 6 Aug 2019 08:39:43 +0000 (10:39 +0200)]
Apply modernization

This fixes up use of old constructs pointed out by maven modernizer
plugin.

Change-Id: I3f926678763f72b195ae961ce7f220a1845fef52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove Decimal64.toInt() method 97/83397/4
Robert Varga [Mon, 5 Aug 2019 16:04:11 +0000 (18:04 +0200)]
Move Decimal64.toInt() method

This utility is only used in nested class, move it to keep SpotBugs
happy under Java 11.

Change-Id: I405718bf3db9ebcdd972ae5a71c47570c424f730
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix checkArgument constructor 04/83404/3
Robert Varga [Tue, 6 Aug 2019 06:23:59 +0000 (08:23 +0200)]
Fix checkArgument constructor

This adds a missing argument and removes the need for synthetic
accessors.

Change-Id: I7e293036b35b86c9ac555f2880747748b8c35443
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix stmt.compat Java 11 compilation 98/83398/4
Robert Varga [Mon, 5 Aug 2019 18:34:27 +0000 (20:34 +0200)]
Fix stmt.compat Java 11 compilation

Java 11 inference does not like the implicit cast, although it is
supposed to be safe. We do not really need it, remove it.

Change-Id: Ic2b89a523eb91cb86cd669dc9670c6acba214dca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix checkstyle errors 96/83396/3
Robert Varga [Mon, 5 Aug 2019 14:14:49 +0000 (16:14 +0200)]
Fix checkstyle errors

Upgraded checkstyle plugin is finding some more errors, fix them
up.

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