mdsal.git
4 years agoCleanup AbstractTypeProvider.isLeafRefSelfReference() 28/86628/1
Robert Varga [Mon, 30 Dec 2019 12:45:01 +0000 (13:45 +0100)]
Cleanup AbstractTypeProvider.isLeafRefSelfReference()

This method's logic eagerly strips the xpath, even when we may
end up not needing it. Refactor implementation to initialize
later (and bail quicker).

Change-Id: I7a54d14dcc3def1cc01f65523c5cf6e1277a0fce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRevert "Revert "Do not emit empty lists to NormalizedNodes"" 02/86502/7
Robert Varga [Thu, 19 Dec 2019 12:40:10 +0000 (13:40 +0100)]
Revert "Revert "Do not emit empty lists to NormalizedNodes""

This reverts commit 73b85db4f60f2fb003af6cfdffaaef51b2ac2df2,
reinstating the changes done in cbe6a8cafaec862f2a918ecc9af99720090d3c8a
as part of MDSAL-456.

JIRA: MDSAL-450
Change-Id: Ib9ee71194ab06eb873b9257b4e7eed450162f816
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDTOs for anydata/anyxml are not generated within a list 69/86569/7
wusandi [Wed, 25 Dec 2019 12:04:16 +0000 (20:04 +0800)]
DTOs for anydata/anyxml are not generated within a list

Code generation for container and list statements follows different
code paths and we have missed a hook in the latter to generate
opaque objects.

JIRA: MDSAL-506
Change-Id: I25a54362ceb09937ffe796081660afe7fa1d6bb2
Signed-off-by: wusandi <wusandi@163.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump yangtools to 4.0.4 51/86551/3
Robert Varga [Mon, 23 Dec 2019 17:00:18 +0000 (18:00 +0100)]
Bump yangtools to 4.0.4

This picks up the latest version, adjusting for API changes made
therein.

Change-Id: I0eba45f69ebdbe44d2688a800c1006df5898180a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpeed up AbstractBuilderTemplate.removeProperty() 08/86508/2
Robert Varga [Thu, 19 Dec 2019 14:51:20 +0000 (15:51 +0100)]
Speed up AbstractBuilderTemplate.removeProperty()

Rather than performing a linear unbounded search followed by a
conditional remove, use an interator and remove the first matching
property, bailing out.

Change-Id: Ia5de2175628c9730d7c76df58e15540f3cbb4fa3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpeed up check for list 07/86507/2
Robert Varga [Thu, 19 Dec 2019 14:42:41 +0000 (15:42 +0100)]
Speed up check for list

This speeds up the check for list by first checking if key is not
null and searching for interface afterwards.

Change-Id: Id35da9d5dfc76f243fd7c800115c26a2d181558b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPropagate EffectiveModelContext for codegen plugins 46/86546/2
Robert Varga [Sun, 22 Dec 2019 13:07:51 +0000 (14:07 +0100)]
Propagate EffectiveModelContext for codegen plugins

yang-maven-plugin infra is giving us EffectiveModelContext, which
allows us to eventually switch code generation to work on
EffectiveStatements rather than on SchemaNodes. This propagates
EffectiveModelContext closer to actual users.

Change-Id: I90dd2aa983e05748c0ac838731580adbe5055003
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup model naming 43/86543/1
Robert Varga [Sun, 22 Dec 2019 09:04:22 +0000 (10:04 +0100)]
Cleanup model naming

This is small cleanup to ensure we have consistent model naming.

JIRA: MDSAL-500
Change-Id: I39a65e9bec0778ecc9f5880cd9ef0d50a818c50e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse BindingTypes.identifiable() 03/86503/1
Robert Varga [Thu, 19 Dec 2019 12:51:04 +0000 (13:51 +0100)]
Use BindingTypes.identifiable()

Instead of looking up Identifiable type each time we use it, use
the convenience method exposed through BindingTypes, improving
efficiency a bit.

Change-Id: Ib8e7bf0385a51ee687484a2667905e284a90ab3a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove deprecated Types methods 76/86476/2
Robert Varga [Wed, 18 Dec 2019 10:25:02 +0000 (11:25 +0100)]
Remove deprecated Types methods

Types methods dealing with binding concepts have been migrated
to BindingTypes, remove their residence.

Change-Id: Idb1710ba888dd40f630389028702c209904d443a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd BindingTypes.augmentation() 75/86475/1
Robert Varga [Wed, 18 Dec 2019 10:23:33 +0000 (11:23 +0100)]
Add BindingTypes.augmentation()

This migrates Types.augmentationTypeFor() into BindingTypes, so we
have proper separation.

Change-Id: I6ff923be4b598714761ed60ca6a36037295b9ac5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd BindingTypes.QNAME 68/86468/1
Robert Varga [Wed, 18 Dec 2019 08:52:20 +0000 (09:52 +0100)]
Add BindingTypes.QNAME

We are looking this type for each constant, which is not entirely
efficient. Add a constant to BindingTypes and use it directly, providing
a slight performance benefit.

