yangtools.git
4 years agoRefactor Feature statement implementations 53/87453/3
Robert Varga [Wed, 5 Feb 2020 15:01:13 +0000 (16:01 +0100)]
Refactor Feature statement implementations

While these are not common, implementation classes are holding
down an abstract superclass. Improve memory footprint by switching
to more efficient class hierarchy.

JIRA: YANGTOOLS-1065
Change-Id: I8f19c217e9a08d71d47a3afbe5ad8ea035b8a02a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRelease statement source upon Effective Model completion 56/87456/1
Robert Varga [Wed, 5 Feb 2020 19:50:53 +0000 (20:50 +0100)]
Release statement source upon Effective Model completion

Once we have an effective model, we do not need to access statement
source, hence we can let it be GC'd.

JIRA: YANGTOOLS-652
Change-Id: I5c7024c4709a7b97bf061cd5f02d923319378011
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor identity statement implementations 26/87326/4
Robert Varga [Fri, 31 Jan 2020 14:52:15 +0000 (15:52 +0100)]
Refactor identity statement implementations

Minimize memory footprint of identity statements, with minimal
refactor of the underlying logic.

JIRA: YANGTOOLS-1065
Change-Id: Ie3037f15164dbdf42845792adbf6d4ce33e03d94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove dataTree/schemaTree to AbstractEffectiveModule 49/87449/2
Robert Varga [Wed, 5 Feb 2020 11:49:41 +0000 (12:49 +0100)]
Move dataTree/schemaTree to AbstractEffectiveModule

There are no subclasses of AbstractSchemaEffectiveDocumentedNode
which would take advantage of the functionality here except
AbstractEffectiveModule. Remove the fields and utilites and tailor
them to the needs of AbstractEffectiveModule.

JIRA: YANGTOOLS-1065
Change-Id: I6b8be83295b30b307a0cb4ebaa994cecc0947a26
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove AbstractEffectiveDocumentedDataNodeContainer 48/87448/2
Robert Varga [Wed, 5 Feb 2020 11:40:29 +0000 (12:40 +0100)]
Remove AbstractEffectiveDocumentedDataNodeContainer

This superclass does not have any users anymore, remove it.

Change-Id: Ic649105f23c69a489ea6c102be4cb3d034d63369
JIRA: YANGTOOLS-652
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor augment statement implementation 47/87447/4
Robert Varga [Wed, 5 Feb 2020 10:34:25 +0000 (11:34 +0100)]
Refactor augment statement implementation

Augment has an interesting interplay with EffectiveStatementBase,
where it overrides the list of statements to be built by wrapping
them in implicit definition.

Furthermore the implementation classes are needlessly wasteful,
we refactor them to not carry the definitions.

JIRA: YANGTOOLS-1065
Change-Id: I55407a26f163aeecff820048a6545eae8879b5e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor grouping statement implementations 38/87438/7
Robert Varga [Tue, 4 Feb 2020 23:37:58 +0000 (00:37 +0100)]
Refactor grouping statement implementations

Groupings have large footprint, make sure we minimize it. As we do not
want to make GroupingEffectiveStatement SchemaTreeAware just yet, we
create a lazily-instantiated DefaultDataNodeContainer class to support
DataNodeContainer aspects.

JIRA: YANGTOOLS-1065
Change-Id: Ia1183c2d7f83599462724b35e2f3aad4f160eef1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup getQName() mixin interplay 37/87437/4
Robert Varga [Tue, 4 Feb 2020 22:54:10 +0000 (23:54 +0100)]
Cleanup getQName() mixin interplay

We are providing more than we should need across type hierarchy,
leading to duplication. Fix it up.

JIRA: YANGTOOLS-652
Change-Id: I80dd8b1c736a9b07759f730c2813328991268186
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor notification statement implementation 36/87436/3
Robert Varga [Tue, 4 Feb 2020 23:03:34 +0000 (00:03 +0100)]
Refactor notification statement implementation

Notification statements are quite common and our implementation
classes are needlessly bit. Refactor them to be smaller.

JIRA: YANGTOOLS-1065
Change-Id: Ibcccec1a532bde9458d31b82ce90465080289299
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove AbstractEffectiveOperationDefinition 34/87434/3
Robert Varga [Tue, 4 Feb 2020 22:01:07 +0000 (23:01 +0100)]
Remove AbstractEffectiveOperationDefinition

With RPC/Action statements migrated, this abstract class has no
users, remove it.

JIRA: YANGTOOLS-652
Change-Id: I458df84652ffb5b2801c1d47f9a46928b263545b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor rpc/action statements 33/87433/3
Robert Varga [Tue, 4 Feb 2020 19:10:20 +0000 (20:10 +0100)]
Refactor rpc/action statements

Both these are supported by AbstractEffectiveOperationDefinition,
which has less-than-optimal layout. Refactor implementations to
lower their memory footprint.

JIRA: YANGTOOLS-1065
Change-Id: I60c3bced543e9dd5eaf71e710d01295310b5983e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd BaseStringStatementSupport.parseArgument() 32/87432/2
Robert Varga [Tue, 4 Feb 2020 22:13:52 +0000 (23:13 +0100)]
Add BaseStringStatementSupport.parseArgument()

All subclasses are performing a simple pass-through, eliminate code
duplication by introducing a final method in superclass.

JIRA: YANGTOOLS-652
Change-Id: Ie6c5ad81b19b010d59acb781f5e791bfd6456aea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove AbstractEffective(MustConstraintAware)DataSchemaNode 29/87429/1
Robert Varga [Tue, 4 Feb 2020 18:51:34 +0000 (19:51 +0100)]
Remove AbstractEffective(MustConstraintAware)DataSchemaNode

These two abstract classes do not have any users, remove them.

JIRA: YANGTOOLS-652
Change-Id: I27952be77a1008f40910e2be099c09038432e738
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor anyxml/anydata 28/87428/1
Robert Varga [Tue, 4 Feb 2020 18:30:04 +0000 (19:30 +0100)]
Refactor anyxml/anydata

