yangtools.git
3 years agoAdd OnDemandSchemaTreeStorageNode 30/93530/1
Robert Varga [Thu, 29 Oct 2020 11:55:55 +0000 (12:55 +0100)]
Add OnDemandSchemaTreeStorageNode

In order to correctly implement schema dependencies, we need to
invoke a callback from namespace prerequisites back to
StatementContextBase and its subclasses.

The conduit here is NamespaceBehavior.getFrom(), which is invoked
with a namespace key. For ChildSchemaNodeNamespace this ends up
the QName matching the argument the corresponding
SchemaTreeEffectiveStatement will end up having.

Introduce OnDemandSchemaTreeStorageNode, which acts as an extension
to normal NamespaceStorageNode behavior -- it allows an
implementation to supply a QName-based child statement to be
returned.

Since StatementContextBase is a NamespaceStorageNode, its subclasses
can now additionally implement this interface to receive the
callback.

JIRA: YANGTOOLS-784
Change-Id: I0e6f621eb39b341af61005b2334174e814c18875
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 5be3107a8f7daca1e3584bace9a684e21315df70)

3 years agoClarify NamespaceStorageSupport.getParentNamespaceStorage() 90/93490/1
Robert Varga [Fri, 30 Oct 2020 09:08:51 +0000 (10:08 +0100)]
Clarify NamespaceStorageSupport.getParentNamespaceStorage()

This override does seemingly nothing, but in fact splits invocation
groups to two -- those going to SourceSpecificContext and those
going to a NamespaceStorageSupport subclass. More specifically, if
a caller knows it is talking to NamespaceStorageSupport, JIT does
will not consider SourceSpecificContext an implementation.

Furthermore, SourceSpecificContext, as an implementation class,
guarantees it will return BuildGlobalContext.

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

3 years agoTighten {Inferred,Substatement}Context.getParentNamespaceStorage() 89/93489/1
Robert Varga [Fri, 30 Oct 2020 09:33:02 +0000 (10:33 +0100)]
Tighten {Inferred,Substatement}Context.getParentNamespaceStorage()

These two methods are guaranteed to return StatementContextBase,
express that in their return type.

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

3 years agoBuildGlobalContext should be final 88/93488/1
Robert Varga [Fri, 30 Oct 2020 08:58:24 +0000 (09:58 +0100)]
BuildGlobalContext should be final

We do not inherit from this class by design, make sure that bit
is captured for JIT to see.

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

3 years agoStorageSpecific.storageType is private and final 87/93487/1
Robert Varga [Fri, 30 Oct 2020 08:10:24 +0000 (09:10 +0100)]
StorageSpecific.storageType is private and final

Somehow this field escaped our usual attention, make sure it's
properly final and private.

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

3 years agoUse coerceStatemntArgument for YinElementStatement 86/93486/1
Robert Varga [Fri, 30 Oct 2020 01:25:28 +0000 (02:25 +0100)]
Use coerceStatemntArgument for YinElementStatement

yin-element requires an argument, it is fair to coerce it and get
rid of a nullness warning.

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

3 years agoRecheck fields when cleaning up listeners 71/93471/1
Robert Varga [Thu, 29 Oct 2020 16:51:17 +0000 (17:51 +0100)]
Recheck fields when cleaning up listeners

We may end up in a situation where we trigger multiple times, in
which case we can end up with mutated state and therefore cannot
rely on fields being non-null.

JIRA: YANGTOOLS-1155
Change-Id: I5607843d1e02483faa387a5630f3c4c06a3be62a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1105cf5bc00628ee6dc2d86dce1ef4225050a5ba)

3 years agoCentralize Abstract{Input,Output}StatementSupport.parseArgumentValue() 69/93469/1
Robert Varga [Thu, 29 Oct 2020 13:19:58 +0000 (14:19 +0100)]
Centralize Abstract{Input,Output}StatementSupport.parseArgumentValue()

As we have reduced the number of implementations of this method,
by introducing the default implementation, we are down to three
possible implementations under BaseSchemaTreeStatementSupport.

Add a level of indirection through Function<QNameModule, QName>, which
allows us to combine the two implementations into a single one residing
in BaseOperationContainerStatementSupport.

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

3 years agoAdd BaseSchemaTreeStatementSupport.parseArgumentValue() 68/93468/1
Robert Varga [Thu, 29 Oct 2020 13:13:12 +0000 (14:13 +0100)]
Add BaseSchemaTreeStatementSupport.parseArgumentValue()

Almost all subclasses of BaseSchemaTreeStatementSupport do the same
thing for parseArgumentValue(). Centralize the default behaviour there,
while allowing input/output statements to do their own thing.

JIRA: YANGTOOLS-1154
Change-Id: I7a3daf3a9c90eefadc1cad8043af3a2e7b9065e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 2ecfbbbba0d6add3664d998cbff940645bbb1428)

3 years agoMove implementation of OnStatementAdded to single class 65/93465/3
miroslav.kovac [Thu, 29 Oct 2020 10:26:47 +0000 (11:26 +0100)]
Move implementation of OnStatementAdded to single class

Create BaseSchemaTreeStatementSupport that implements
onStatementAdded and migrate all the usage from
StatementSupport classes.

JIRA: YANGTOOLS-1154
Change-Id: I3815d69f8621b9559470fea35fa4d427a717acc4
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit ca57ae28c6974bf6c5faa866667e52c8f458e325)

3 years agoAdd faster NormalizedNodes.findNode() alternatives 56/93356/1
Robert Varga [Sun, 25 Oct 2020 20:10:03 +0000 (21:10 +0100)]
Add faster NormalizedNodes.findNode() alternatives