Change-Id: I56c33750b085728a80782da93e9ea4a250b988aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDeprecate Types.augmentableTypeFor() 67/86467/1
Robert Varga [Wed, 18 Dec 2019 08:48:31 +0000 (09:48 +0100)]
Deprecate Types.augmentableTypeFor()

This method has a mirror in BindingTypes, which is a more appropriate
place for the definition. Deprecate the method for removal and
redirect it to BindingTypes.augmentation().

Change-Id: I462a2fe25f0b53cca0619c72aac7a1e602718143
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix RPC method name conflict with JLS 34/86434/6
miroslav.kovac [Mon, 16 Dec 2019 16:28:41 +0000 (17:28 +0100)]
Fix RPC method name conflict with JLS

When we are constructing the method name for use with the RPC
provider interface we need to pay attention to conflicts with
JLS reserved words.

If such a conflict occurs, append a single '$' to the name, so
that we have a valid method name.

JIRA: MDSAL-500
Change-Id: Ifb533e2daa71bc9d1780a5d8eb48da6ce3b2d209
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMap system-ordered keyed lists to Map 27/85827/21
Robert Varga [Mon, 18 Nov 2019 11:30:08 +0000 (12:30 +0100)]
Map system-ordered keyed lists to Map

The type mapping for YANG lists which have a key and do not have
a user-specified order should point to java.util.Map, as that
provides the correct semantics.

This patch changes that mapping, resulting in better ergonomics,
as it is now possible to acquire specific items based on their
keys.

JIRA: MDSAL-434
Change-Id: If2f8980fde1c419bbc0b7c414d7deab329362b47
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoHandle java.util.Map return type 25/85825/15
Robert Varga [Mon, 18 Nov 2019 10:48:18 +0000 (11:48 +0100)]
Handle java.util.Map return type

BindingReflections needs to be aware of the fact that return
type may be a Map, not only List. This adds the logic to take
care of that.

JIRA: MDSAL-434
Change-Id: I9e0dd170c03b7849e3d1d307ba03e6dd931663e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd CodeHelpers.nonnull(Map) 24/85824/12
Robert Varga [Mon, 18 Nov 2019 12:03:54 +0000 (13:03 +0100)]
Add CodeHelpers.nonnull(Map)

This allows to generate nonnull getters for Maps, as used by mapping.

JIRA: MDSAL-434
Change-Id: I46d59156037ee035eaba0a50ce682fdea22e3661
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove deprecated uint migration elements 33/85833/3
Robert Varga [Mon, 18 Nov 2019 14:43:07 +0000 (15:43 +0100)]
Remove deprecated uint migration elements

This removes code generated to support uint8/16/32/64 mapping
transition, so that users are forced to interface with proper types.

JIRA: MDSAL-490
Change-Id: I83c074ebe2dd9bfeea3fea1e12befb01a3fb435d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 6.0.0-SNAPSHOT 51/86451/1
Robert Varga [Tue, 17 Dec 2019 01:16:57 +0000 (02:16 +0100)]
Bump versions to 6.0.0-SNAPSHOT

This starts the next major version development. Artifacts with stable
API are realigned at 6.0.0-SNAPSHOT.

Change-Id: I529702bede7166cf611996af10ac8bcab31349b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRevert "Make sure javax.inject is scope=provided" 18/86418/1
Robert Varga [Fri, 13 Dec 2019 14:24:45 +0000 (15:24 +0100)]
Revert "Make sure javax.inject is scope=provided"

This reverts commit ed39857808f10bb2641a19fdc66dc4fadcc62401.
scope=provided does not really help.

Change-Id: I9ba3cde2038b6b1d522b0b43408e08d13685fe91
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove Bug5224/Bug5845 tests 09/86409/1
Robert Varga [Thu, 12 Dec 2019 22:12:39 +0000 (23:12 +0100)]
Move Bug5224/Bug5845 tests

These tests are in reality testing BindingNormalizedNodeCodecRegistry,
move them to mdsal-binding-dom-codec, eliminating their dependency
on AbstractDataBrokerTest.

JIRA: MDSAL-393
Change-Id: I05fd3129efffeac5564096c34f7170a578caa380
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove overrides of maven.compiler.release 45/86345/3
Robert Varga [Wed, 11 Dec 2019 02:55:30 +0000 (03:55 +0100)]
Remove overrides of maven.compiler.release

We have adopted a fixed-up odlparent, which has the fixes needed
to suppress ARIES-1923. Remove the now-unneeded overrides.

Change-Id: Ibeed12dac7bb96c8b7d5b652233ce51e755bf1e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 5.0.7-SNAPSHOT 06/86406/2
Robert Varga [Thu, 12 Dec 2019 17:45:09 +0000 (18:45 +0100)]
Bump versions to 5.0.7-SNAPSHOT

This starts the next development iteration.

Change-Id: I127ab18a7d932e186fc7acebb1bbe9b5ea963816
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake sure javax.inject is scope=provided 05/86405/1
Robert Varga [Thu, 12 Dec 2019 16:02:20 +0000 (17:02 +0100)]
Make sure javax.inject is scope=provided

We do not want to lug this around, as it eventually breaks
downstream (which is probably a JDK11 bug, but anyway).