These are quite simple classes, which are needlessly bloated. Fix
up implementation classes to shed ~50% of overhead.

This also leaves AbstractEffectiveMustConstraintAwareDataSchemaNode
without any users, hence we mark it for removal.

JIRA: YANGTOOLS-1065
Change-Id: I206b186e058f493a9b90aa2ed7529be0d88a1fc7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix Status encoding 27/87427/1
Robert Varga [Tue, 4 Feb 2020 18:55:12 +0000 (19:55 +0100)]
Fix Status encoding

We assigned wrong bits for Status.OBSOLETE, leading wrong value being
reported.

JIRA: YANGTOOLS-652
Change-Id: I5eb9f756d37df756d64f7de24171f601657b78f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate choice statement implementations 26/87426/3
Robert Varga [Tue, 4 Feb 2020 15:27:13 +0000 (16:27 +0100)]
Migrate choice statement implementations

Choice statement is rather large in terms of size, improve the
situation by refactoring both declared and effective statements,
shedding ~50% of shallow size.

JIRA: YANGTOOLS-1065
Change-Id: I3189b5f0a99ff16feab4996d2fdab54401fda7e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove AbstractEffectiveSimpleDataNodeContainer 24/87424/5
Robert Varga [Tue, 4 Feb 2020 13:13:58 +0000 (14:13 +0100)]
Remove AbstractEffectiveSimpleDataNodeContainer

Our refactoring has resulted in this class being unused, remove it.

JIRA: YANGTOOLS-652
Change-Id: Icbfc7122b073b0945b9d18c8d011e74ef571dec6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate case statement 23/87423/5
Robert Varga [Tue, 4 Feb 2020 12:34:49 +0000 (13:34 +0100)]
Migrate case statement

Optimize declared/effective implementations to save memory and
share more codepaths. As a side-effect of this refactor,
implicitly-created case statements accurately do not retain
declared instances.

JIRA: YANGTOOLS-1065
Change-Id: Iaf4a7171c006d4f3818c1f5a021ceb0c35ea0366
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFixup input/output statements 25/87425/2
Robert Varga [Tue, 4 Feb 2020 14:50:17 +0000 (15:50 +0100)]
Fixup input/output statements

Declared statements need to reflect declaration source, as otherwise
we would end up exporting the declared subtree as if the statements
were really declared.

JIRA: YANGTOOLS-1065
Change-Id: I964da42219346dfa273b640fe8df93e5e0a44669
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove deprecated AbstractEffectiveSimpleDataNodeContainer subclasses 22/87422/2
Robert Varga [Tue, 4 Feb 2020 12:04:53 +0000 (13:04 +0100)]
Remove deprecated AbstractEffectiveSimpleDataNodeContainer subclasses

Our refactoring resulted in these three abstract classes becoming
unused, remove them.

JIRA: YANGTOOLS-652
Change-Id: Id77c28cb53d2cc78cf1871524dad52d5a6988c7b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate input/output statements 21/87421/2
Robert Varga [Tue, 4 Feb 2020 09:59:51 +0000 (10:59 +0100)]
Migrate input/output statements

Optimize declared/effective implementations to save memory and
share more codepaths. As a side-effect of this refactor,
implicitly-created input statements accurately do not retain
declared instances.

JIRA: YANGTOOLS-1065
Change-Id: I2a51759ad80a7e07be362a9d349c2ddeb1d7e849
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd DefaultWithDataTree.WithSubstatements 20/87420/1
Robert Varga [Tue, 4 Feb 2020 10:55:41 +0000 (11:55 +0100)]
Add DefaultWithDataTree.WithSubstatements

The combination of being a DataTree-aware statement with substatements
is quite common -- lift it to its own abstract superclass.

JIRA: YANGTOOLS-1065
Change-Id: I39d7d26d2ff8b1c7ee04a4154e94093703dd73ff
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd CopyPolicy.REJECT 94/87394/1
Robert Varga [Mon, 3 Feb 2020 16:04:24 +0000 (17:04 +0100)]
Add CopyPolicy.REJECT

There are a number of statements which should never be copied and
any such attempt should cause the reactor to fail. This adds the
appropriate copy policy.

JIRA: YANGTOOLS-694
Change-Id: I0c51f2d2b96b2de8a1dc1b287d9dbcef1bd6c463
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor deviation statement implementations 93/87393/1
Robert Varga [Mon, 3 Feb 2020 15:56:55 +0000 (16:56 +0100)]
Refactor deviation statement implementations

This minimizes memory footprint, while reusing most infrastructure
we have for simple statements.

JIRA: YANGTOOLS-1065
Change-Id: Ibd33acfec39768a6ba5610669b619ccda34f753c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor Revision statement implementations 28/87328/3
Robert Varga [Fri, 31 Jan 2020 16:02:16 +0000 (17:02 +0100)]
Refactor Revision statement implementations

This minimizes memory footprint, while reusing most infrastructure
we have for simple statements.

JIRA: YANGTOOLS-1065
Change-Id: Ibc74c0c43c0f0fa704f2b63c0a736c8c0994abc1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd StatementContextBase.hasEmptySubstatements() 57/87357/14
Robert Varga [Sun, 2 Feb 2020 09:47:21 +0000 (10:47 +0100)]
Add StatementContextBase.hasEmptySubstatements()

This is a performance optimization shortcut so that empty substatements
do not need to perform magic tricks for us.

JIRA: YANGTOOLS-652
Change-Id: Ibfca38418133d4dc670e1858154da10b24556009
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMark statements as context-insensitive 45/87145/47
Robert Varga [Sun, 26 Jan 2020 02:14:54 +0000 (03:14 +0100)]
Mark statements as context-insensitive

A number of statements are subject to inlining, but not all of them
are affected by such inlining.

When a substatement is not affected by inlining (and inference
after the fact), we can safely reuse original statement context for
the purposes of representing effective state.