End users are going through iterators needlessly when they want
to touch just a single PathArgument. Add methods which side-step
the intermediate List.

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

3 years agoSpeed up NormalizedNodes.getDirectChild() 55/93355/1
Robert Varga [Sun, 25 Oct 2020 20:05:39 +0000 (21:05 +0100)]
Speed up NormalizedNodes.getDirectChild()

Deal with positive matches first, let ValueNode be dealt with using
the default path.

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

3 years agoBump versions to 5.0.8-SNAPSHOT 12/93012/1
Robert Varga [Sat, 10 Oct 2020 16:07:36 +0000 (18:07 +0200)]
Bump versions to 5.0.8-SNAPSHOT

This starts the next development iteration.

Change-Id: I6943287d118e7e46db909bd9b7cecefe0b63e0a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 7.0.7 09/93009/1
Robert Varga [Fri, 9 Oct 2020 17:12:59 +0000 (19:12 +0200)]
Bump odlparent to 7.0.7

Pick up latest upgrade from upstream.

Change-Id: I84f2fde64259b4b2f3417235f1fd442aea4df30a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMake YangNamespaceContextNamespace global 45/92945/1
Robert Varga [Tue, 6 Oct 2020 18:47:55 +0000 (20:47 +0200)]
Make YangNamespaceContextNamespace global

The crux of the problem with not being able to resolve prefixes comes
from the fact we end up reusing the same context for both submodule
and module. Turn the namespace into a global one, keyed by the root
context.

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

3 years agoInclude Uint.ZERO in lower saturation bounds 60/92860/2
Robert Varga [Fri, 2 Oct 2020 14:44:13 +0000 (16:44 +0200)]
Include Uint.ZERO in lower saturation bounds

This is a slight performance optimization, use constant zero for
zero values.

Change-Id: I4cc3e2e8656746b8fce7a43ddb42df8865221653
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse Uint constants in base types 00/92700/2
Robert Varga [Fri, 2 Oct 2020 14:13:14 +0000 (16:13 +0200)]
Use Uint constants in base types

Rather than using valueOf(), use exposed ZERO and MAX_VALUE,
improving initialization speed just a little.

Change-Id: Ib6938c039bdf8773d6000f9eb6b56cf8f01ae1d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd Uint saturated converters 57/92757/3
Robert Varga [Mon, 28 Sep 2020 16:57:15 +0000 (18:57 +0200)]
Add Uint saturated converters

There are a number of places where we need to perform a saturated
conversion, i.e. when we have a 'long' count and need to put it into
a Uint32 field. Add methods to deal with that.

JIRA: YANGTOOLS-1135
Change-Id: Ia0bb2e9f0400d975ce1f4b150704dcf526d3bc82
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConvert uint tests to assertThrows() 55/92855/2
Robert Varga [Fri, 2 Oct 2020 13:28:32 +0000 (15:28 +0200)]
Convert uint tests to assertThrows()

We have a number of tests which can be consolidated, use assertThrows.
This flushes out a bad test case, which is corrected.

Change-Id: I3b0b760cb89a4dbd93ebe44af2ed917b0698fc31
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix warnings when we are augmenting-in a list 53/92553/6
Robert Varga [Mon, 21 Sep 2020 10:48:07 +0000 (12:48 +0200)]
Fix warnings when we are augmenting-in a list

When we are targetting a non-configuration list we end up issuing
a warning because the augment content contains the list as well --
and is not suppressed. Add logic to suppress it.

JIRA: YANGTOOLS-1133
Change-Id: I55e43d39949db756634e86e4e570df6bbbce6c1f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 5.0.7-SNAPSHOT 55/92555/1
Robert Varga [Mon, 21 Sep 2020 11:25:52 +0000 (13:25 +0200)]
Bump versions to 5.0.7-SNAPSHOT

This starts the next development iteration.

Change-Id: I36e470faeb2cf74cdfa927fe23583c73a7205f10
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse StandardCharsets 52/92552/1
Robert Varga [Mon, 21 Sep 2020 10:52:12 +0000 (12:52 +0200)]
Use StandardCharsets

Java 10 allows us to use a proper constant for charset.

Change-Id: Ie7706356bf5bcbde05e7632b099901d226f40cf1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 7.0.6 50/92550/1
Robert Varga [Mon, 21 Sep 2020 10:23:20 +0000 (12:23 +0200)]
Bump odlparent to 7.0.6

Pick up latest fixes from upstream.

Change-Id: I7e22867d25864f5f7da312af35a6a8cc7cabeec4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDefine MaxAccess enumeration 96/92496/1
Robert Varga [Fri, 18 Sep 2020 22:06:18 +0000 (00:06 +0200)]
Define MaxAccess enumeration

RFC2578 specifies which strings are actually valid as max-access
arguments. Make sure we properly validate them and use an enum.

JIRA: YANGTOOLS-1134
Change-Id: I9e22dccb115f34ab50aaa8cf84e09d12713c69fa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 51d659c364c9b775f50fa5badb7cf986e5ec29ac)

3 years agoFix SubIdStatement/ObjectIdentifier ranges 95/92495/1
Robert Varga [Fri, 18 Sep 2020 22:12:07 +0000 (00:12 +0200)]
Fix SubIdStatement/ObjectIdentifier ranges

RFC2578 makes it clear that each sub-identifier is an uint32 as
well as that there is at most 128 of them present in an ObjectIdentifier.

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

3 years agoRemove IetfYangSmiv2Namespace 90/92490/1
Robert Varga [Fri, 18 Sep 2020 20:49:04 +0000 (22:49 +0200)]
Remove IetfYangSmiv2Namespace

This namespace is useless, remove it.

