Robert Varga [Fri, 17 Apr 2020 19:54:00 +0000 (21:54 +0200)]
Improve grouping error reporting
Reporting FQCN here is useful, as it is giving us crucial information
as to what class is being generated -- including the namespace.
Change-Id: I1ad5f6a0a568a71656e338ae0d5d9e3f863103a4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 18 Dec 2019 09:05:15 +0000 (10:05 +0100)]
Cache YangModuleInfo type name
Analysis of a heap dump shows we are creating a number of instances
pointing to the same type for the purposes of having the QNAME constant.
As we have the context in which we are creating YangModuleInfo,
instantiate a primitive cache to de-duplicate these definitions.
JIRA: MDSAL-515
Change-Id: I9bb52d04627e91eac3adff672b06f6340cac157f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 8 Apr 2020 13:01:59 +0000 (15:01 +0200)]
Fix logic ensuring parent presence
When we are asked to create intermediate nodes for a path, whose
parent is the conceptual root (i.e. its parent is empty), we should
not attempt to merge it, as it just does not make sense.
JIRA: MDSAL-534
Change-Id: Ia5f6ef2857903d8e88030f4c1f3867b8ed8f5a0e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
ed271c6322092bccf8ff9500b1bbb0fb62683419)
Robert Varga [Wed, 8 Apr 2020 12:22:51 +0000 (14:22 +0200)]
Migrate test to use mergeParentStructure{Merge,Put}
We have deprecated these methods, make sure we migrate the test
so that it does not add false warnings.
Change-Id: I3a6bd6b936f34478fe7afdcc26547ffa7edb8992
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
77998716f93d97aa8e58e408db6d956d81b727ff)
Robert Varga [Wed, 8 Apr 2020 12:31:02 +0000 (14:31 +0200)]
Remove superfluous @NonNull annotations
These annotations are inherited from interface contract, there is
no point in specifying them again.
Change-Id: I7e2cb6d353b358f5c2eefc03181803377e047750
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 2 Mar 2020 12:58:50 +0000 (13:58 +0100)]
Fix YANG snippet escaping
This is the non-javadoc path for module generation, where we are
failing to escape potential unicode references. Add the proper
callout and also optimize it to be a faster no-op when not
applicable, properly documenting what is going on.
JIRA: MDSAL-529
Change-Id: Ib21ed4f15555d49aaa7eb3dac61043c4b2e90451
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Samuel Kontris [Fri, 28 Feb 2020 13:33:02 +0000 (14:33 +0100)]
Propagate grouping inference flag
The test case ends up looking through the magic code flagged
for refactoring -- which is losing knowledge that the parent
node is actually a grouping. Fix this up by propagating the
flag correctly.
JIRA: MDSAL-519
Change-Id: I8fe04e688adfcc068ff29e90a039530bcd56b3c3
Signed-off-by: Samuel Kontris <samuel.kontris@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 29 Feb 2020 10:28:54 +0000 (11:28 +0100)]
Remove unneeded cast
Pointed out by Eclipse, very true.
Change-Id: If9ad77f87889e423e7918badc1b4bff2480079ca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 29 Feb 2020 10:16:40 +0000 (11:16 +0100)]
Modernize ListenerRegistry users
ListenerRegistry has been modernized for Java 8 way back
in https://git.opendaylight.org/gerrit/c/yangtools/+/73957 and our
users have not been updated.
Use new API surface introduced in that patch, which actually makes
our code cleaner.
Change-Id: Id7e554ed229638cdc871d5b4152cc6795a662514
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 29 Feb 2020 11:58:15 +0000 (12:58 +0100)]
Remove TracingBroker.name
This can only ever be 'default', remove it as a property.
Change-Id: I66ca5bb6fdf1072cc3f9550866ff375f59a6c544
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 29 Feb 2020 10:36:10 +0000 (11:36 +0100)]
Do not use by-listener unregistration
This test is the only one needing access to unregister(L). Remove
it via proper registration interaction.
Change-Id: I5eff48b7123820bb090fdb834054fa78fd767e8a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 28 Feb 2020 17:39:51 +0000 (18:39 +0100)]
Expand test suite to cover uses-augment of actions
Augment can also target a relative path from uses context, this
expands the testing model to cover that case, too.
The test case flushes out the problem of not handling
action/notification nodes when targeted in this manner, leading
to an obvious hiccup.
JIRA: MDSAL-517
Change-Id: If389440622c31f544917b04e3825fe6e08e08244
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 28 Feb 2020 17:36:28 +0000 (18:36 +0100)]
Update Mdsal517Test a bit
This just cleans up naming to prevent confusion.
JIRA: MDSAL-617
Change-Id: I75d2e95d2396f63d05cd533f16057f556850763c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
miroslav.kovac [Thu, 27 Feb 2020 16:51:37 +0000 (17:51 +0100)]
Fix augmentation pointing to a grouping action's input
When augmentation targets an action input which itself is defined
in a grouping, we need to actually lookup the original definition.
Add a type aliasing information, which should be consulted when
making a simple reference to a type -- and use it in
augmentationToGenTypes().
JIRA: MDSAL-517
Change-Id: I1ef383e8777a7c09a979cbdd84f71be3a0f9b021
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 28 Feb 2020 05:55:29 +0000 (06:55 +0100)]
Switch from NPE to ISE
When we fail to locate a type it constitutes an IllegalState, not
a plain NPE.
Change-Id: I46eaa470342a5e72ad6a92aefed97e458a2ca398
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 27 Feb 2020 15:38:47 +0000 (16:38 +0100)]
BindingReflections.getModuleInfo() returns @NonNull
A null return here would be an API violation, make sure we catch
these in BindingReflections and do not bother users with potential
nulls.
Change-Id: I1670a46d1de4aeac0730538822157ec6ae216011
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 27 Feb 2020 09:38:33 +0000 (10:38 +0100)]
Fix action/grouping lookup mechanics
When we are following references towards the original definitions
we need to mind the fact that 'uses' statement may point to a grouping
in a different module and hence we need to adjust namespace accordingly.
The same thing applies when we want to find generated types for such
actions' input/output -- here we need to acquire the correct
ModuleContext.
JIRA: MDSAL-516
Change-Id: I1931279beb8e663e6d8558d50c5d7d274e248cf3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 26 Feb 2020 10:38:07 +0000 (11:38 +0100)]
Use osgi-core constants
Just to keep things consistent, use OSGi's Constants class to get
the bundle id for framework (i.e. SYSTEM_BUNDLE_ID).
Change-Id: I18dae474c944f29ebb32203a12db1c96c2e1483f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
a246443e10cc43adace7bc36fdf8014d76010389)
Robert Varga [Tue, 18 Feb 2020 08:58:07 +0000 (09:58 +0100)]
Refactor GeneratedClassLoadingStrategy
This class holds two implementations, each of which is a singleton.
Make sure we lazy-load implementation classes so that the CHA can
be more effective.
JIRA: MDSAL-392
Change-Id: Ia31f63d877ec1025e1a06bf8676d918857e6fd1e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 17 Feb 2020 22:36:15 +0000 (23:36 +0100)]
Deprecate BindingRuntimeContext.getEnumMapping()
Generated enumerations capture their YANG-declared name and expose
it as their method.
JIRA: MDSAL-392
Change-Id: Iac16b6b3599565f059332ed079c432c0603ac500
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 18 Feb 2020 21:23:52 +0000 (22:23 +0100)]
Deprecate AugmentationReader for removal
AugmentationHolder provides the equivalent functionality in-line
in the DataObject itself. Deprecate AugmentationHolder for removal.
JIRA: MDSAL-392
Change-Id: I51044365a38e26f57792bb2036a2775f3b92d711
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 17 Feb 2020 17:13:40 +0000 (18:13 +0100)]
Deprecate DispatchSerializers for removal
These classes are not used anywhere, deprecate them for removal.
Change-Id: I4538b1c794cd21fd0f21921c0838db620af5eff2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 17 Feb 2020 16:55:45 +0000 (17:55 +0100)]
Fix checkstyle a bit
We have a misaligned method here, fix that up.
Change-Id: Iff4ad3e9a5c2da1e64f73f8b3dfaf78d77b1db85
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 10 Feb 2020 14:18:45 +0000 (15:18 +0100)]
Bump to odlparent-6.0.5/yangtools-4.0.7
This picks up latest updates from both yangtools and odlparent.
Change-Id: I5ad354f87e65c4ea2141d3bc13c414e89869f833
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 23 Jan 2020 11:02:46 +0000 (12:02 +0100)]
Remove use of org.junit.rules.ExpectedException
We can use assertThrows() instead.
Change-Id: I8d752851d11496c74388f625067e41582447a8c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 17 Jan 2020 11:04:20 +0000 (12:04 +0100)]
Bump versions to 5.0.10-SNAPSHOT
This starts the next development iteration.
Change-Id: I51753f3615b32d290b6716cb1b996a9df01efb46
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
miroslav.kovac [Mon, 16 Dec 2019 15:57:22 +0000 (16:57 +0100)]
Fix path namespace resolution
If a path is defined in terms of a submodule-local import,
SchemaContextUtil.findDataSchemaNode() breaks down because
it's reparse attempt fails to find the import in the actual
module.
SchemaContextUtil is providing findDataTreeSchemaNode() which
works properly on parsed PathExpression, use that instead.
JIRA: MDSAL-499
Change-Id: Ifa8a8958d7118d851d27fcc2c70c6d8382e3e3c0
Signed-off-by: miroslav.kovac <miroslav.kovac@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 16 Jan 2020 15:52:25 +0000 (16:52 +0100)]
Bump version to 5.0.9-SNAPSHOT
This starts the next development iteration.
Change-Id: I33871dca5983daada30a3ddc63c4fb2dec2adb7e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 16 Jan 2020 14:35:00 +0000 (15:35 +0100)]
Bump to odlparent-6.0.4 and yangtools-4.0.6
Pick up latest updates and fix for SFT.
Change-Id: Ia95f9aa740d77407043d7a59823c0c71cad0e681
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 15 Jan 2020 11:30:31 +0000 (12:30 +0100)]
Bump version to 5.0.8-SNAPSHOT
This starts the next development iteration.
Change-Id: I92ce66cd6adf2b3af8f0d8efcafbef1dec9895f1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 14 Jan 2020 16:09:05 +0000 (17:09 +0100)]
Migrate away from DataNodeIterator
We do not need to collect the entire analysis, just typedefs
(and containers in a test). Migrate to new SchemaUtils methods which
provide exactly that functionality more efficiently.
Change-Id: Idfbe19c785351f3280eae33c476d533055cb16e6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 14 Jan 2020 16:02:29 +0000 (17:02 +0100)]
Bump to yangtools-4.0.5
This picks up the latest improvements.
Change-Id: If88980b7f1e38e1ee3c736a7bd04ddecd4d0f74e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 7 Jan 2020 20:35:22 +0000 (21:35 +0100)]
Use parallelStream() to generate files
This is a follow-up cleanup, reducing complexity of parallel dispatch
by taking advantage of parallel streams.
Change-Id: I7f5edd1444f171fba9b7118531678875a8692223
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
c0c76a53d25048d86fcd60e16b68fe942672b85a)
Robert Varga [Tue, 7 Jan 2020 20:35:22 +0000 (21:35 +0100)]
Generate binding files in parallel
Binding-generated files are standalone in that the process of
generating its source does not have any other side effects.
Improve the performance by generating these files in parallel
using the common ForkJoin pool -- thus taking advantage of all
available cores.
Change-Id: I4ee9efea0371fe9574721701ea9674793209cf24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
a6fb0b3903e8630df18b7c63a116bfd06a716bdf)
Robert Varga [Tue, 7 Jan 2020 11:25:33 +0000 (12:25 +0100)]
Add utility methods to strip zone from Ipv{4,6}Address
Most callers really want to operate of Ipv4AddressNoZone, as a zone
does not make sense. Some amount of translation may be needed when
dealing with models which we have no control over, hence ensuring
no zone is present needs to be done quickly.
This adds ipv4AddressNoZoneFor(Ipv4Address), which does an efficient
check (for the case where the source is already a NoZone) and strips
the zone.
Change-Id: Ieada4625637d0216983b515324bb5d33f5d33a99
JIRA: MDSAL-510
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
6c02ae5ce070dfeeeaae878dc5436c601d305886)
Ajay Lele [Mon, 6 Jan 2020 18:49:50 +0000 (10:49 -0800)]
Parse IPv4-mapped IPv6 address as an IPv6 address
Inet6Address.getByAddress(byte[]) does not explicitly exist, and is
really InetAddress.getByAddress(byte[]). That method ends up returning
an Inet4Address for IPv4-mapped IPv6 addresses.
This in turn causes addressStringV6() to do the wrong thing and format
the address as an Ipv4. This is not caught by validation, as we are
skipping it by default -- and ends up causing problems way later when
such an address meets an enforcement point -- such as DOM->Binding
translation.
Fix this by using Inet6Address.getByAddress(String. byte[], NetworkInterface),
which is guaranteed to result in an Inet6Address.
Also add proper defences to addressStringV6(InetAddress), so that any
attempt to mis-use it is caught.
JIRA: BGPCEP-891
Signed-off-by: Ajay Lele <ajayslele@gmail.com>
Change-Id: Ife4cc9e57bd49b45f2beb73462a865ad84483d8f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
1d8897caf5cec5f044f870f949a15fa57de54d71)
Robert Varga [Mon, 6 Jan 2020 22:36:21 +0000 (23:36 +0100)]
Eliminate shift variable
We do not need to track shift amount, as we can can just shift
the entire previous result, leading to more invariants in the loop.
JIRA: MDSAL-509
Change-Id: I13a108be27cac2fe4498952f3f05437927c999c0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
4b26656c945b9af5e67d28d10b014b0ed37cc510)
Robert Varga [Mon, 6 Jan 2020 22:17:05 +0000 (23:17 +0100)]
Add DottedQuad/int interface
DottedQuad is essentially an Ipv4Address, hence we should have
the same level of support. Add interface to create DottedQuad from
bits and serialize it to bits.
JIRA: MDSAL-509
Change-Id: I9cee4afa1993a0090f10b3969152344e03e9adc0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
4e1311cbb83dd15f2da7936385dd9384b6dc0229)
Robert Varga [Mon, 6 Jan 2020 17:41:24 +0000 (18:41 +0100)]
Add IPv4 address bridges to primitive int
Interfacing Ipv4Address(NoZone) with plain int is useful when
we we want to interface with byte streams, such as DataInput
or Netty's ByteBuf. This adds the methods to do so.
JIRA: MDSAL-509
Change-Id: Icce95e4a94ae41be4fc2aee352f83655ea55e89f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
98143cfc18f95eb4057587c1bdb4aa3b5e3b2e20)
Robert Varga [Sun, 5 Jan 2020 12:33:34 +0000 (13:33 +0100)]
Add HexString/DottedQuad/Uuid support to IetfYangUtil
HexString is similar to a MacAddress and PhysAddress, hence it is
very simple to support it.
DottedQuad is essentially an Ipv4Address, hence it is almost as
simple to support it, too.
Uuid can be created from java.util.UUID, so that is the input
we are expecting.
JIRA: MDSAL-508
Change-Id: I82abd68b23bf857deeb9a64eefb69164fe6c8b24
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
7cbd12d8894b1703b19e70b07436a937a7b8d0bf)
Robert Varga [Sat, 4 Jan 2020 10:40:52 +0000 (11:40 +0100)]
Add uint24.yang
uint24 is used in a variety of binary protocols (rsvp,lisp,bgp),
this adds a common definition of this type and the corresponding
netty utilities.
JIRA: MDSAL-507
Change-Id: I5170c2bb9ed65d25bada3a85aca6c22f9ba4696b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit
28d302faed8b6f57263991257163414ac073a37f)
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>
(cherry picked from commit
c8c1ed80b2949b5eda8bdb57bc9a25ef0db1aef0)
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>
(cherry picked from commit
a5f323b5a0eeb5d4a0cb82b37f751ae780ba1f91)
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>
(cherry picked from commit
e905b3d4792076251ddc276fa248e441bba157b2)
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>
(cherry picked from commit
28423fa5964abe10e3950dd1e42052aafa9989d0)
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>
(cherry picked from commit
5bbe5613437f8f0b28ee88b1bc7ef377e1bb5c9d)
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>
(cherry picked from commit
06c6f6b581b0d1526231d84cf0884142fc4f8a4c)
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>
(cherry picked from commit
2f8f56af98be1f58d14256e780e2a9a77c0cfc49)
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>
(cherry picked from commit
d9896900305375bebef22f93e36b713408062fd5)
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>
(cherry picked from commit
a07668d09b87d8f671e774a13583a3c3c0b41369)
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>
(cherry picked from commit
6e6ebc43866204667658f8bbf7cfb6233caffdc7)
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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)
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>
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>
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>
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>
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>