Teach AbstractStatementSupport about the concept of context-independence
and take advantage of it in simple statements. The end result is
fewer instantiated StmtContext objects, reducing peak memory usage.

Since StmtContext instance are shared, we also end up sharing
EffectiveStatement implementations, completely removing duplication
in reference test case -- eliminating ~3.7M objects and trimming
retained size by 56MiB, i.e. 7.8%.

JIRA: YANGTOOLS-694
Change-Id: I2e29ef24cf31ca800de36403037c3af11698a789
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove MinElements(Effective)StatementImpl 85/87385/1
Robert Varga [Mon, 3 Feb 2020 11:05:28 +0000 (12:05 +0100)]
Remove MinElements(Effective)StatementImpl

These classes are unused after refactor, remove them.

JIRA: YANGTOOLS-652
Change-Id: Id0792ed2476ae11b138817cb1f50acd1eb6841ae
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not expand schema tree values 68/87368/3
Robert Varga [Mon, 3 Feb 2020 03:02:11 +0000 (04:02 +0100)]
Do not expand schema tree values

When we are constructing a dataTree from a schemaTree, we do not want
to operate on the ImmutableMap result, as that results in the values
view being retained. This amounts to unnecessary overhead, as we
typically do not need this view and it should be materialized only
if it is needed.

JIRA: YANGTOOLS-652
Change-Id: I3d1d689366a48822324c442da184496d9c6d873b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor min-elements statement implementations 76/87376/2
Robert Varga [Mon, 3 Feb 2020 10:27:54 +0000 (11:27 +0100)]
Refactor min-elements statement implementations

Migrate MinElements(Effective)Statement to improve their memory
footprint.

JIRA: YANGTOOLS-652
Change-Id: Iddf0d2d61d304eadefbf4433d4bd8f731aa4cefa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor organization statement implementations 75/87375/2
Robert Varga [Mon, 3 Feb 2020 09:58:29 +0000 (10:58 +0100)]
Refactor organization statement implementations

Migrate Organization(Effective)Statement to improve their memory
footprint.

JIRA: YANGTOOLS-652
Change-Id: If677ade7943fa9dd1b2cc5b9ee216049a9c04145
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor import statement implementations 73/87373/2
Robert Varga [Mon, 3 Feb 2020 09:41:56 +0000 (10:41 +0100)]
Refactor import statement implementations

Migrate Import(Effective)Statement to improve their memory footprint.

JIRA: YANGTOOLS-652
Change-Id: If469e5233783a5d3b011e7d86b8c88db885c54e9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not inline anything but schema tree nodes/extensions 62/87362/2
Robert Varga [Sun, 2 Feb 2020 19:24:18 +0000 (20:24 +0100)]
Do not inline anything but schema tree nodes/extensions

As per RFC7950, we should not be inlining anything but schema tree
nodes. Extensions are still included to keep compatibility with
tailf:action.

JIRA: YANGTOOLS-403
JIRA: YANGTOOLS-1078
Change-Id: Ice2b02839dc665af2b9ed9e02dfa8c17900406b0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove copy operation execution 56/87356/4
Robert Varga [Sun, 2 Feb 2020 08:55:20 +0000 (09:55 +0100)]
Move copy operation execution

Statements should be reporting the requirements of their effective
statement implementations, such that reactor can efficiently shuffle
StatementContextBase implementations to reflect StmtContext view
of the world.

JIRA: YANGTOOLS-694
Change-Id: Ida8eff88276be523766999f4f3528afbc2a38d59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove StmtContext.setCompletedPhase() 58/87358/3
Robert Varga [Sun, 2 Feb 2020 11:03:34 +0000 (12:03 +0100)]
Remove StmtContext.setCompletedPhase()

This closely tied to reactor lifecycle and should never be modified
externally. Hide it.

Change-Id: I24014b2cbcecc341080e5a1a14e203f0a4d72ed0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove grouping copy policy to UsesStatementSupport 55/87355/2
Robert Varga [Sun, 2 Feb 2020 08:17:04 +0000 (09:17 +0100)]
Move grouping copy policy to UsesStatementSupport

Exclusion of documentation nodes is a pure 'uses' statement mechanics
against a 'grouping' statement. Restore 'uses' behavior from before
541fde521d0b4e01e1023be8612d0fcff81a67bc, but retain reactor deferral
to substatements -- which means when we copy a grouping itself, its
documentation is correctly retained.

Change-Id: Ic58ce5f94181fe26f47ea470877911e6c0452c1c
JIRA: YANGTOOLS-694
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoHide statement implementations 47/87347/2
Robert Varga [Sat, 1 Feb 2020 15:22:18 +0000 (16:22 +0100)]
Hide statement implementations

Implementations should never leak their package, hide them
and adjust tests.

Change-Id: I61120df2908e16c190ac37f833cb37ec06b056cc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unused statement implementations 29/87329/3
Robert Varga [Fri, 31 Jan 2020 16:08:42 +0000 (17:08 +0100)]
Remove unused statement implementations

These classes have been rendered unused, remove them.

JIRA: YANGTOOLS-1065
Change-Id: I17450e1b3cc594051f293479f9754df309e6144c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor namespace implementation classes 27/87327/1
Robert Varga [Fri, 31 Jan 2020 15:52:15 +0000 (16:52 +0100)]
Refactor namespace implementation classes

Refactor our implementation classes, so that we lower their footprint.
Since we are in the area, also update argument parser so that it reports
illegal names through SourceException.

Change-Id: I88c154cac3b6397434356304ba5af09aee984246
JIRA: YANGTOOLS-1065
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor fraction-digits implementation classes 25/87325/1
Robert Varga [Fri, 31 Jan 2020 13:20:15 +0000 (14:20 +0100)]
Refactor fraction-digits implementation classes

Refactor our implementation classes, so that we end up sharing
declared/effective instances as much as possible.

JIRA: YANGTOOLS-1065
Change-Id: I2bdf8d30f9d2fd734a536001906b1f6f0af09f41
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDefer copy decisions to StatementSupport 44/87144/31
Robert Varga [Sun, 26 Jan 2020 00:22:11 +0000 (01:22 +0100)]
Defer copy decisions to StatementSupport