JIRA: YANGTOOLS-1134
Change-Id: Ic285d7e68daf090b6a024f38a32de0c8e15414c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 24120d6b7770c2c45e51176f048b98191edd69b7)

3 years agoRemove unneeded overrides 86/92486/1
Robert Varga [Fri, 18 Sep 2020 19:35:14 +0000 (21:35 +0200)]
Remove unneeded overrides

We have a number of overridden methods we do not need, remove them.

JIRA: YANGTOOLS-1134
Change-Id: I657d392f3b11f72bd9f7a51db5a983a759b8c868
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd RFC6643 parser support 83/92483/3
Robert Varga [Fri, 18 Sep 2020 15:54:47 +0000 (17:54 +0200)]
Add RFC6643 parser support

RFC6643 defines a way to map SMIv2 to YANG. This mapping retains
the original SMI details using YANG extensions, so that the resulting
model can be mapped back.

This patch adds semantic support for these extensions, so that the
semantics are supported out of the box.

JIRA: YANGTOOLS-1134
Change-Id: I494b2537e89e5a104debe486a9012d22d5c7b3aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 4223bf8c4eae4a003b71554fbcc98b5377ddce2b)

3 years agoFix IRStatement formatting 78/92278/1
Robert Varga [Wed, 9 Sep 2020 12:22:06 +0000 (14:22 +0200)]
Fix IRStatement formatting

We should append a fragment rather than starting a new toString()
chain.

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

3 years agoInitialize IRStatementContext 25/92425/1
Robert Varga [Mon, 7 Sep 2020 19:02:32 +0000 (21:02 +0200)]
Initialize IRStatementContext

For compatibility reasons we may need to provide IRStatement-backed
StatementContext. This patch adds the basic conversion capability.

JIRA: YANGTOOLS-1130
Change-Id: I380d9c0438be60c3c6fef5377ebc674ebfe87f53
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoIntroduce IRSchemaSource 16/92416/2
Robert Varga [Thu, 27 Aug 2020 09:51:02 +0000 (11:51 +0200)]
Introduce IRSchemaSource

Rather than using ASTSchemaSource, use a dedicated IRSchemaSource,
which ends up being the replacement for ASTSchemaSource. We are
undoing some work previously done, but it allows easier backporting.

JIRA: YANGTOOLS-1130
Change-Id: Ifdeaa0d053558eda12432264fb768ed0d821468f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 1d4d5d61d5c50661d898b1b184f984d055486fba)

3 years agoDisconnect IRStatement from ANTLR 58/92258/2
Robert Varga [Sun, 23 Aug 2020 10:44:21 +0000 (12:44 +0200)]
Disconnect IRStatement from ANTLR

While we currently allow instantiation only from ANTLR, we may end
up with other ways of instantiating the intermediate form. Make sure
IRStatement does not have a dependency on ANTLR.

JIRA: YANGTOOLS-1130
Change-Id: I4d28f7c4fd8457fe01e7eae967e0917c1a91b4e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd an explicit intermediate YANG representation 47/92247/3
Robert Varga [Fri, 14 Aug 2020 10:55:12 +0000 (12:55 +0200)]
Add an explicit intermediate YANG representation

ANTLR classes are geared towards parsing and raw speed, without much
regards to memory usage. Most notably using ParseTree as our AST ends
up retaining separators and various metadata which we do not really
need.

Add a simplistic intermediate representation for our AST, which where
we pre-process ANTLR trees and de-duplicate strings. This leads to
elimination of 90% of objects, with corresponding reduction of memory
footprint.

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

3 years agoMake sure ASTSchemaSource operates on StatementContext 57/92257/1
Robert Varga [Mon, 24 Aug 2020 10:12:30 +0000 (12:12 +0200)]
Make sure ASTSchemaSource operates on StatementContext

We have external checks which are superfluous, as the implementation
is known to be invariant.

Change-Id: Ib5028b69c950fc940c335d97fee44e4a4deab99e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoEliminate DQUOT_START/SQUOT_START tokens 49/92249/1
Robert Varga [Sun, 23 Aug 2020 20:53:39 +0000 (22:53 +0200)]
Eliminate DQUOT_START/SQUOT_START tokens

Quoted strings are naturally terminated by end marker, potentially
preceded by DQUOT_STRING/SQUOT_STRING. This renders the corresponding
start tokens really just a academic completeness, costing us memory
while not bringing anything to the table.

Skip generation of these tokens, reducing memory usage by up to 4.5%.

JIRA: YANGTOOLS-1089
Change-Id: I0b7ce9bf292b0dd8475d63869ddfd8d2b86a387c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoEliminate quotedString parser construct 41/92241/3
Robert Varga [Sun, 23 Aug 2020 07:10:02 +0000 (09:10 +0200)]
Eliminate quotedString parser construct

Double-quoted strings are very common and having a separate parser
construct is not giving us much for the memory footprint it incurs.

Inline the recursive definition into argument and adjust parsing
code to cope with the change. This results in memory usage improvement
of up to 3.7%.

JIRA: YANGTOOLS-1089
Change-Id: I9fce7d1ed9f8df4bcc602978c66fcfba7bbd8ed8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFurther optimize YANG statement parsing 02/92102/1
Robert Varga [Sat, 22 Aug 2020 20:26:56 +0000 (22:26 +0200)]
Further optimize YANG statement parsing

Recursive definition of stringPart can easily end up with a large
number of retained objects -- i.e. we get StringPartContext for
each concatenation, with potentially small lists of three tokens.

Furthermore each unquotedString has ends up being typically defined
by a UnquotedStringContext containing a single StringPartContext,
which is clearly wasteful.