Change-Id: I58a0663a072b722f6207c21c5fdd07957bb28fbc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDepend only on immutables.org annotations 60/86360/1
Robert Varga [Wed, 11 Dec 2019 22:34:06 +0000 (23:34 +0100)]
Depend only on immutables.org annotations

We have a reworked integration with annotations processors, there
is no need to pull the the entire processor to dependencies.

Change-Id: Ic49ac41a333969dad694dd2b3140e7b6a838db96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSwitch DataContainerCodecPrototype to VarHandles 96/85996/3
Robert Varga [Tue, 26 Nov 2019 22:24:59 +0000 (23:24 +0100)]
Switch DataContainerCodecPrototype to VarHandles

With Java 9+ we can improve memory access through
DataContainerCodecPrototype by lowering the double-checked
load from being based on volatile (hence globally-ordered)
to being based acquire/release, providing more freedom to JIT.

JIRA: MDSAL-498
Change-Id: I1b366916332f7918d8f8c517a1e7b255215493b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSwitch streamer instantiation to VarHandles 95/85995/3
Robert Varga [Tue, 26 Nov 2019 22:09:49 +0000 (23:09 +0100)]
Switch streamer instantiation to VarHandles

Streamers are based on immutable data, hence we can safely drop
their cache to release/acquire instead of the globally-ordered
volatile semantics.

JIRA: MDSAL-498
Change-Id: I36036908b0ae35dccc2b9016057ca1014373510d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse VarHandle for CodecDataObject hashCode cache 94/85994/3
Robert Varga [Tue, 26 Nov 2019 21:49:18 +0000 (22:49 +0100)]
Use VarHandle for CodecDataObject hashCode cache

Since DataObjects are effectively-final and so are NormalizedNodes,
we can rely on them being invariant and thread-safe. This allows us
to lower synchronization of the hash code cache, so that it does not
force a full volatile barrier, but only a simple acquire/release
interaction.

JIRA: MDSAL-498
Change-Id: I201aa8de447222da5dcc0e5c29d6375743ec9083
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 5.0.6-SNAPSHOT 51/86351/1
Robert Varga [Wed, 11 Dec 2019 11:28:14 +0000 (12:28 +0100)]
Bump versions to 5.0.6-SNAPSHOT

This starts the next development iteration.

Change-Id: I5f3f6fb0fa79a2346405c214a72d0bd7d13fd6fe
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump odlparent/yangtools to 6.0.3/4.0.3 44/86344/1
Robert Varga [Wed, 11 Dec 2019 02:51:50 +0000 (03:51 +0100)]
Bump odlparent/yangtools to 6.0.3/4.0.3

This picks up the latest fixes and features.

Change-Id: I84053689e66ea3dabf934f98e72249d8f1bba859
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSprinkle BindingReflections with @NonNull annotations 42/86342/1
Robert Varga [Wed, 11 Dec 2019 01:44:46 +0000 (02:44 +0100)]
Sprinkle BindingReflections with @NonNull annotations

This adds a few obvious annotations, so that callers do not get
warnings.

Change-Id: Icf1574b8d6a90c959ce6580a3f7e675f46fa0837
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd codegen support for nested notifications 07/86307/5
Robert Varga [Mon, 9 Dec 2019 15:44:30 +0000 (16:44 +0100)]
Add codegen support for nested notifications

We do not have a concept of instance notification, which is similar
in many respects to an action. Add the baseline interface marker
and teach mdsal-binding-generator-impl to emit interface definitions
for them.

JIRA: MDSAL-493
Change-Id: I6af84b50f3083a8e1046ee0521b126aae1ffafe5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUpdate CodecDataObjectGenerator documentation 93/85993/1
Robert Varga [Tue, 26 Nov 2019 22:59:58 +0000 (23:59 +0100)]
Update CodecDataObjectGenerator documentation

The documentation is not quite accurate, as its initial paragraph
references constant folding which is not actually implemented.

Fix wording and drop a new FIXME for implementation follow-up.

Change-Id: I090ff203cdd28aafc43dce27c186098941c0e6b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCorrect @NonNull CodeHelpers.compilePatterns() 33/85933/1
Robert Varga [Thu, 21 Nov 2019 13:27:12 +0000 (14:27 +0100)]
Correct @NonNull CodeHelpers.compilePatterns()

Arrays and type-use annotations have weird way of being written,
this adds the correct form.

JIRA: MDSAL-487
Change-Id: I2e31c90eca5b59250f0a9e33444fa8b3b8ae5e4c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix CodeHelper.nonnull() nullness annotation 32/85932/1
Robert Varga [Thu, 21 Nov 2019 13:25:53 +0000 (14:25 +0100)]
Fix CodeHelper.nonnull() nullness annotation

We do not correctly propagate the fact the return is @NonNull,
leading to Eclipse issuing warnings. Fix that.

JIRA: MDSAL-487
Change-Id: I24360192d105423a19165855521bb24bb0bd0678
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCorrect YangModuleInfo.getInstance() nullness warning 31/85931/1
Robert Varga [Thu, 21 Nov 2019 13:25:04 +0000 (14:25 +0100)]
Correct YangModuleInfo.getInstance() nullness warning