Core reactor should have no knowledge of specific statements, but
rather should provide general facilities for statements to decide
what they need to do. A typical example of this are
description/reference/status statements, which are never inlined
from a grouping parent (as they relate to the grouping, not the
copy target).

Add StatementSupport.copyAsChildOf() and implement above case
in terms of the new method.

Furthermore move support code to UsesStatementSupport and make it
use the same mechanics -- eliminating NOCOPY_FROM_GROUPING_SET
in the process of doing so.

JIRA: YANGTOOLS-694
Change-Id: I446266249dfe3f1bcac310bd16aece5185b40fb6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPopulate SubmoduleEffectiveModule with import namespaces 65/82165/14
Robert Varga [Sun, 19 May 2019 19:39:47 +0000 (21:39 +0200)]
Populate SubmoduleEffectiveModule with import namespaces

In case we are exporting a submodule, we need to find matching
imports -- just as they are constructed for ModuleEffectiveStatement.

This is then used in YangTextSnippet with appropriate resolver,
adding an explicit test.

JIRA: YANGTOOLS-992
Change-Id: Ie86cd8ff50f598fe1868f576f9f7e5a8ab2e5c5d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMark AbstractListStatementSupport methods final 12/87312/1
Robert Varga [Fri, 31 Jan 2020 10:25:53 +0000 (11:25 +0100)]
Mark AbstractListStatementSupport methods final

These mathods are intended to be final, mark them as such.

Change-Id: I69f1b217a3cde0db658234643649bfef1d5672f9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoConvert yang-version statement support 02/87302/1
Robert Varga [Thu, 30 Jan 2020 14:42:35 +0000 (15:42 +0100)]
Convert yang-version statement support

yang-version statements are few and far between, but that is not
a reason to be wasteful. This reworks declared and effective
implementations to lower their footprint as well as share only
a few instances typically.

JIRA: YANGTOOLS-1065
Change-Id: Ia5485b3dff972fc41721a3ec72be9b7f2ea67088
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove ReferenceStatementImpl 01/87301/1
Robert Varga [Thu, 30 Jan 2020 14:24:20 +0000 (15:24 +0100)]
Remove ReferenceStatementImpl

This implementation is no longer used, remove it.

JIRA: YANGTOOLS-1065
Change-Id: I7914bfe8cbe742cbf15c445117039e8ff44f0bc3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate QName-based declared statements 65/87265/2
Robert Varga [Wed, 29 Jan 2020 12:24:58 +0000 (13:24 +0100)]
Migrate QName-based declared statements

container/leaf-list/list/leaf statements have had their effective
statements migrated, now extend that refactor to cover their
declared statements, too.

This has a side-effect of making substatement order accurately
reflect original declaration order -- thus requiring a mild update
to yang-model-export test expectations.

JIRA: YANGTOOLS-1065
Change-Id: I10d0f7254dcf9af3412cc4abeeba9dfb758b44ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not use singleton ImmutableMap for datatree/schematree 33/87233/1
Robert Varga [Wed, 29 Jan 2020 00:39:50 +0000 (01:39 +0100)]
Do not use singleton ImmutableMap for datatree/schematree

As it turns out singleton ImmutableMap has a few kinks, one of which
is allocating its inverse when asked for values. This is consting us
48 bytes more than with Collections.singletonMap(), hence let's
special case to bring our footprint down.

JIRA: YANGTOOLS-652
Change-Id: I7ac170c02609a15b3ec77a91e5075ec62f814232
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove KeyStatement implementations 32/87232/1
Robert Varga [Tue, 28 Jan 2020 23:57:58 +0000 (00:57 +0100)]
Improve KeyStatement implementations

KeyStatement is holding on to singleton collections, where it can
easily squash them, just as it does with substatements.

JIRA: YANGTOOLS-652
Change-Id: I9141da24244d91a8e785ee9cf1131fecbb07d329
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd default statementDefinition() methods 29/87229/2
Robert Varga [Tue, 28 Jan 2020 20:49:42 +0000 (21:49 +0100)]
Add default statementDefinition() methods

Ever since Java 8 we can implement methods as default, which is
a perfect fit for our representation classes. Make sure all migrated
statements provide this method, making our life easier on the class
design side -- as we do not need to capture/copy those statements.

Also remove AbstractBooleanDeclaredStatement, as it serves no real
purpose except to split our class hierarchy.

JIRA: YANGTOOLS-1065
Change-Id: I707bf842964748f98b5062d65cffc1e8b8fb421d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove AbstractIntegerDeclaredStatement 28/87228/1
Robert Varga [Tue, 28 Jan 2020 20:36:45 +0000 (21:36 +0100)]
Remove AbstractIntegerDeclaredStatement

This class does not bring anything to the table and was merged
accidentally. Remove it again.

JIRA: YANGTOOLS-1065
Change-Id: Ifa19296093ae187c76a07e08bf6f05dcc5f62e53
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove QNameCacheNamespace 24/87224/1
Robert Varga [Tue, 28 Jan 2020 18:51:02 +0000 (19:51 +0100)]
Remove QNameCacheNamespace

QNames (and QNameModules) are providing proper interning facilities,
hence there is no point for parser to do the same. This actually
improves performance a bit, as the parser way of doing things requires
a bit of indirection to get to the appropriate namespace storage node.

JIRA: YANGTOOLS-652
Change-Id: I25f6ea5a78364a9f24fa6149ab69e9b2b1370960
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix StmtContext.get{Original,PreviousCopy}Ctx() return type 23/87223/2
Robert Varga [Tue, 28 Jan 2020 18:35:40 +0000 (19:35 +0100)]
Fix StmtContext.get{Original,PreviousCopy}Ctx() return type

The context of the previous copy is has actually the same generic
types as the StmtContext itself. Improve the definition, so that
callers can benefit from that additional type safety.