The grammar we are looking at is not that complex, hence we can
rewrite it without relying on recursion -- thus improving memory
footprint.

JIRA: YANGTOOLS-1089
Change-Id: I18eb1305d3e024d530552ac5cea0b5a928da0048
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0ca5c81f163ed5a56d42cd8d68302654a9bb8918)

3 years agoDeprecate StmtContext.getSchemaPath() 00/92100/1
Robert Varga [Sat, 22 Aug 2020 17:49:36 +0000 (19:49 +0200)]
Deprecate StmtContext.getSchemaPath()

We want to be identifying everyone who is touching this state,
as it ends up logically referencing the parent node and is going
away.

JIRA: YANGTOOLS-1131
Change-Id: I33a93bec07e6a3a12afc920eb6fe685fa4339f9b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 42c740433dad046caa3e22b84c6f4edccdd58197)

3 years agoSpecial-case identifier lexer token 08/92208/1
Robert Varga [Thu, 20 Aug 2020 14:48:41 +0000 (16:48 +0200)]
Special-case identifier lexer token

An unquoted string can be an IDENTIFIER, which is the most common
case anyway. This token does not have to be further validated and
thus it makes sense to special-case it. This has the neat effect
of reducing the depth of our parse tree, too -- bringing memory
usage down by 6.6% versus the original fix.

JIRA: YANGTOOLS-1089
Change-Id: I63701719e90334558048201d70d8264ab9299efb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 0ec7fd50a8d7768f55d03e2ad1c6156fb6836c67)

3 years agoCorrect (Un)qualifiedQName javadoc 99/92099/1
Robert Varga [Thu, 20 Aug 2020 09:35:23 +0000 (11:35 +0200)]
Correct (Un)qualifiedQName javadoc

This adds a bit of documentation and correcting a mitsaken @return.

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

3 years agoAdd a specialized token factory 00/92200/1
Robert Varga [Mon, 10 Aug 2020 12:07:00 +0000 (14:07 +0200)]
Add a specialized token factory

Our baseline parsing footprint is rather large. We can improve it
by looking at token component sizes and using distinct token classes.

Aside from CommonToken, which are using as fallbacks for text
handling, we introduce 4 specialized classes, three of them seeing
typical use.

Since these classes use smaller fields to hold lazy state, as well
as eliminate typical invariants, we end up saving around 39MiB (12%)
of AST size in a typical case from the field.

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

3 years agoAdd timing information about local file discovery 99/92199/1
Robert Varga [Thu, 20 Aug 2020 07:41:39 +0000 (09:41 +0200)]
Add timing information about local file discovery

Locating local files actually requires also pasing them to establish
their SourceIdentifier. Add output to establish timing of this step.

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

3 years agoTake advantage of keyword tokenization 52/92152/3
Robert Varga [Fri, 14 Aug 2020 09:09:05 +0000 (11:09 +0200)]
Take advantage of keyword tokenization

Now that the tokenization has been fixed, we can rely on keyword
context to provide us with neatly split prefix and local name --
hence we do not need to perform concat/split.

Change-Id: I5d8e37d2267fefa3c5eafc542e00df33142a0bae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRework YANG lexer/parser 39/92139/8
Robert Varga [Thu, 13 Aug 2020 18:15:06 +0000 (20:15 +0200)]
Rework YANG lexer/parser

The definitions in the parser and lexer are quite arcane and are
actually wrong, not allowing for a number of edge cases, which are
completely valid.

Furthermore the definition of IDENTIFIER is wrong, as it allows /
and : to appear in it -- effectively ruining the tokenization in
parser.

Refactor the lexer to perform correct tokenization in every situation.
This makes it more complicated, but also much more obvious as to
what is going on -- especially with regard as to what decisions
end up being parser's responsibility.

Refactor the parser so it recognizes YANG tokenization constructs,
notably quoted and unquoted strings, and assemble them from lexer
tokens.

JIRA: YANGTOOLS-1089
Change-Id: I34472bf0a7e262d4f633ce271952bbcd7639ef2f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoReplace block comment with a non-greedy rule 37/92137/1
Robert Varga [Thu, 13 Aug 2020 18:09:10 +0000 (20:09 +0200)]
Replace block comment with a non-greedy rule

We do not need an explicit mode here, we can just use a non-greedy
match and move on. This simplifies things a bit.

Change-Id: Ieab6d9cec1b17c8d86cda49cfc46a258a569e5e0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRework keyword parser rule 32/92032/5
Robert Varga [Tue, 11 Aug 2020 09:38:52 +0000 (11:38 +0200)]
Rework keyword parser rule

A keyword is either a plain identifier, or two identifiers concatenated
through a colon. Make this a bit clearer, aiding debugging of issues.

Also push KeywordContext down to
StatementContextVisitor.getValidStatementDefinition(), so that we can
improve efficiency once IDENTIFIER token has been fixed up.

Change-Id: Ic64285255564ae33f8ad208b9a3598ba20cd26fb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor YANG statement parser structure 27/92027/3
Robert Varga [Tue, 11 Aug 2020 08:47:25 +0000 (10:47 +0200)]
Refactor YANG statement parser structure

Current definition leads to leading whitespace being considered
a part of the statement. This leads to misleading line/character
being reported as the start of the statement.

Fix this by introducing a top-level 'file', which encapsulates
at least one statement with its leading/trailing whitespace. The
other parts then come together naturally.

JIRA: YANGTOOLS-1129
Change-Id: I9f725b09eae6f8acf4397c97c60f99caaade798b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix AnyxmlSchemaLocationStatementSupport declaration 15/92015/2
Robert Varga [Mon, 10 Aug 2020 16:17:25 +0000 (18:17 +0200)]
Fix AnyxmlSchemaLocationStatementSupport declaration