This method is missing a @NonNull, which means we end up issuing
a warning. Fix that up.

JIRA: MDSAL-487
Change-Id: I0870880bceb727b6a820bcdc0fd4177002fb4119
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd yangtools javadoc link 77/85877/1
Robert Varga [Wed, 20 Nov 2019 08:12:09 +0000 (09:12 +0100)]
Add yangtools javadoc link

Cross-references mdsal-docs with yangtools-docs.

Change-Id: Iea811968568f48de9070a0a45876db71dce37470
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoResync javadoc links 76/85876/1
Robert Varga [Wed, 20 Nov 2019 08:13:07 +0000 (09:13 +0100)]
Resync javadoc links

This re-synchronizes links to upstreams to match odlparent.

Change-Id: Ibc514a9aa5eb5f068561772b91061567796ed171
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix onDataTreeChanged() references 75/85875/1
Robert Varga [Wed, 20 Nov 2019 08:11:28 +0000 (09:11 +0100)]
Fix onDataTreeChanged() references

Use a link to specific method, not just any matching.

Change-Id: I99752bbda0e9ff3d3371ba8658b319a9cbfe4fce
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove use of xbase-lib in tests 58/85858/1
Robert Varga [Tue, 19 Nov 2019 15:09:49 +0000 (16:09 +0100)]
Remove use of xbase-lib in tests

The way the expected object is constructed is horrible, just use
plain fluent builder without the extensions. This makes it more
clear and much more concise.

Change-Id: I042dfda9fadcc2b3764a449dfc34300f0928370b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoImport types being checked 29/85829/5
Robert Varga [Mon, 18 Nov 2019 12:44:39 +0000 (13:44 +0100)]
Import types being checked

When we are checking individual component types, we should not
be needing to reference them via the full name. Use imported name
instead.

Change-Id: I728d4790929cb548ef022c3b3b34e6cddc2f5aa3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd Types.isListType(ParameterizedType) 28/85828/9
Robert Varga [Mon, 18 Nov 2019 12:16:37 +0000 (13:16 +0100)]
Add Types.isListType(ParameterizedType)

Performing duplicate checks is not efficient, if the caller already
knows the type is parameterized.

Change-Id: I164291490602959d1f5bdd83eb35be7f2b0d0428
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpeed up ListsBindingUtils 30/85830/3
Robert Varga [Mon, 18 Nov 2019 12:54:42 +0000 (13:54 +0100)]
Speed up ListsBindingUtils

This just uses proper fluent builder pattern instead of a
temporary variable.

Change-Id: I8cdf2cff7c910f5518eb999949f315740fe7c1ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoInline AbstractTypeGenerator.resolveListKeyTOBuilder() 23/85823/3
Robert Varga [Mon, 18 Nov 2019 11:52:47 +0000 (12:52 +0100)]
Inline AbstractTypeGenerator.resolveListKeyTOBuilder()

This method is only called once in a context which can already
know whether it needs to actually call it. Inline the definition,
so that we have a more efficient code flow.

Change-Id: I216ca272a13d98eb3ce4c6323fe9442c9ecaa617
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoOptimize AbstractTypeGenerator.listKeys() 22/85822/2
Robert Varga [Mon, 18 Nov 2019 11:36:45 +0000 (12:36 +0100)]
Optimize AbstractTypeGenerator.listKeys()

In case of an empty key definition we end up allocating
short-lived empty ArrayLists, which is not efficient. Also lists
typically have a few elements, so we end up over-allocating them.

This fixes both cases, by checking the definition first and
returning an empty list in case the definition is empty, as well
as properly allocating efficient implementation where needed.

Change-Id: I99e8843abf6040654fab96052352cbfb29590ecf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unneeded checkstyle supressions 17/85817/2
Robert Varga [Mon, 18 Nov 2019 10:44:11 +0000 (11:44 +0100)]
Remove unneeded checkstyle supressions

Treading carefully and using Class.asSubclass() allows us to
remove raw types/unchecked casts.

Change-Id: Ib7554cc40f0b4f41495405db3b7715e0f4e21cc7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoParse docs version of pom.xml 51/85551/2
Thanh Ha [Mon, 4 Nov 2019 16:11:50 +0000 (11:11 -0500)]
Parse docs version of pom.xml

Issue: MDSAL-489
Signed-off-by: Thanh Ha <zxiiro@gmail.com>
Change-Id: Ie32ef32b3d89e98b9ea432bd8e2ac5ea91bf13b9

4 years agoBump versions to 5.0.5-SNAPSHOT 39/85539/1
Robert Varga [Mon, 4 Nov 2019 09:57:52 +0000 (10:57 +0100)]
Bump versions to 5.0.5-SNAPSHOT

This starts the next development iteration.

Change-Id: Ie74fd03ed815844bf0e74b693f101b6884973172
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoStatically cache Augmentable/Augmentation class 19/85319/1
Robert Varga [Mon, 21 Oct 2019 21:31:52 +0000 (23:31 +0200)]
Statically cache Augmentable/Augmentation class

We expect to access these regularly, add them to constant pool,
speeding up type construction.