Change-Id: Idbdbb77c7b57221a60094c8ec1a3cf6967a6196c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove declaredInstance out of StatementContextBase 22/87222/1
Robert Varga [Tue, 28 Jan 2020 18:27:17 +0000 (19:27 +0100)]
Move declaredInstance out of StatementContextBase

This caching field is useful, except it is clear that only the
original instance really needs it, as InferredStatementContext
will just walk through prototype to acquire it from there.

Move the field into AbstractResumedStatement, i.e.
originally-declared statements, taking buildDeclared() method
implementation there.

This reduces the size of StatementContextBase by one reference
field, which helps InferredStatementContext, as it can now hold
pointer to the original context without increasing object size.

Having the original context allows us to more efficiently shortcut
to the original definition -- which is useful for other methods
as well.

JIRA: YANGTOOLS-784
Change-Id: Ib8767a892b8c8aaa0e3f7da10ac794167269fff6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake declared statement inheritance a StatementContextBase property 79/87179/13
Robert Varga [Mon, 27 Jan 2020 20:16:55 +0000 (21:16 +0100)]
Make declared statement inheritance a StatementContextBase property

We have inconsistencies between handling of inference-time and build-time
declared statements. When a declared statement is created in reactor,
its declared view will be materialized at the statement itself, not
in the original context.

This means statements which are subject to (even unused!) inference
will create a disconnected declared view. Statements which are not
infered, will correctly reuse declared instances with their origin.

Fix this by making following of getOriginalCtx() an implementation
given in StatementContextBase, resulting in centralized code and
consistent results.

JIRA: YANGTOOLS-652
Change-Id: Id8afb814821398e416afbfc6c9e3aeeb789f94a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix AbstractResumedStatement reparent 98/87198/1
Robert Varga [Tue, 28 Jan 2020 17:34:29 +0000 (18:34 +0100)]
Fix AbstractResumedStatement reparent

When we are reparenting AbstractResumedStatement we need to make
sure the state is copied correctly. This shows that it cannot
be semantically copied, hence it does not make sense to track
previous/original context.

JIRA: YANGTOOLS-784
Change-Id: Iea3c8117e26bfaf710fcf48aad3f9202f054c036
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake asserts buildDeclared() more lenient 97/87197/1
Robert Varga [Tue, 28 Jan 2020 15:54:24 +0000 (16:54 +0100)]
Make asserts buildDeclared() more lenient

Declared instance is guarded by completed phase, hence if it is
filled with a value we have completed specified phase (at some point).

This results in fewer memory accesses in case the declared statement
is accessed again.

JIRA: YANGTOOLS-652
Change-Id: Iac21fb6e74268770d91e4b9eefc120b892fd0753
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSwitch position statement to use Uint32 91/87191/8
Robert Varga [Tue, 28 Jan 2020 01:08:18 +0000 (02:08 +0100)]
Switch position statement to use Uint32

Position is restricted to 32bit unsigned, there is just no point
to say it is a Long.

JIRA: YANGTOOLS-1065
Change-Id: I3922e90feddab0b8da7bb3fdb42cc8d46953c5de
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize Status statement declarations 88/87188/11
Robert Varga [Mon, 27 Jan 2020 23:40:42 +0000 (00:40 +0100)]
Optimize Status statement declarations

As Status has low cardinality we can quite easily improve things
by sharing common instances.

JIRA: YANGTOOLS-1065
Change-Id: Ie404a65bc4a43b0d51e72f011a2aa7a5980c30df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize {Position,Value}StatementSupport 90/87190/6
Robert Varga [Tue, 28 Jan 2020 00:10:47 +0000 (01:10 +0100)]
Optimize {Position,Value}StatementSupport

These statements can be interned and are mostly independent, add
baseline implementations which intern empty statements on JVM level.

JIRA: YANGTOOLS-1065
Change-Id: I1fafda7403d743ffa6c5279bd149c161ad78ed33
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd AbstractBooleanDeclaredStatement/BaseBooleanStatementSupport 87/87187/3
Robert Varga [Mon, 27 Jan 2020 21:11:17 +0000 (22:11 +0100)]
Add AbstractBooleanDeclaredStatement/BaseBooleanStatementSupport

mandatory/config/require-instance/yin-element statements share the
same shape of being stateless boolean holders. Add an explicit
base class, making sure all common declarations end up referencing
the same 4 objects.

JIRA: YANGTOOLS-1065
Change-Id: I0c423ad1fc34c2a4c55c92d246830880a4c8bf9b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFurther optimize OrderedBy effective statement dispatch 80/87180/2
Robert Varga [Mon, 27 Jan 2020 20:26:14 +0000 (21:26 +0100)]
Further optimize OrderedBy effective statement dispatch

Comparing both argument and declared instance is not necessary.
We are using identity comparison, so just do that.

Change-Id: I6e28b9013ae2d056907b52f87cd2813bbcdd23c9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDrop StmtContextUtils. qualifier 78/87178/2
Robert Varga [Mon, 27 Jan 2020 19:42:45 +0000 (20:42 +0100)]
Drop StmtContextUtils. qualifier

This is a distraction -- all these methods are local.

Change-Id: I8328ebf18b620141d95b227d885d4dd14282f11d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup NamespaceStorageSupport/StmtContext API conflict 77/87177/1
Robert Varga [Mon, 27 Jan 2020 17:58:58 +0000 (18:58 +0100)]
Cleanup NamespaceStorageSupport/StmtContext API conflict

StmtContext has a few methods that are logically implemented by
NamespaceStorageSupport. Since NamespaceStorageSupport does not
implements StmtContext (nor should it), these methods happen to
work as they overlap with StmtContextBase's mixin -- and they
cannot be simply found by looking for implementations.

Resolve the naming conflict in the most logical way, thus improving
quality of life for everyone :)

Change-Id: I0186a94699c5945b7140bf57ba9e5900e49019d4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse ImmutableMap for single namespaces 61/87161/3
Robert Varga [Mon, 27 Jan 2020 11:31:15 +0000 (12:31 +0100)]
Use ImmutableMap for single namespaces