We should not be operating on parameterized EffectiveStatement,
but rather of AnyxmlSchemaLocationEffectiveStatement itself.

Change-Id: I9130f57ced47d416d3d7f300e03eacd876bf0a27
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix YangDataStatementSupport declaration 14/92014/2
Robert Varga [Mon, 10 Aug 2020 16:11:57 +0000 (18:11 +0200)]
Fix YangDataStatementSupport declaration

We should not be operating on parameterized EffectiveStatement,
but rather of YangDataEffectiveStatement itself.

Change-Id: I02797816e712b9a484dca694c77f4074ceb2b0da
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix declaration of extension-related supports 11/92011/2
Robert Varga [Mon, 10 Aug 2020 15:13:10 +0000 (17:13 +0200)]
Fix declaration of extension-related supports

We should properly specialize these to UnrecognizedEffectiveStatement,
not just any old statement.

Change-Id: I4a09dd9d25040bf62142444566ca39c61b6c57fc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix yangtools-docs references 34/91634/1
Robert Varga [Fri, 24 Jul 2020 15:12:03 +0000 (17:12 +0200)]
Fix yangtools-docs references

We are pointing at the wrong versions again, fix that up.

Change-Id: I14280df808a8d7d3cc9037dc3d51860f89018d18
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFix some util javadoc warnings 15/91615/1
Robert Varga [Fri, 24 Jul 2020 09:17:34 +0000 (11:17 +0200)]
Fix some util javadoc warnings

Clean up some warnings, progressing towards a warning-free build.

Change-Id: Ia199d771f409f25ffa1f8aadfd1814f13ee3806e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoFixup yang-model-api javadoc warnings 12/91612/1
Robert Varga [Fri, 24 Jul 2020 09:05:36 +0000 (11:05 +0200)]
Fixup yang-model-api javadoc warnings

There are a number of issues javadoc is complaining about, fix them
up.

Change-Id: I82e108faca800b80a85e00aab96cb8ec8fdc91e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 5.0.6-SNAPSHOT 38/91538/2
Robert Varga [Wed, 22 Jul 2020 13:18:32 +0000 (15:18 +0200)]
Bump versions to 5.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I8cc0583d3cf9f32a4ebc7cb971fe29d226196ac6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump odlparent to 7.0.5 34/91534/1
Robert Varga [Wed, 22 Jul 2020 12:15:25 +0000 (14:15 +0200)]
Bump odlparent to 7.0.5

Pick up odlparent with netty fix.

Change-Id: I1b469bcb1f34fab8dc82ed39b4d3ffe418d24099
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRevert "Update YANG lexer/parser to accept free-standing '+'" 32/91532/1
Robert Varga [Wed, 22 Jul 2020 11:15:56 +0000 (13:15 +0200)]
Revert "Update YANG lexer/parser to accept free-standing '+'"

This reverts commit 04ed60d275521fd6e6ee57d5b1ce4e6a519d2e35, as it
causes a regression around "foo" +"foo" construct.

JIRA: YANGTOOLS-1089
Change-Id: Ib5af7a994c19bf99fb5cb2a875063d623cc6c3f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUpdate SchemaNodeIdentifier design a bit 11/91511/3
Robert Varga [Tue, 21 Jul 2020 19:01:20 +0000 (21:01 +0200)]
Update SchemaNodeIdentifier design a bit

Using explicit instanceof checks is not very code friendly, as we
usually end up using either Absolute or Descendant identifier and
forcing an instanceof check is hiding things from the compiler.

Furthermore {first,last}NodeIdentifier are really only useful in
the Absolute case.

Update the design by moving utility methods to Absolute and
add four specialized classes. While this adds a bit of code
duplication and verbosity, the result is a bit better in that we
do not have explicit casts and checks.

Furthermore, in the case of a particular use, for example Absolute,
the code ends up dealing with two concrete implementations, leading
to bimorphic dispatch which is fully visible to JIT.

Change-Id: I2f3b7dc9ac3bf3d038e815f2406bd5c5629f8553
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaNodeIdentifier.{first,last}Identifer() 08/91508/1
Robert Varga [Tue, 21 Jul 2020 15:29:46 +0000 (17:29 +0200)]
Add SchemaNodeIdentifier.{first,last}Identifer()

A number of operations involving SchemaNodeIdentifier are interested
in either the first or the last part of it. Add methods to efficiently
access them.

Change-Id: I0ecb9ee2d4ce0aba7ca7c302a751c273555456e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd SchemaNodeIdentifier.Absolute.intern() 02/91502/2
Robert Varga [Tue, 21 Jul 2020 12:02:19 +0000 (14:02 +0200)]
Add SchemaNodeIdentifier.Absolute.intern()

We will be using SchemaNodeIdentifiers in a lot of contexts, some
of which involve dynamic wiring lookups. In these contexts we want
the ability to squash an Absolute schema node identifier into a
JVM-wide single instance -- hence we get benefits of cached hash
code and instance-shortcuts on equals().

Change-Id: I2144ba659a783d585e59103dde3e6d292a63ec48
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump versions to 5.0.5-SNAPSHOT 95/91395/1
Robert Varga [Fri, 17 Jul 2020 15:54:52 +0000 (17:54 +0200)]
Bump versions to 5.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: I35d576671154998adba1643361ce0dc86ad576cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoBump to odlparent-7.0.4 35/91235/5
Robert Varga [Sat, 11 Jul 2020 14:22:25 +0000 (16:22 +0200)]
Bump to odlparent-7.0.4

Pick up latest upgrades from upstream.