Change-Id: I7fbdc8dbb8fbfbe09a25bf15eb527e9f548bc9e5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd @NonNull to Types 18/85318/1
Robert Varga [Mon, 21 Oct 2019 21:29:02 +0000 (23:29 +0200)]
Add @NonNull to Types

This is a utility class which is null-opinionated, add the proper
annotations.

Change-Id: I94f1c70c385cb0abb10ba86f3c47401312b283d5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoPropagate @NonNull around JavaFileTemplate 15/85315/2
Robert Varga [Mon, 21 Oct 2019 20:55:03 +0000 (22:55 +0200)]
Propagate @NonNull around JavaFileTemplate

We really do not tolerate nulls here, add appropriate annotations
to silence Eclipse warnings.

Change-Id: If48ba86523e61ea30874a979a03874f17dc877e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove JavaFileTemplate.addImport() 14/85314/2
Robert Varga [Mon, 21 Oct 2019 20:49:56 +0000 (22:49 +0200)]
Remove JavaFileTemplate.addImport()

This method is unused, remove it.

Change-Id: Ib8192127845e607a29ed68d8cbc8d9da68757897
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove support for multiple annotations 13/85313/2
Robert Varga [Mon, 21 Oct 2019 20:43:43 +0000 (22:43 +0200)]
Remove support for multiple annotations

We are only using a single annotation, hence we can collapse
a for loop into a straight append. Also reduces the need to allocate
arrays (even if JIT will handle that).

Change-Id: I5d226b115c16a91636045031c1ae3870a119e81a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCache most common importedName(Class) references 11/85311/4
Robert Varga [Mon, 21 Oct 2019 18:44:10 +0000 (20:44 +0200)]
Cache most common importedName(Class) references

Going through importedName(Class) incurs some cost to look up
the JavaTypeName in the global cache. There is a number of common
classes we end up using very frequently.

We express these references as JavaTypeName constants, hence
reducing the need for cache lookups in the hot path.

Change-Id: I7f0430f529e82a7d4838ebe2200520d20a5a44a0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse SUPPRESS_WARNINGS reference 12/85312/1
Robert Varga [Mon, 21 Oct 2019 19:15:07 +0000 (21:15 +0200)]
Use SUPPRESS_WARNINGS reference

When suppressing warnings, we should use the JavaTypeName constant
available in JavaFileTemplate.

Change-Id: I9b6a46403b67f4411356e2aaf16c758b15430273
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSpecialize JavaFileTemplate.importedName(Type) 10/85310/1
Robert Varga [Mon, 21 Oct 2019 18:46:29 +0000 (20:46 +0200)]
Specialize JavaFileTemplate.importedName(Type)

95% of call sites do not use annotations, hence we specialize
this method and support it through specialized
AbstractJavaGeneratedType.getReferenceString(Type).

This clearly separates the two codepaths and removes superfluous
checks and indirections in both paths.

Change-Id: I17bfef631d446d71147b17146d5b2cf71a8be623
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove an unused import 07/85307/1
Robert Varga [Mon, 21 Oct 2019 18:27:24 +0000 (20:27 +0200)]
Remove an unused import

This import was left unused after the previous patch, remove it.

JIRA: MDSAL-487
Change-Id: Ie3fe896c64a1cae5c86095dd98386111dcf17959
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd @NonNull annotation to $YangModuleInfoImpl.qnameOf() 93/85293/5
Robert Varga [Mon, 21 Oct 2019 12:44:33 +0000 (14:44 +0200)]
Add @NonNull annotation to $YangModuleInfoImpl.qnameOf()

YangModuleInfoTemplate has a lot of ceremony when we statically
know the types being used by the template. Concentrate imports
into two sets, instantiate them as strings and be done with it.

Since this takes care of most dynamics, making things much easier
and predictable, we can easily add @NonNull annotations as needed.

JIRA: MDSAL-487
Change-Id: Ic9cd4da1002f3edea6f3fb18f9d49e4a377e145b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix spotbugs complaints around logging 95/85295/1
Robert Varga [Mon, 21 Oct 2019 16:52:35 +0000 (18:52 +0200)]
Fix spotbugs complaints around logging

Spotbugs is very much correct about warning about non-constant
format strings. This patch fixes that up.

Change-Id: I8df61b64be1478510e60af99dd2cd2365a98f2c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoUse ImmutableSet in YangModuleInfo 94/85294/2
Robert Varga [Mon, 21 Oct 2019 15:23:01 +0000 (17:23 +0200)]
Use ImmutableSet in YangModuleInfo

This allows us to bind to a concrete implementation, improving
performance very slightly.

Change-Id: I2ed60f86ae64895685047d772f31b429aac79d22
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump to odlparent-6.0.1/yangtools-4.0.2 65/85265/1
Robert Varga [Sun, 20 Oct 2019 08:53:38 +0000 (10:53 +0200)]
Bump to odlparent-6.0.1/yangtools-4.0.2

This picks up latest upgrades and fixes.

Change-Id: Ib6970d280f73b149e993dbefee29386ccca9ad0a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix bug5882 test case 34/85234/5
Robert Varga [Sat, 19 Oct 2019 10:18:54 +0000 (12:18 +0200)]
Fix bug5882 test case