It is extremely common for statement contexts to have exactly one
namespace (i.e. ChildSchemaNodeNamespace). Tracking that in a HashMap
is not very memory-efficient (nor performance-efficient), as we will
end up allocating all the HashMap internals.

Separate out the single-namespace case and use an ImmutableMap singleton
to hold the namespace -- which saves ~65MiB in a reference test case
accounding for ~6% of scratch memory used (~3% total used).

JIRA: YANGTOOLS-652
Change-Id: Ie2b1faeb4c966c20be0818d3b54aa7c8367f0c58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoReuse OrderedByEffectiveStatement instances 50/87150/2
Robert Varga [Sun, 26 Jan 2020 19:18:37 +0000 (20:18 +0100)]
Reuse OrderedByEffectiveStatement instances

This is a low-cardinality statement for which we are already reusing
declared instances. This extends that support to cover effective
instances based on the shared declared instances.

Also ditch the use of EnumMap -- while it works, we only have two
values, which is easily taken care of by a switch statement.

JIRA: YANGTOOLS-1065
Change-Id: I43f135c9dec443b1b46b5517fa98f2c08af3d877
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoIntroduce AbstractModelStatement 49/87149/2
Robert Varga [Sun, 26 Jan 2020 18:08:32 +0000 (19:08 +0100)]
Introduce AbstractModelStatement

Since we now have abstract classes for both declared and effective
worlds, it is useful tie the implementations together, so that it
both share vtable where ModelStatement methods are concerned.

Also unify substatement list handling between the two implementations,
sharing the utility methods to do so.

JIRA: YANGTOOLS-1065
Change-Id: I52849b2afa6a20478a980ba0992dbcc338941dd9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd default effectiveSubstatements() implementation 48/87148/1
Robert Varga [Sun, 26 Jan 2020 17:32:13 +0000 (18:32 +0100)]
Add default effectiveSubstatements() implementation

AbstractEffectiveStatement subclasses can benefit from a common
implementation, reducing code duplication. This organization
mirrors the layout of AbstractDeclaredStatement.

JIRA: YANGTOOLS-1065
Change-Id: I869958ad8a154df0d6f66c91108631ef54aad2b8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize simple declared statements 47/87147/3
Robert Varga [Sun, 26 Jan 2020 13:05:42 +0000 (14:05 +0100)]
Optimize simple declared statements

Our declared statements weigh in at 32/56 bytes each, which is
a bit wasteful for what they are doing -- and it all boils down to
class hierarchy.

Introduce AbstractDeclaredStatement, which provides structural
base to implement them with minimal footprint. Initial conversion
includes simple statements, which can be implemented in 16/24 bytes.

OrderedBy statement also takes advantage of low cardinality of its
argument to further eliminate footprint in regular YANG use.

JIRA: YANGTOOLS-1065
Change-Id: I6ea57a7260d3e33108c6c77c1ce120937181796f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd InferredStatementContext 13/87113/21
Robert Varga [Sat, 25 Jan 2020 13:24:53 +0000 (14:24 +0100)]
Add InferredStatementContext

SubstatementContext implies definition in source, which adds state
which is not necessary. Introduce a separate class to hold statement
contexts which are created during inference.

In order to prevent code duplication, StmtContext methods whose
implementation is relevant only in RootStatementContext are refactored
to dispatch to specialized implementations, making them final in
the process. This also happens to improve inference speed, as lookups
like getBehaviourRegistry() used to iterate over parent axis to root,
now they are taking a direct shortcut to root (which may be 'this').

Since InferredStatementContext derives a number of methods from
its prototype (such as raw argument, etc.), these details are taken
out of StatementContextBase and moved to AbstractResumedStatement.

InferredStatementContext is about 10% smaller than an equivalent
SubstatementContext, leading to smaller inference memory footprint.

JIRA: YANGTOOLS-784
Change-Id: I62eea1dc92756536444676e8765fedd73375933e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExtract AbstractResumedStatement 40/87140/6
Robert Varga [Sat, 25 Jan 2020 11:43:44 +0000 (12:43 +0100)]
Extract AbstractResumedStatement

Separate out data structures related to statement source traversal
into a dedicated class.

This lowers the footprint required to implement StatementContextBase,
as well as lowering clutter around which functionality is related
to which part.

JIRA: YANGTOOLS-652
Change-Id: I811c6fcf3bfba83421609af13dfed8fe445184b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpand reactor documentation a bit 39/87139/5
Robert Varga [Sat, 25 Jan 2020 11:33:22 +0000 (12:33 +0100)]
Expand reactor documentation a bit

The reactor can use every sliver of documentation it can get, provide
at least a few words.

Change-Id: I2ccfa558f2ba4bfa63505308f6e4131e8634ab4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize isConfiguration()/isIgnoringConfig() interplay 38/87138/2
Robert Varga [Sat, 25 Jan 2020 10:29:21 +0000 (11:29 +0100)]
Optimize isConfiguration()/isIgnoringConfig() interplay

Now that we have coalesced these two states into a flag field,
their interplay is more apparent -- isIgnoringConfig() is always
checked before isConfiguration() and if it is set, it also implies
isConfiguration() is also set.

Using flags allows us to express this implication by simply setting
the right bits. This results in fewer flag operations performed and
a more direct dispatch between methods.

isConfiguration() is also improved to access parent.isConfiguration()
only when necessary, improving performance when a config substatement
is present.

JIRA: YANGTOOLS-652
Change-Id: Ifb18ee16e33e93de4300cc80e4ba67a9ae40bbde
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize SubstatementContext size 30/87130/6
Robert Varga [Fri, 24 Jan 2020 14:11:01 +0000 (15:11 +0100)]
Optimize SubstatementContext size

Class layout of SubstatementContext contains a set of flags in
StatementContextBase and SubstatementContext, both of which end up
being padded -- wasting 2-10 bytes in the padding alone.