Change-Id: I9843867449ac5f0eaf16d562df493cb13b495f4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoUse modifiable List when resolving relative xpath 18/91318/9
Tomas Cere [Tue, 14 Jul 2020 13:05:18 +0000 (15:05 +0200)]
Use modifiable List when resolving relative xpath

When we have split the path into its components, we can end up
compressing them further. Make sure the list is actually mutable.

JIRA: YANGTOOLS-1125
Change-Id: I1d4cd66d2efbb1955bb189763ea09fefeba93d25
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoClean up predicates prior to xpath normalization 29/91329/2
Tomas Cere [Wed, 15 Jul 2020 08:43:57 +0000 (10:43 +0200)]
Clean up predicates prior to xpath normalization

Path splitting is not equipped to ignore step predicates, which leads
it to do arrive at the wrong path. Remove any predicates before
embarking on resolving the reference.

JIRA: YANGTOOLS-1126
Change-Id: Ia32836ad1acec0762d9baa7ded5f65fa72f39b93
Signed-off-by: Tomas Cere <tomas.cere@pantheon.tech>
3 years agoUpdate approval link 86/91286/2
Robert Varga [Sun, 12 Jul 2020 21:22:14 +0000 (23:22 +0200)]
Update approval link

YANGTOOLS does have an approval link -- it is not easy to find,
but it is linked from graduation review.

Change-Id: Id30ae9493072389b4c6d7da0979acec47af86d64
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd INFO.yaml for yangtools 70/91270/1
Anil Belur [Sun, 12 Jul 2020 02:51:11 +0000 (12:51 +1000)]
Add INFO.yaml for yangtools

Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
Change-Id: I1ab91a7cde9e13b44181f7d74318a613151cb849

3 years agoFix YangConstants.RFC6020_YIN_MEDIA_TYPE 64/90964/1
Robert Varga [Tue, 7 Jul 2020 17:53:14 +0000 (19:53 +0200)]
Fix YangConstants.RFC6020_YIN_MEDIA_TYPE

The definition and reference are wrong here, fix that up.

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

3 years agoUpdate YANG lexer/parser to accept free-standing '+' 04/89104/5
Robert Varga [Fri, 17 Apr 2020 18:01:36 +0000 (20:01 +0200)]
Update YANG lexer/parser to accept free-standing '+'

The lexer is not quite accurate, as it does not allow for strings
starting with a '+' when not quoted. Fix this up, relaxing the
rules.

JIRA: YANGTOOLS-1089
Change-Id: Ifaf9c65966b43f26f37fc88a11d77fc9f43d2c8c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoClean up OpenConfigVersionSupport 25/90925/1
Robert Varga [Mon, 6 Jul 2020 09:24:27 +0000 (11:24 +0200)]
Clean up OpenConfigVersionSupport

Type parameters should be referencign OpenConfigVersionEffectiveStatement,
fix it up.

Change-Id: Ied2cf301c16270bd21e6f211a97665d682269aaa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoAdd UnknownSchemaNodeMixin 22/90922/1
Robert Varga [Sun, 5 Jul 2020 18:28:20 +0000 (20:28 +0200)]
Add UnknownSchemaNodeMixin

Add basic mixin to use with effective statement implementations.

JIRA: YANGTOOLS-1123
Change-Id: Iaa0a7e9624d22999285d36f28ee6a0d797b936db
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor ExtensionStatementSupport 18/90918/3
Robert Varga [Fri, 3 Jul 2020 14:52:15 +0000 (16:52 +0200)]
Refactor ExtensionStatementSupport

Using RecursiveObjectLeaker requires integration with object
construction and is inherently dangerous.

As it turns out, we can solve this problem differently, without
having to rely on this magic by pre-allocating the resulting
effective statement and populating it into a thread-local map.

That allows us to pick up that object for purposes of including
it in substatements -- thus breaking the recursion. Once we have
acquired substatements, the real build methods just fill them
into the pre-allocated object are return it.

On exit we check whether we have cleared the state map and clean
it up automatically, as this is not expected to be a major
performance problem.

JIRA: YANGTOOLS-1122
Change-Id: Iebbbffd6f62fa57ce496a2ab7bc8e5792198d3a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRefactor {Module,Submodule}EffectiveStatementImpl 02/87502/7
Robert Varga [Fri, 3 Jul 2020 09:56:35 +0000 (11:56 +0200)]
Refactor {Module,Submodule}EffectiveStatementImpl

Modules and submodules are tied together via AbstractEffectiveModule,
which holds on to old layout. While it is not directly harmful to
these implementations, having statement creation outside of actual
constructors is a long-term goal.

Refactor AbstractEffectiveModule and thus both implementations to
create substatements separately in BaseStatementSupport.

The inlining of submodule statements is hooked into
BaseStatementSupport lifecycle via buildEffectiveSubstatements(),
so that modules can stop mucking with statement build rules and just
pick up whatever was created for the corresponding submodule.

For declared statements we introduce AbstractDeclaredEffectiveRootStatement
as a replacement for AbstractRootStatement, which is now deprecated
for removal.

JIRA: YANGTOOLS-1065
Change-Id: I032bb1ea4f2ee5db87d9b0dbbdeb89f152bc4593
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove statement filter caches from AbstractEffectiveModule 13/90913/3
Robert Varga [Fri, 3 Jul 2020 09:03:21 +0000 (11:03 +0200)]
Remove statement filter caches from AbstractEffectiveModule

Majority of collections kept by AbstractEffectiveModule are simple
filters on effective substatements. Use Collections2.filter()
instead of fully instantiating them.

Since we are dealing with generic Collections, this is also flushing
out a bad use of equality in a test.