This test case uses illegal duplicate leaves, fix that up.

Change-Id: I3330fafb11b798ab74f9a64b04f4bff8d82b2ce6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix invalid augmentations 43/85243/1
Robert Varga [Sat, 19 Oct 2019 12:43:00 +0000 (14:43 +0200)]
Fix invalid augmentations

choice/case structures are collapsed to their parent data tree
node, hence it is invalid to define (in same namespace) the equivalent
of:

container {
  leaf foo { type string; }
  choice some {
    case foo {
      leaf foo { type string; }
    }
  }
}

Fix up the testing model.

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

4 years agoAdd IetfYangUtil.physAddressBytes() 36/85236/4
Robert Varga [Sat, 19 Oct 2019 10:45:29 +0000 (12:45 +0200)]
Add IetfYangUtil.physAddressBytes()

This adds {mac,phys}AddressBytes() to extract these from well-known
objects.

JIRA: MDSAL-486
Change-Id: Id4a9825be476e4a83bf39c4372340b479dd76164
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd JavaTypeNames for annotation types 07/85207/1
Robert Varga [Fri, 18 Oct 2019 11:37:00 +0000 (13:37 +0200)]
Add JavaTypeNames for annotation types

We tend to use these quite heavily and each access goes through
the type cache to acquire the JavaTypeName. We can speed things up
a bit by having constants for these annotations.

Change-Id: Id78c92e6f7cca6ecfde85cbe9b986a988acfc9e1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMore nullable annotations 06/85206/1
Robert Varga [Tue, 15 Oct 2019 15:28:02 +0000 (17:28 +0200)]
More nullable annotations

This adds a few nullable annotations so eclipse is happier.

Change-Id: I7ce1bb366724413243bdeebc915e5f6978989e9f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake Builders sensitive to @Deprecated annotations 82/85082/3
Robert Varga [Sat, 12 Oct 2019 13:54:37 +0000 (15:54 +0200)]
Make Builders sensitive to @Deprecated annotations

When we are generating a builder for a deprecated type, we need to
consider how it deals with deprecated elements.

There are two scenarios here:

1) status=deprecated -> @Deprecated
In this case it is fair game to produce data, hence the builder
is not deprecated and therefore has @SuppressWarnings("deprecation")

2) status=obsolete -> @Deprecated(forRemoval = true)
In this case the data should not be produced at all, hence
the builder needs to be @Deprecated(forRemoval), too.

We recognize both these conditions and act accordingly. We misue
bug-586 test case to hijack compilation testing.

JIRA: MDSAL-485
Change-Id: I9d08116615cf8c5bdb6a8f4977c9810686618cda
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd @Deprecated(forRemoval = true) to obsolete elements 83/85083/2
Robert Varga [Sat, 12 Oct 2019 14:06:19 +0000 (16:06 +0200)]
Add @Deprecated(forRemoval = true) to obsolete elements

This adds the functionality to add @Deprecated for removal
annotation to obsolete components.

JIRA: MDSAL-481
Change-Id: I2e23e37e65b799b363a518fc5d737b40e5a64a3c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoCleanup YangModuleInfoTemplate 18/85118/1
Robert Varga [Tue, 15 Oct 2019 10:32:16 +0000 (12:32 +0200)]
Cleanup YangModuleInfoTemplate

generateModelProvider() returns a string, use the appropriate
template syntax. Also use Map.putIfAbsent() instead of
containsKey()/put() checks.

Change-Id: I48faccd7c87f2ffff51b30d9df04c5cb613df184
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix boxing warnings 05/85105/1
Robert Varga [Mon, 14 Oct 2019 10:52:01 +0000 (12:52 +0200)]
Fix boxing warnings

Use Boolean.TRUE to fix a warning.

Change-Id: Iff20fe6af6d53351a560f54bed7d0fb426a29fd6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unused field from BuilderGeneratorTest 04/85104/1
Robert Varga [Mon, 14 Oct 2019 10:50:39 +0000 (12:50 +0200)]
Remove unused field from BuilderGeneratorTest

We're not using properties, remove the string constant.

Change-Id: If77cac4f65d4e1df54dca30f8ce7e26be6108260
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix nullness warnings in GeneratorJavaFileTest 03/85103/1
Robert Varga [Mon, 14 Oct 2019 10:49:20 +0000 (12:49 +0200)]
Fix nullness warnings in GeneratorJavaFileTest

Add a simple @NonNullByDefault annotation to utility method to
eliminate some nullness noise.

Change-Id: I41d32f5cf2bbae06c6c82127590c08c5536dc86a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 5.0.4-SNAPSHOT 58/85058/1
Robert Varga [Fri, 11 Oct 2019 12:57:55 +0000 (14:57 +0200)]
Bump versions to 5.0.4-SNAPSHOT

This starts the next development iteration.

Change-Id: I1359a57ac5409b62d3c1b61d2b166b338be01c62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd workarounds for ARIES-1923 52/85052/2
Robert Varga [Fri, 11 Oct 2019 11:12:13 +0000 (13:12 +0200)]
Add workarounds for ARIES-1923