Moving configuration/ignoreConfig/ignoreIfFeature to
StatementContextBase and allocating them as individual bits allows
us to eliminate internal losses in most cases, resulting in net
savings of 8 bytes per instance in the common case (64bit VM), i.e.
4.5-8.3%.

JIRA: YANGTOOLS-652
Change-Id: Ic63f75e9e8c1c25445bc7904c08a5691d1470b67
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove removeStatementsFromEffectiveSubstatements() 31/87131/2
Robert Varga [Fri, 24 Jan 2020 14:21:44 +0000 (15:21 +0100)]
Remove removeStatementsFromEffectiveSubstatements()

This StatementContextBase method has been deprecated and is unused,
remove it.

Change-Id: I71345b881b0ad04b46d134ebd8e3a2d63fdd2de5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate StmtContext javadoc 26/87126/1
Robert Varga [Fri, 24 Jan 2020 08:55:40 +0000 (09:55 +0100)]
Migrate StmtContext javadoc

Move documentation blocks from StatementContextBase to method
definitions in StmtContext.

Change-Id: I569ae4a99ef0e90b72dcb341ccbf30cf010e76a5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake StatementContextBase.childCopyOf() final 12/87112/2
Robert Varga [Thu, 23 Jan 2020 16:52:13 +0000 (17:52 +0100)]
Make StatementContextBase.childCopyOf() final

We have a single implementation, let's make sure it stays that
way before we move to implementation.

Change-Id: I3d461ffef37289dc01fb2f13bd88617d73327eb9
JIRA: YANGTOOLS-784
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove usage of ExpectedException 11/87111/2
Robert Varga [Thu, 23 Jan 2020 16:50:22 +0000 (17:50 +0100)]
Remove usage of ExpectedException

New JUnit provides an explicit assertThrows(), which supersedes
the old ExpectedException pattern. Migrate our tests to the new way
of doing things.

Change-Id: Idac4862fc8e20e4a27b2ac766c4d1770208195a8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove common code 10/87110/2
Robert Varga [Thu, 23 Jan 2020 16:36:18 +0000 (17:36 +0100)]
Move common code

We have a single line which is duplicated, move it to common code.

Change-Id: I738168386ea0efb7c7bab11e23aa219e076b564b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove childCopyOf() generic arguments 09/87109/2
Robert Varga [Thu, 23 Jan 2020 15:28:46 +0000 (16:28 +0100)]
Remove childCopyOf() generic arguments

The need for generics would come from the sole implementation,
which can deal with type safety issue separately -- simplifying
the common definition.

Change-Id: I7680bb00b74cd456b10fc28c6f96820b503fee99
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTurn util into a JPMS module 21/83921/16
Robert Varga [Thu, 22 Aug 2019 18:23:17 +0000 (20:23 +0200)]
Turn util into a JPMS module

This creates an explicit module-info.java, making the policy explicit.

Change-Id: I07d0d8d31e1f0673dd338cb97901e976127cd190
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove LoggingThreadUncaughtExceptionHandler 07/87107/1
Robert Varga [Thu, 23 Jan 2020 13:00:12 +0000 (14:00 +0100)]
Remove LoggingThreadUncaughtExceptionHandler

This class is not used anywhere, remove it.

Change-Id: Ifff05b73490226ef29d191fa46859dd324b03c3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate Queue stats collection 06/87106/1
Robert Varga [Thu, 23 Jan 2020 12:56:03 +0000 (13:56 +0100)]
Migrate Queue stats collection

The statistics used to be a public contract, now we expose it
through package-protected streamTasks().

Change-Id: Ie8afc8b0cb97ead00450b57bac500e4010300125
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse CompletableFuture.failedFuture() in CheckedValue 03/87103/1
Robert Varga [Thu, 23 Jan 2020 12:53:01 +0000 (13:53 +0100)]
Use CompletableFuture.failedFuture() in CheckedValue

Java 9 improves usability here, allowing us to trim some code.

Change-Id: I7b723b86bd8ab18ecf4bb81caa41cbe0642c4056
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate concepts tests to use assertThrows() 02/87102/1
Robert Varga [Thu, 23 Jan 2020 12:46:39 +0000 (13:46 +0100)]
Migrate concepts tests to use assertThrows()

Rather than using Test(expected=) use a dedicated test, which
pinpoints exactly which call should throw the exception.

Change-Id: I7ff2af221e3260b04ce9a31b7562f6e516af5fdc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove hashCode()/equals() from SchemaNode implementations 78/87078/8
Robert Varga [Wed, 22 Jan 2020 12:11:22 +0000 (13:11 +0100)]
Remove hashCode()/equals() from SchemaNode implementations

Most SchemaNode comparisons end up operating on a statement's
SchemaPath, pretending they are equal based on path.

This is not accurate when comparing nodes between SchemaContexts,
as their definition can vary wildly and they cannot be considered
'equal'.

Inter-SchemaContext comparison is all about compatibility and as such
cannot be in terms of equals() contract -- such a compatibility check
is both irreflexive and asymmetric unless the two nodes are completely
compatible.

With the above out of the picture, the definition of comparison
really boils down to a glorified identity check, as SchemaPath is
supposed to be unique for a node.

This patch removes most hashCode()/equals() methods, defaulting to
identity. Notable leftovers are Mandatory/Config statements and
TypeDefinitions (which are DocumentedNodes, but the point is pretty
much the same).

JIRA: YANGTOOLS-761
Change-Id: I8162b2b121f611bc128fbbcea3cef7921f25eb72
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAbstractEffectiveModule should retain statement order 85/87085/3
Robert Varga [Wed, 22 Jan 2020 16:14:26 +0000 (17:14 +0100)]
AbstractEffectiveModule should retain statement order

AbstractEffectiveModule is using HashSet for its temporary storage,
which makes statement order dependent on hashCode() rather than
declaration order.

Make sure we use LinkedHashSet, thus not losing the order.