JIRA: YANGTOOLS-1065
Change-Id: If6e8689fdd6638aaddfd45c4846086c03d91032e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove simple AbstractEffectiveModule properties 12/90912/1
Robert Varga [Fri, 3 Jul 2020 08:49:39 +0000 (10:49 +0200)]
Remove simple AbstractEffectiveModule properties

A number of properties are just a simple search in substatements,
let's not waste fields on having them cached, as they are typically
unused anyway.

JIRA: YANGTOOLS-1065
Change-Id: I61c05bb89129beb5d0876067763a016e7d850e12
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove AbstractEffectiveModule.get{Namespace,Revision} 11/90911/1
Robert Varga [Fri, 3 Jul 2020 08:43:49 +0000 (10:43 +0200)]
Remove AbstractEffectiveModule.get{Namespace,Revision}

These methods are provided as default methods in Module, remove
them to reduce clutter.

JIRA: YANGTOOLS-1065
Change-Id: I6139d1ee9d0ab42f6a52677a20d6823b2dc98022
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove AbstractEffectiveModule.name 10/90910/1
Robert Varga [Fri, 3 Jul 2020 08:42:26 +0000 (10:42 +0200)]
Remove AbstractEffectiveModule.name

This field is just shadowing argument(), remove it.

JIRA: YANGTOOLS-1065
Change-Id: Ib3b078548269b50ae69f4cecceee47dc9890b562
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoDeprecate EffectiveStatementBase for removal 05/90905/3
Robert Varga [Thu, 2 Jul 2020 22:27:43 +0000 (00:27 +0200)]
Deprecate EffectiveStatementBase for removal

With all immediate users migrated or deprecated, mark the grim
future for this class, slating it for removal/integration.

JIRA: YANGTOOLS-1065
Change-Id: I4d06bdceedc3fcf5e45125f2f7fcfffe3de7d35e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoRemove {Numerical,String}RestrictionsImpl 04/90904/3
Robert Varga [Thu, 2 Jul 2020 22:13:53 +0000 (00:13 +0200)]
Remove {Numerical,String}RestrictionsImpl

As noted during previous migration, these classesalong with their
support is unused. Furthermore NumericalRestrictions is
mis-declared.

Remove the implementation and drop a FIXME for next major version,
so that we at least fix the definition or decide its overall
future.

Note this concept is probably useful, as it gates towards tasks
which are currently done by AbstractTypeStatementSupport and those
could be split out if we rework interactions with simple built-in
types.

JIRA: YANGTOOLS-1065
Change-Id: Ief43d59dbc541b094ca80e39382f8c0c8767bac2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate InstanceIdentifierSpecificationSupport 03/90903/2
Robert Varga [Thu, 2 Jul 2020 22:08:34 +0000 (00:08 +0200)]
Migrate InstanceIdentifierSpecificationSupport

InstanceIdentifierSpecificationSupport can use memory-efficient
representation through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: I821172baf33bd639fd52e02160db7122b4f53367
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate LeafrefSpecificationSupport 02/90902/3
Robert Varga [Thu, 2 Jul 2020 21:56:30 +0000 (23:56 +0200)]
Migrate LeafrefSpecificationSupport

LeafrefSpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: I735563730e8c382b49ea01fccc00191ffcfdfb14
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate UnionSpecificationSupport 01/90901/2
Robert Varga [Thu, 2 Jul 2020 21:44:23 +0000 (23:44 +0200)]
Migrate UnionSpecificationSupport

UnionSpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: I93ad3126e000c489776ea92aed58e9183e93da42
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate IdentityRefSpecificationSupport 00/90900/2
Robert Varga [Thu, 2 Jul 2020 21:28:27 +0000 (23:28 +0200)]
Migrate IdentityRefSpecificationSupport

IdentityRefSpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: Ic198df95ab519f42c687b7bec0d0620b9c9a9126
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate EnumSpecificationSupport 99/90899/4
Robert Varga [Thu, 2 Jul 2020 21:08:20 +0000 (23:08 +0200)]
Migrate EnumSpecificationSupport

EnumSpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: I0b211e2cfd09cae8e69ca614b190a562ba85e090
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate Decimal64SpecificationSupport 96/90896/3
Robert Varga [Thu, 2 Jul 2020 20:54:20 +0000 (22:54 +0200)]
Migrate Decimal64SpecificationSupport

Decimal64SpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: Ic00af914cf31095179b2e9da4484679929431ed0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate BitsSpecificationSupport 95/90895/3
Robert Varga [Thu, 2 Jul 2020 20:43:18 +0000 (22:43 +0200)]
Migrate BitsSpecificationSupport

BitsSpecificationSupport can use memory-efficient representation
through BaseStatementSupport. Furthermore we can reuse
TypeEffectiveStatementImpl instead of brewing a separate effective
implementation.