mdsal-binding-api needs it, possibly also spi/util, which we have
just brough to JDK9+ land. Better be safe than sorry.

JIRA: MDSAL-484
Change-Id: Ib2c5c0fbd2fbc2ac083f82423a1d4e918c277cf4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoDisable slf4j SSL link 53/85053/1
Robert Varga [Fri, 11 Oct 2019 12:00:23 +0000 (14:00 +0200)]
Disable slf4j SSL link

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

Change-Id: I2158c043a2d9e810a329587159fc6af9d57d8e56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMake yang-binding an automatic module 28/85028/1
Robert Varga [Thu, 10 Oct 2019 07:37:09 +0000 (09:37 +0200)]
Make yang-binding an automatic module

This is an API component and while it will need to see some
further movement, we should make it an automatic module. As a
side-effect, this fixes javadoc lookup errors we were seeing
in downstream automatic modules.

Change-Id: I3448918da8673f6ee98511265bda7f3b6659c2a1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 5.0.3-SNAPSHOT 10/85010/1
Robert Varga [Wed, 9 Oct 2019 07:58:29 +0000 (09:58 +0200)]
Bump versions to 5.0.3-SNAPSHOT

This starts the next development iteration.

Change-Id: I8216eb6e8172171ba64f85082c2c1a76ed2dc212
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoSquash Parameterized types in javadoc references 09/85009/1
Robert Varga [Wed, 9 Oct 2019 05:50:42 +0000 (07:50 +0200)]
Squash Parameterized types in javadoc references

When we are making a reference to a method, any arguments that
are parameterized (such as Class<?>) need to be squashed to their
raw type (such as Class).

JIRA: MDSAL-483
Change-Id: I0d8b596e17ec594a67fdde6f5fc17219aac99a3d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 5.0.2-SNAPSHOT 76/84876/1
Robert Varga [Wed, 2 Oct 2019 13:01:17 +0000 (15:01 +0200)]
Bump versions to 5.0.2-SNAPSHOT

This starts the next development iteration.

Change-Id: Ib38d9891d20f92db893372bd78e8c491123ae98e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump yangtools to 4.0.1 74/84874/3
Robert Varga [Wed, 2 Oct 2019 11:22:45 +0000 (13:22 +0200)]
Bump yangtools to 4.0.1

This bumps yangtools to 4.0.1 to pick up Uint64 fix. Also fixes
AbstractDOMStoreTreeChangePublisherTest to not muck in
AbstractRegistration internals.

Change-Id: I2d59eb48a42f2b9d1818c8403f6f443fc47d6e1a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump versions to 4.0.1-SNAPSHOT 60/84860/1
Robert Varga [Tue, 1 Oct 2019 19:27:08 +0000 (21:27 +0200)]
Bump versions to 4.0.1-SNAPSHOT

This starts the next development iteration.

Change-Id: I1cd1f5d811fd4ceab6b659d5a6aa27f11bd63e40
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoExpose EffectiveModuleContext from ModuleInfoBackedContext 59/84859/1
Robert Varga [Tue, 1 Oct 2019 19:24:59 +0000 (21:24 +0200)]
Expose EffectiveModuleContext from ModuleInfoBackedContext

This exposes a twin method, so that downstreams can start using
EffectiveModelContext.

JIRA: MDSAL-435
Change-Id: Ie60db53eaf3394fc05ff5eb61b19b4f5833f5e4b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoFix yangtools misbump 56/84856/1
Robert Varga [Tue, 1 Oct 2019 16:34:04 +0000 (18:34 +0200)]
Fix yangtools misbump

I accidentally changed also versions of our utilities, fix that
up.

Change-Id: I5f6428ca3acc1f8162a6861a9ec9ea311a507600
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoBump yangtools to 4.0.0 47/84847/2
Robert Varga [Tue, 1 Oct 2019 12:17:43 +0000 (14:17 +0200)]
Bump yangtools to 4.0.0

yangtools-4.0.0 has been released, this patch adopts that version,
ending the period when we were snapshot-integrated.

Change-Id: I724f264c434ef2efd797ae56e61db9f3e374e425
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTerminally-deprecate with-parent put()/merge() operations 38/84838/7
Robert Varga [Tue, 1 Oct 2019 10:19:56 +0000 (12:19 +0200)]
Terminally-deprecate with-parent put()/merge() operations

These have been deprecated for some time now, schedule them for
removal.

Change-Id: Id3e6f44add83d37f699fb5642161b552ce8a5465
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove unneeded javax.annotation suppressions 43/84843/4
Robert Varga [Tue, 1 Oct 2019 11:06:12 +0000 (13:06 +0200)]
Remove unneeded javax.annotation suppressions

We do not have javax.annotation dependencies in these components,
remove supressions.

Change-Id: Ie08b1fffb923afb2f5579abc01577b9b786204df
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTerminally deprecate yang.binding.RpcImplementation 41/84841/5
Robert Varga [Tue, 1 Oct 2019 10:30:04 +0000 (12:30 +0200)]
Terminally deprecate yang.binding.RpcImplementation