Change-Id: Ie46c28c051f861c1aabc34f7aa5e4293f7d38cea
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd OrderedByStatement.Ordering 99/86599/7
Robert Varga [Sat, 28 Dec 2019 10:22:28 +0000 (11:22 +0100)]
Add OrderedByStatement.Ordering

This adds a utility enum to express parsed argument value, allowing
us to remove some string duplication.

JIRA: YANGTOOLS-1058
Change-Id: I147f51fbeb9140d6cd43a80d205218a73d827a21
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMigrate assertThat() import 80/87080/3
Robert Varga [Wed, 22 Jan 2020 13:36:50 +0000 (14:36 +0100)]
Migrate assertThat() import

Assert.assertThat() is deprecated, use its replacement method.

Change-Id: Ifa05d39a24e661854f84535afc4cbbdbe0ad90b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDo not tolerate duplicate identities 79/87079/1
Robert Varga [Wed, 22 Jan 2020 13:25:15 +0000 (14:25 +0100)]
Do not tolerate duplicate identities

We have a unit test asserting identity definition squashing -- which
really is papering over the parser accepting the identities.

As per RFC7950, identity declarations must be unique, and we should
report them through normal SourceException.

JIRA: YANGTOOLS-1075
Change-Id: I98ce8615bcdb502cb79caa23fc9c3a127f850ea9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate non-lazy leaf tracking 69/87069/1
Robert Varga [Tue, 21 Jan 2020 15:54:05 +0000 (16:54 +0100)]
Deprecate non-lazy leaf tracking

org.opendaylight.yangtools.yang.data.impl.schema.nodes.lazy-leaves
property allows to select non-default behavior of retaining Leaf
node instances in their parent containers.

This behavior is going away, make sure we warn users about this
change.

Change-Id: Ia99bd315edd101838e55bc11ce6d8781fd46ac52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd nullness annotations 39/87039/1
Robert Varga [Sun, 19 Jan 2020 11:08:23 +0000 (12:08 +0100)]
Add nullness annotations

Not promising proper nullness leads to warnings downstream, do the
right thing and say when we promise non-nulls.

Change-Id: Ib34d57b45905d6164456ef0605ce6cca65f9de4f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRefactor yang-model-api child traversal return types 77/86877/21
Robert Varga [Tue, 14 Jan 2020 11:35:51 +0000 (12:35 +0100)]
Refactor yang-model-api child traversal return types

Rather than using List<X>/Set<X> we use Collection<? extends X>.
We really want to say 'iterable', but Collection is close enough
and it's slightly more useful.

This allows us to use more efficient facades when coming from
EffectiveStatement world, i.e. filters can use Collections2.filter()
to evaluate substatements lazily.

We also codify proper covariance, which strenghtens the read-only
nature of the returned type.

JIRA: YANGTOOLS-1068
Change-Id: I80be306916dff0575fb4b6824951827e540e482e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent to 6.0.4 69/86969/2
Robert Varga [Thu, 16 Jan 2020 11:23:47 +0000 (12:23 +0100)]
Bump odlparent to 6.0.4

This adopts odlparent-6.0.4, along with the fix to SFT.

Change-Id: I782fa42ff906314dbe1e030cf806d6fb536fffb6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove resetAugmenting() methods 97/86597/2
Robert Varga [Sat, 28 Dec 2019 10:00:36 +0000 (11:00 +0100)]
Remove resetAugmenting() methods

These have been deprecated for some time and have no effect
whatsoever. Remove them.

Change-Id: Idca888e4a9de0fa2efda654f0f503b896a2d563c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImprove AbstractPathArgument.hashCodeImpl() 46/82346/7
Robert Varga [Thu, 30 May 2019 22:23:04 +0000 (00:23 +0200)]
Improve AbstractPathArgument.hashCodeImpl()

Current computation of hashCode() introduces needless computation,
just for the sake of the computation.

This patch changes the hashCode() algorithm and removes increment:

    QName.hashCode() + 31

which has no real value to how hashCodeImpl() operates. While
we're in the area, we propagate useless invariants.

Change-Id: Ib18518013774673603268ad747883d67b5d2bbf3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 5.0.0-SNAPSHOT 21/86921/1
Robert Varga [Wed, 15 Jan 2020 11:07:12 +0000 (12:07 +0100)]
Bump versions to 5.0.0-SNAPSHOT

This starts the next major release.

Change-Id: I5373319b383d06b13b627ad918aa6a99b13dcb2e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 4.0.6-SNAPSHOT 15/86915/1
Robert Varga [Wed, 15 Jan 2020 00:11:24 +0000 (01:11 +0100)]
Bump versions to 4.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I92005a8389ba8e42a5d96617c7a928164204c00e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCheck if we are operating in a grouping before issuing a warning 97/86897/2
Robert Varga [Tue, 14 Jan 2020 16:30:09 +0000 (17:30 +0100)]
Check if we are operating in a grouping before issuing a warning

If we are examining a list in a grouping, we should not be issuing
a warning, as we do not know where that grouping is going to be
instantiated.

Once we determine that a warning may be appropriate, walk statement
contexts upwards, searching for a grouping -- if we find one, just
bail out without any warning.

JIRA: YANGTOOLS-957
Change-Id: If54b05cc444f19f56c6f8b4f931d85b0b270b4ac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate DataNodeIterator 79/86879/1
Robert Varga [Tue, 14 Jan 2020 14:56:18 +0000 (15:56 +0100)]
Deprecate DataNodeIterator

This class is used in two places only, where each of the places
only needs specific type of nodes. Expose utility methods for
those two cases and a general tranverser method from SchemaNodeUtils
and deprecate DataNodeIterator.

Change-Id: I4fdc47e16fe2ea7e6f042bb80fe869657ee93fac
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize DataNodeIterator.hasNext() 78/86878/1
Robert Varga [Tue, 14 Jan 2020 14:18:42 +0000 (15:18 +0100)]
Optimize DataNodeIterator.hasNext()

This does not quite make sense, but can be optimized to only quickly
look at the collection.

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