JIRA: YANGTOOLS-1065
Change-Id: Id2d9b816388584ceda3c8cc8528b8cccfae08fbb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate IntegralTypeEffectiveStatementImpl 94/90894/4
Robert Varga [Thu, 2 Jul 2020 18:25:52 +0000 (20:25 +0200)]
Consolidate IntegralTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of each
integral type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I21f9cbdd97966f7a1d36ae536ac01fb93f3596ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate StringTypeEffectiveStatementImpl 93/90893/5
Robert Varga [Thu, 2 Jul 2020 18:18:59 +0000 (20:18 +0200)]
Consolidate StringTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of a string
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: Icaf85f1cb49f98a8c019fb0752777f00a98b5491
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate LeafrefTypeEffectiveStatementImpl 92/90892/5
Robert Varga [Thu, 2 Jul 2020 18:14:41 +0000 (20:14 +0200)]
Consolidate LeafrefTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of a
leafref type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I39bd8f7520c4c1678725ab2dfb1d805fc07e8034
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate InstanceIdentifierTypeEffectiveStatementImpl 91/90891/4
Robert Varga [Thu, 2 Jul 2020 18:09:34 +0000 (20:09 +0200)]
Consolidate InstanceIdentifierTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an
instance-identifier type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I07db26a6e96a937c9335afe081d92441b29d3553
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate EnumTypeEffectiveStatementImpl 90/90890/4
Robert Varga [Thu, 2 Jul 2020 18:06:11 +0000 (20:06 +0200)]
Consolidate EnumTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an enum
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I756ee91f4ce9c9e846ee65afbc4629dd23668002
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate DecimalTypeEffectiveStatementImpl 89/90889/5
Robert Varga [Thu, 2 Jul 2020 18:02:43 +0000 (20:02 +0200)]
Consolidate DecimalTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an decimal
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I352675843882b2fce414b10b58a38315c759278d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate BitsTypeEffectiveStatementImpl 88/90888/4
Robert Varga [Thu, 2 Jul 2020 17:59:18 +0000 (19:59 +0200)]
Consolidate BitsTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an bits
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I80bb47dd6b5aa77aad619c271cea70fdab2547d1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate UnionTypeEffectiveStatementImpl 87/90887/4
Robert Varga [Thu, 2 Jul 2020 17:52:49 +0000 (19:52 +0200)]
Consolidate UnionTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an union
type, migrate it.

This was the last user of AbstractTypeStatementSupport, so remove
that, too.

JIRA: YANGTOOLS-1065
Change-Id: Ic69a9b4126062c06fe137c0b3144d431fd8124e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate IdentityrefTypeEffectiveStatementImpl 86/90886/4
Robert Varga [Thu, 2 Jul 2020 17:49:30 +0000 (19:49 +0200)]
Consolidate IdentityrefTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an identityref
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: Ibc13fff074cf7c4f597686f75ba55f65f6870ba1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate EmptyTypeEffectiveStatementImpl 85/90885/4
Robert Varga [Thu, 2 Jul 2020 17:46:43 +0000 (19:46 +0200)]
Consolidate EmptyTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of an empty
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I9b77ce4b609f1624a18de97e3f3c6272ea22003b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate BooleanTypeEffectiveStatementImpl 84/90884/4
Robert Varga [Thu, 2 Jul 2020 17:43:56 +0000 (19:43 +0200)]
Consolidate BooleanTypeEffectiveStatementImpl

TypeEffectiveStatementImpl can easily support the case of a boolean
type, migrate it.

JIRA: YANGTOOLS-1065
Change-Id: I24bc5fa4909710805d9503db69ed49f65878e1af
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoConsolidate BinaryTypeEffectiveStatementImpl 83/90883/4
Robert Varga [Thu, 2 Jul 2020 17:38:04 +0000 (19:38 +0200)]
Consolidate BinaryTypeEffectiveStatementImpl

Derived TypeEffectiveStatements follow an obvious pattern, where
we do not need to have specialized subclasses for each of them.

Introduce TypeEffectiveStatementImpl and migrate 'type binary' to
use it.

JIRA: YANGTOOLS-1065
Change-Id: I16c259718c3502d85ad0e77c5f612eb9d601d979
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMigrate AbstractTypeStatementSupport 82/90882/5
Robert Varga [Thu, 2 Jul 2020 16:11:15 +0000 (18:11 +0200)]
Migrate AbstractTypeStatementSupport

Support for 'type' statement is rather twisted, but at the end of
the day, externalizing substatement creation is rather easy.

Switching to BaseStatementSupport allows us to discern when we can
end up pointing to a BuiltinTypeStatement -- since there is not such
thing as an implicit type statement.

On the declared front, this is a straightforward migration to
AbstractDeclaredStatement.WithRawStringArgument subclasses, which
ends up reducing typical footprint from 32 bytes to 16/24 bytes.

On the effective front, this does not really do anything, as these
are handled on per-type basis.

JIRA: YANGTOOLS-1065
Change-Id: I421f72a765fd6a28f984d463d8b9991dd7c1d231
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoSplit out AbstractTypeStatementSupport.resolveTypeReference() 81/90881/4
Robert Varga [Thu, 2 Jul 2020 16:22:18 +0000 (18:22 +0200)]
Split out AbstractTypeStatementSupport.resolveTypeReference()

The implementation of createEffective() method is quite huge,
split out the switch lookup part out of it, saving a few lines.

JIRA: YANGTOOLS-1065
Change-Id: I97c36b2263a3ee2c4f394f77e3d5651846aa91f3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoReuse common superclass for BuiltinTypeStatement 80/90880/4
Robert Varga [Thu, 2 Jul 2020 15:47:29 +0000 (17:47 +0200)]
Reuse common superclass for BuiltinTypeStatement

BuiltinTypeStatement duplicates pretty much all of its implementation
from AbstractDeclaredStatement.WithRawStringArgument. Eliminate
duplication, so we have less code to maintain.

JIRA: YANGTOOLS-1065
Change-Id: Ib27fe7f19001c5ffd563dad41843e74a3539765d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
3 years agoMinimize AbstractTypeStatementSupport.internArgument() 78/90878/4
Robert Varga [Thu, 2 Jul 2020 15:37:13 +0000 (17:37 +0200)]
Minimize AbstractTypeStatementSupport.internArgument()

Use an expression instead of assignement/check to reduce bytecode
footprint.

JIRA: YANGTOOLS-652
Change-Id: I2f900e0175904828e8efc273e9aca391221d19ce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>