We do not seem to have any use for this interface, let's just
schedule it for removal.

Change-Id: Iae2b36320411f89486d0f7def0b144b03ed015c1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoMove FIXMEs out to 6.0.0 42/84842/5
Robert Varga [Tue, 1 Oct 2019 10:33:15 +0000 (12:33 +0200)]
Move FIXMEs out to 6.0.0

This reschedules FIXMEs so they target next API-incompatible release.

Change-Id: Ica9ea81b2e362acf8dc411ae3d820f5b1139c7ee
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove binding.generator.util.CodeGenerationException 40/84840/3
Robert Varga [Tue, 1 Oct 2019 10:27:57 +0000 (12:27 +0200)]
Remove binding.generator.util.CodeGenerationException

This class is not used anywhere, remove it.

Change-Id: I1b512b23a047e619d1830bf166e1cfb2de9f20f7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove dom.codec.gen.spi remnants 39/84839/3
Robert Varga [Tue, 1 Oct 2019 10:21:41 +0000 (12:21 +0200)]
Remove dom.codec.gen.spi remnants

This removes the last remnants of the binding-dom-codec SPI contract,
keeping all implementation details internal.

Change-Id: I7f5c71b3abb17737ef0fd8c580260c01bc777c9a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove BaseYangTypes.UnionType 23/84823/6
Robert Varga [Mon, 30 Sep 2019 21:29:25 +0000 (23:29 +0200)]
Remove BaseYangTypes.UnionType

This class seems to be completely unused, let's remove it.

Change-Id: Iebfd0b9396b3189ccafee59cc1b4ea2a3850fb89
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoRemove superfluous @NonNull 30/84830/2
Robert Varga [Tue, 1 Oct 2019 07:08:01 +0000 (09:08 +0200)]
Remove superfluous @NonNull

We are already using @NonNullByDefault, this additional annotation
is unneeded.

Change-Id: Ibad7236d61f798adff97381c50c3563d7dedf942
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdjust to CodeGenerator using EffectiveModelContext 27/84827/1
Robert Varga [Tue, 1 Oct 2019 06:26:48 +0000 (08:26 +0200)]
Adjust to CodeGenerator using EffectiveModelContext

yangtools has changed the SPI interface in that it is giving us
EffectiveModelContext instead of SchemaContext. Adjust to that.

Change-Id: I2653fd3c0d17402841e774710f43f4d464dcdfe0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoShare TestModel schema context 22/84822/2
Robert Varga [Mon, 30 Sep 2019 21:27:02 +0000 (23:27 +0200)]
Share TestModel schema context

Even if this takes a few milliseconds, it is useful to share the
the context (as is invariable).

Change-Id: I790932ddbd13c5a12cce27f941785a389b8bb7d8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdd factory method for malformed messages 21/84821/1
Robert Varga [Mon, 30 Sep 2019 21:15:56 +0000 (23:15 +0200)]
Add factory method for malformed messages

This is a utility method to make it easier for users to create nice
messages when they cannot make sense of a message.

JIRA: MDSAL-455
Change-Id: Ic8292b3d766d53b17a5e3e3dd7fd5a625e7618bc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdjust for NormalizedNodeStreamWriter.startAnyxmlNode() changing 13/84813/1
Robert Varga [Mon, 30 Sep 2019 15:29:13 +0000 (17:29 +0200)]
Adjust for NormalizedNodeStreamWriter.startAnyxmlNode() changing

The baseline interface now propagates the intended object model,
handle it accordingly.

Change-Id: I9b68801a2a1ee20d86599432fe6b593007836807
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoTerminally deprecate YangSchemaUtils 12/84812/1
Robert Varga [Mon, 30 Sep 2019 15:16:34 +0000 (17:16 +0200)]
Terminally deprecate YangSchemaUtils

This class does not seem to be used anywhere, deprecate it for
removal.

Change-Id: I7ff7e4d21647c43fb8daca410541565bc4052323
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdjust for AnydataExtension being integrated 10/84810/1
Robert Varga [Mon, 30 Sep 2019 11:31:50 +0000 (13:31 +0200)]
Adjust for AnydataExtension being integrated

This updates serialization code to match changes made to
NormalizedNodeStreamWriter -- i.e. AnydataExtension being an
integral part of it.

Change-Id: Id09cec7ba7f7d4359379e9bd74baae4d008b1e63
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdjust for DataTreeTip.prepare() throwing a checked exception 03/84803/1
Robert Varga [Mon, 30 Sep 2019 09:20:29 +0000 (11:20 +0200)]
Adjust for DataTreeTip.prepare() throwing a checked exception

Preparation can now cleanly fail, make sure we account for that
possibility.

Change-Id: I35b3e29b3e21d670768df792db0c9972fab6a74f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
4 years agoAdjust for YangTextSchemaContextResolver return type change 00/84800/1
Robert Varga [Mon, 30 Sep 2019 07:58:33 +0000 (09:58 +0200)]
Adjust for YangTextSchemaContextResolver return type change

The return type of getSchemaContext() changed to return
Optional<? extends SchemaContext>, adjust to that.

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