Robert Varga [Tue, 27 Nov 2018 11:14:49 +0000 (12:14 +0100)]
Bump versions to 3.0.3-SNAPSHOT
This starts the next development iteration.
Change-Id: Id51d991b957c1fe58ac64f6c64384baa7bd6fcc6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 27 Nov 2018 10:57:03 +0000 (11:57 +0100)]
Adjust minor version to 1.0.2-SNAPSHOT
This makes it a lot easier to bump versions.
Change-Id: Ib2e3870f9b1868869907998e382147b89a27f828
JIRA: MDSAL-381
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
han [Sun, 30 Sep 2018 08:49:54 +0000 (16:49 +0800)]
Fix up release old producers to avoid memory leak
- It should close all correlative old 'InMemoryDOMDataTreeShardProducer'
when close a 'ShardedDOMDataTreeProducer', or a memory leak happens
for repeatly creating and closing the same producer as well as in the
case of attach/detach subshards.
JIRA: MDSAL-386
Change-Id: I9c6ad6b63de4dfc7b75a315fce23a5da3be9d06d
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 27 Nov 2018 09:39:09 +0000 (10:39 +0100)]
Fix ClassTemplate.hashCode() alignment
We missed four spaces, making the output look ugly. Fix that.
Change-Id: I44cf863a9478db8d1ab4f90c4cf2d766d576f554
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 23 Nov 2018 18:30:11 +0000 (19:30 +0100)]
Teach MethodSignature about default methods
MethodSignature dates back to Java 7 days and has no notion of
interface-default methods. Retrofit the support, as it may come
handy when dealing with various aspects of codegen.
Also propagate the knowledge of them into java-api-generator, so
that we have a cleaner nonnull method generation and new default
methods do not break Builder{Generator,Template} assumptions.
JIRA: MDSAL-18
JIRA: MDSAL-396
Change-Id: I12ea42d096ee50ae61f908e9f9347c45883f66b3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 23 Nov 2018 00:30:08 +0000 (01:30 +0100)]
Optimize IdentifiableItemCodec
ImmutableMapTemplate allows us to instantiate space-efficient
ImmutableOffsetMaps very quickly, because we know exactly what
keySet() we are going to use, including our preferred ordering.
Use this class to instantiate keyValueContexts and also create
NodeIdentifierWithPredicates.
JIRA: YANGTOOLS-917
Change-Id: I087083fe4e1914bb5d8e58b9e378ebda9e070793
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 25 Nov 2018 18:39:00 +0000 (19:39 +0100)]
Use internal classes for codecs
As we are exposing codecs through package-private interfaces, there
is no point in hiding the implementation class. This helps JIT to
devirtualize the calls.
Change-Id: I74262f76380c27c3cfbc6af2d97d69bd4f57bf9e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 25 Nov 2018 15:15:23 +0000 (16:15 +0100)]
Bind invoker method handle to constructor
We only ever pass the constructor method handle to the invoker,
hence we can make this a constant by binding the invoker handle
to the constructor -- saving us a field.
Change-Id: I547f7eac202389aa0f7308266b2f3a451a2f83a3
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 23 Nov 2018 13:26:30 +0000 (14:26 +0100)]
Bump yangtools to 2.1.4
This release brings about ImmutableMapTemplate, which we'll use
to improve IdentifiableItemCodec.
Change-Id: I2a873d7987fd77f03213a744ae5a75d094e4d96f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Jie Han [Thu, 22 Nov 2018 11:51:37 +0000 (19:51 +0800)]
Clean up pom of mdsal-binding-test-model a bit
- Remove duplicated dependecy and exclution.
- Enable spotbugs
Change-Id: I9bcd76d7fcf1ae1447bbf4f0b698f6f24bc24279
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Robert Varga [Fri, 2 Nov 2018 21:17:39 +0000 (22:17 +0100)]
Update WriteOperations/TypedTransaction API design
Overloading merge/put methods with a boolean prevents a quick
identification of users of costly operations. Moreover, the
documentation (and contract) does not completely reflect behaviour
as all purely-structural elements undergo automatic lifecycle:
for example non-presence containers are created as needed and
removed when they are no longer needed.
Update the design by deprecating boolean-taking methods in favor
of mergeParentStructureAnd{Merge,Put}, which are now implemented
as defaults. This will allow us to migrate users first and then
remove those methods in 4.0.0 timeframe.
Also update documentation to discourage the use of these methods,
as they have significant performance cost.
JIRA: MDSAL-382
Change-Id: I878863797dab01a1adfa2164a0ab0583b0641163
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 16 Nov 2018 11:31:15 +0000 (12:31 +0100)]
Fix InterfaceGenerator confusion with RPC method names
The refactor in method generation has caused a regression where
we erroneously mark RPC methods with @Nullable. Fix this by checking
that the method has zero arguments.
JIRA: MDSAL-18
Change-Id: Id497eb0a7954ee85c9c22919dd3fa814dd788d5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 18 Nov 2018 20:12:08 +0000 (21:12 +0100)]
Optimize single-property ClassTemplate hashCode()
When we have a single property, it does not make sense to generate
anything aside from delegation to the field, without any additional
arithmetic.
While this changes hashCode() results, these are still consistent
and for bonus points save ourselves some amount of bytecode and make
concentrate some common template code.
JIRA: MDSAL-400
Change-Id: I2035acd30d7c9653fcf7d9af4abcad9032ab795c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 16 Nov 2018 09:20:45 +0000 (10:20 +0100)]
Index nonnull/getter methods by String
Looking up by String offers slight advantage over Method lookup,
because we'll end up with a constant hashCode() over objects which
are guaranteed to be interned.
This rework implies we no longer get to have a map whose keySet
reflects property methods -- which is fine, as the keyset would
take up more memory than a plain array, so we retain the methods
in an array -- hence this ends up being a net win in both cases.
Furthermore it flushes out the fact that nonnull methods should
not really cache their result -- for example if the user performs
a nonnull() access and then runs hashCode(), we'll end up performing
two decodes, as nonnull() cache will not be picked up by hashCode().
We therefore construct nonnull->getter String map, which we consult
on nonnull accesses and only wrap it without caching. This has
the benefit of keeping the cache smaller while maintaining its
effectiveness.
JIRA: MDSAL-398
Change-Id: I36526ce15735d4ef8e4ba847bcc24ea69b950e94
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 18 Nov 2018 20:58:17 +0000 (21:58 +0100)]
Do not box result twice
result is an int while both cache and return type are Integer,
instantiate a local variable to hold the boxed value so we not
box twice.
Change-Id: I659b60b40d0d1dfa1eee25d214af4a096bf3e60e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 14 Nov 2018 15:40:29 +0000 (16:40 +0100)]
Use ImmutableMaps for lazy augmentations initialization
Rather than tracking lookups in two separate ConcurrentMaps, we
perform locked atomic updates in copy-on-write immutable structure.
The two lookup maps are kept in ImmutableMaps, which offer tighter
packing and do not incur any further volatile reads beyond getting
a reference to them.
This results in lower memory overhead, as the maps are more tightly
packed and also biases performance towards the dominant use case,
which is pure lookups.
JIRA: MDSAL-391
Change-Id: I65ecb25a5d364040be44df144000d1bbbc2a922e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 16 Nov 2018 07:15:42 +0000 (08:15 +0100)]
Index cached data by method name
Method.hashCode() is not a constant, whereas String.hashCode() is
pre-computed (for interned Strings). As Method.getName() is guaranteed
to be interned and getters have zero arguments, a method's name
is enough to uniquely identify the corresponding piece of data.
Therefore use Method.getName() to index cachedData.
Change-Id: Ie9fec477bd7346042e3700695588bc526fd56dac
JIRA: MDSAL-398
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 16 Nov 2018 06:51:27 +0000 (07:51 +0100)]
Switch on method names
Method names are guarateed to be interned by the JVM, hence their
hashCode is O(1) -- making them a prime target for a switch statement,
which side-steps the need to run String.equals() slow path most of
the time.
JIRA: MDSAL-398
Change-Id: Ie57c2f9fd8c3757ec08e1be945b08d66ebbcff4e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 16 Nov 2018 06:47:39 +0000 (07:47 +0100)]
Switch on parameterCount
The else case here assumes parameterCount being 1, make that explicit,
resulting in cleaner code.
JIRA: MDSAL-398
Change-Id: Ie3fa47de6b1630e98a426da69bb6c6d2b6b4b026
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 16 Nov 2018 06:38:51 +0000 (07:38 +0100)]
Use Method.getParameterCount()
Java 8 introduced this method, which bypasses array cloning done
by getParameterTypes(), making it more efficient. Take advantage
of it.
JIRA: MDSAL-398
Change-Id: Id5d4972ba20d63a8ff79e4adbdf6d2adbfce0b87
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 16 Nov 2018 06:34:37 +0000 (07:34 +0100)]
Define getImplementedInterface name in BindingMapping
This moves the definition from LazyDataObject to a common place,
so we have one place which defines it. Also remove unused Throwable
declaration.
Change-Id: Icfbc861419fca3b207e9aebfc2b00ddf8a1fc38f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
han [Wed, 10 Oct 2018 02:55:13 +0000 (10:55 +0800)]
Fixup lookup of DOMDataTreePrefixTableEntry
- Make sure to return the entry with value present.
Change-Id: Ib37def7a8593516e1623ca0b1b34ef997790c754
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Robert Varga [Tue, 13 Nov 2018 14:13:41 +0000 (15:13 +0100)]
Cache mismatched augmentations
Address a FIXME around caching of mismatched augmentations, as it
seems openflowplugin is doing this on purpose.
The cache is expected to be needed infrequently in terms of associated
objects as well as modified infrequently, hence we use a space-efficient
ImmutableMap.
JIRA: MDSAL-388
Change-Id: Id86d8c713ee1014d9d4867558032ba3ccd51fc45
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 13 Nov 2018 18:18:30 +0000 (19:18 +0100)]
Introduce ReadOperations.exists()
This method exists in the DOM API, but for some reason it was left
out if the Binding API. Introduce it as default methods riding on
the read() method and override them in all known implementations,
so the request is efficiently routed.
Change-Id: Id56332d6f720396305ac68e40554e62fd17c34fb
JIRA: MDSAL-389
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Nov 2018 15:27:49 +0000 (16:27 +0100)]
Generate nonnull default wrappers for list getters
This adds the knowledge about default methods to BindingMapping,
templates and CodeHelpers, so that whenever we emit a List accessor
(getFoo) we also emit a corresponding nonnull accessor (nonnullFoo).
The nonnull accessor is a default method, which takes invokes
getFoo() and runs it through CodeHelper.nonnull(), which turns
nulls into empty lists.
JIRA: MDSAL-18
Change-Id: Ic4fc80aa071b7d5b93bf49d1de44855f4bd820f2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Nov 2018 11:18:17 +0000 (12:18 +0100)]
Move getter method naming to BindingMapping
Both BaseTemplate.isAccessor() and a chunk of
AbstractTypeGenerator.getterMethodName() should actually be held
in BindingMapping, so we retain consistent naming of things.
This patch introduces the constants necessary for this to work
and migrates the code there. This cascades to various other places,
like mdsal-binding-dom-codec, where we extract copy&pasted code
to a common utility class.
JIRA: MDSAL-18
Change-Id: I5fb285f00658ce81f60890d03844b51e19bd4a40
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Nov 2018 09:49:32 +0000 (10:49 +0100)]
Revert "Add DataObjectUtils"
This reverts commit
0ef76ead8ed2d4af93e0d8cac92b67d087354057 in
preparation for a more proper solution.
JIRA: MDSAL-18
Change-Id: I96b89867e5a324327eb77cdde018700456fc4bbc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 12 Nov 2018 08:45:00 +0000 (09:45 +0100)]
WADL/Documentations generators should use BuildContextAware
We should not be hard-wiring to DefaultBuildContext, but rather
pick it up from yang-maven-plugin.
Change-Id: I56a6f23698e450f31087bff76e911bef0f5819cd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Jie Han [Mon, 5 Nov 2018 09:33:42 +0000 (17:33 +0800)]
Provide iana-if-type based on RFC8343
- Current iana-if-type artifact is tied to RFC7223,
meaning the code generated within it is not usable with RFC8343.
Provide an alternative artifact, which is bound to RFC8343.
JIRA: MDSAL-381
Change-Id: Ia2089010fca472dfa499b97cc0ac3c6c420b0431
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Robert Varga [Thu, 8 Nov 2018 14:09:49 +0000 (15:09 +0100)]
Prevent NPE from being propagated from LazyDataObject
Rather than incurring a NPE when we fail to find proper
NodeContextSupplier, add an explicit verifyNotNull() check to
throw a more explanatory VerifyException.
Change-Id: Ieed6d050bccfe482f69152b33a9a84bbe20037c2
JIRA: MDSAL-18
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Nov 2018 14:01:07 +0000 (15:01 +0100)]
Refactor DataObjectCodecContext.getBindingChildValue()
Using instanceof checks is an OOP anti-pattern, which we do not
want here anyways. Generalize NodeCodecContext.defaultObject()
to return null by default and refactor decoding to rely on it,
with LeafNodeCodecContext returning whatever it has as a default
value.
Change-Id: I2b58bc7f1a16496cf6bc93fd7a33aec38f864597
JIRA: MDSAL-18
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 7 Nov 2018 23:31:14 +0000 (00:31 +0100)]
Separate out DOMDataTree{Read,Write}Transactions
DOMDataTreeReadWriteTransaction.close() does not make sense
in presence of DOMDataTreeReadWriteTransaction.cancel().
Split out both operation sets, so ReadWriteTransaction can eventually
become a WriteTransaction which also has ReadOperations.
Make DOMDataTreeReadWriteTransaction.close() a default method, which
defers processing to cancel() and remove its other implementations
-- some of which were completely broken.
Change-Id: Ib45e3e0d17ae2be591915fa618d5b468ec0c89e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Jakub Morvay [Thu, 8 Nov 2018 09:59:08 +0000 (10:59 +0100)]
Remove redundant public modifier
public modifier is redundant for inner interfaces. Remove it from
DOMMountPointService DOMMountPointBuilder inner interface definition.
Change-Id: I2a370750636d9307b45adbef44ec5c5eb37c28b6
Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
Jakub Morvay [Thu, 8 Nov 2018 09:41:30 +0000 (10:41 +0100)]
Deprecate leak methods in DOMMountPointServiceImpl
This deprecates DOMMountPointServiceImpl registerMountPoint() and
unregisterMountPoint() methods as they are leaks and should never have
been exposed publicly.
Change-Id: Iba5a270d15ca882eb08372f1f6911af55d298f8d
Signed-off-by: Jakub Morvay <jmorvay@frinx.io>
Robert Varga [Thu, 8 Nov 2018 00:04:48 +0000 (01:04 +0100)]
Cleanup ShardedDOMWriteTransactionAdapter
Move field initialization and add annotations.
Change-Id: If9548e02144e9c1ae9488bdb1854b2946af4da30
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 8 Nov 2018 00:00:06 +0000 (01:00 +0100)]
Update FastThreadPoolExecutor instantiation
This forwards logger identity to the executor, so its entries
are properly accounted for.
Change-Id: I996d9d51742c8c870e1ef5a48ad9cf8627f289be
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 7 Nov 2018 23:54:50 +0000 (00:54 +0100)]
Cleanup ScanningSchemaContext
This adds a few aesthetic improvements, killing some superfluous
operations.
Change-Id: Ibd4c45c9e5df91852fc7aa392ba34d3fd0c3fb52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 7 Nov 2018 23:43:15 +0000 (00:43 +0100)]
Cleanup PingPongDataBroker
This cleans up annotations and various aesthetics in pingpong, not
changing anything, really.
Change-Id: Ib86bff9df8cae3e5d48edc4f0c42770a207d8812
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 7 Nov 2018 23:42:02 +0000 (00:42 +0100)]
Cleanup ShardedDOMTransactionChainAdapter
Inner classes have incorrect structure and can be final, fix that
and also eliminate the need to verifyNotNull().
Change-Id: I68a68f69e6e7e7f442783858dfd719e7ca374bfb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 7 Nov 2018 20:48:17 +0000 (21:48 +0100)]
Bump yangtools to 2.1.3
This adopts yangtools-2.1.3.
Change-Id: I6c67a060fa24d06553c6b6076acfa85f6f35718e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 7 Nov 2018 22:03:40 +0000 (23:03 +0100)]
Rework lookup to eliminate the need for checkArgument()
SpotBugs is twitchy around this, let's rework it to make
the precondition unnecessary.
Change-Id: I2083877c1c6b263b6c9d8368cd8f3fb746bbc6d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Tue, 6 Nov 2018 16:08:35 +0000 (17:08 +0100)]
Fix AbstractTypeMember toString()
It shouldn't reference MethodSignatureImpl.
Change-Id: I20c44fe66b76daa5fb8ccd51485e57c1da0e932c
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Mon, 5 Nov 2018 15:27:45 +0000 (16:27 +0100)]
Cache reflection operations in AbstractSchemaAwareTest
The design of AbstractSchemaAwareTest requires reflection-based
loading of SchemaContext for each test case, which is slow.
Instantiate weak caches to speed up tests which are co-located
on the same class loader.
Change-Id: I1a79d7e99f6efcccab37445f3de25a74cb6f02b6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 4 Nov 2018 18:31:16 +0000 (19:31 +0100)]
Do not issue empty list merges
List nodes undergo atomatic lifecycle, i.e. they are created
as needed. This means we do issue an empty merge when a list
entry is written from binding -- reducing the number of operations
issued in typical operation.
Also mark BindingToNormalizedNodeCodec.getDefaultNodeFor() as
deprecated, because it should never have been public in the first
place.
JIRA: MDSAL-383
Change-Id: Ie41dbd9d238990f3e136043b87d002bf55557501
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 4 Nov 2018 21:23:15 +0000 (22:23 +0100)]
Fix a few eclipse warnings
This fixes:
- unneeded else statements
- unnecessary use of a raw type
- generic argument shadowing
Change-Id: Ifd3a83a57a9300a4b3b01ddf93facc892c01bb52
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 4 Nov 2018 17:29:48 +0000 (18:29 +0100)]
Refactor write tracking implementation
Rather than duplicating code which wraps a package-internal class,
provide a subclass hook in TypedWriteTransactionImpl, so that it
write-tracking defaults to no-op and is optionally wrapped.
This removes a lot of duplicated code, making the result equally
performant and more maintainable. It also removes the need to leak
TypedWriteTransactionImpl.delegate to the package and tracking
them in two fields.
Change-Id: I636818f0048090c145e6fabba198238dad1e6922
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 4 Nov 2018 15:22:42 +0000 (16:22 +0100)]
Hide TypedTransaction.datastoreType
This field has a proper accessor, hence we do not need to make
it package-private. Also shorten local variable name used in cast
so we lower verbosity.
Change-Id: Ifd0e83217996f0d14fb84ba42c53b879c68f3b1c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 4 Nov 2018 15:16:02 +0000 (16:16 +0100)]
Fix warnings in TransactionAdapter
Using a private constructor forces a synthetic accessor being
created, hence make nested class constructors package-private,
eliminating the need to suppress warnings.
Also rename generic arguments so as not to clash with method
generics used in the interface being implemented.
Finally add proper generic arguments, so we eliminate raw type
warnings.
Change-Id: I9ec2bf6b377eed26fd11896e84c99fa8922f4abf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 19 Oct 2018 12:42:06 +0000 (14:42 +0200)]
Add DataObjectUtils
Add DataObjectUtils.nullToEmpty(List), which is useful when dealing
with nullable lists being returned from binding DTOs. This also moves
mdsal.binding.spec.util to yang-binding, so the utilities are
available to all model users.
Change-Id: I681c49141b4e880448747a53d749065208f9aca1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 31 Oct 2018 08:49:16 +0000 (09:49 +0100)]
Add @NonNull annotation to LazyDataTreeModification
This fixes a couple of eclipse warnings and makes the code a bit
more dense.
Change-Id: Iab34963d54a6ee0f38a05e327c00c202ea9bf3b9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Oct 2018 09:12:50 +0000 (11:12 +0200)]
Reduce use of javax.annotation annotations
The annotations in use have runtime retention, which triggers
generation of import-package for javax.annotation, which is no longer
satisfied with newer JDKs.
Use JDT @Nullable annotation instead. Since @Nullable is TYPE_USE
annotation, this also requires a bit of juggling in JavaFileTemplate
to make it work correctly with types which end up being referenced
via their FQCN.
This still retains javax.annotation.CheckReturnValue, but marks it
for replacement once we decide where to go annotation-wise.
JIRA: MDSAL-372
Change-Id: I792094d3c07162a5f8e6ca82ceea3a75b48c7b6e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
han [Thu, 18 Oct 2018 03:08:34 +0000 (11:08 +0800)]
Report non-present initial data in (DOM)DataTreeChangeListener
Add a default method 'onInitialData' with no-op in
DOMDataTreeChangeListener', which would be invoked only once during
registration of the listener if there was no data in the conceptual
data tree for the supplied path, which was used to register this
listener, and after this 'onDataTreeChanged' would always be
invoked for data changes.
Users not caring about this event could leave it as default with no-op.
JIRA: MDSAL-217
Change-Id: I3a2c02c76b8c37ac7624dd1646692bd783a3468d
Signed-off-by: Jie Han <han.jie@zte.com.cn>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Mon, 29 Oct 2018 15:35:55 +0000 (16:35 +0100)]
Add missing @Beta annotations for managed txes
ManagedTransactionRunner is marked @Beta, but the related interfaces
ManagedTransactionFactory and ManagedTransactionChain aren’t. This
patch fixes that; hopefully it’s acceptable for a patch release...
Change-Id: I1d67551ae8bba12b515b31e0611bb5b713d20644
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Stephen Kitt [Tue, 8 Aug 2017 12:55:11 +0000 (14:55 +0200)]
Use equals() in AssertDataObjects
Currently, AssertDataObjects.assertEqualBeans() relies entirely on
XtendBeans’ conversions; but what we really want to test is the
equals() implementations — XtendBeans is helpful to produce errors
which are easier to understand and act upon.
This patch tests the beans using equals() first, and only uses
XtendBeans to produce an error message. It also catches cases where
equals() fails but the XtendBeans-generated representations are
equal.
Change-Id: I8412609c54795b3d7c27001f01d3df281203bb78
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Mon, 15 Oct 2018 12:44:48 +0000 (14:44 +0200)]
Try harder to acquire class mapping
We can perform a third try when we failed to load an augmentation
using TCCL by installing the candidate class classloader as the TCCL.
This can help in situations where we are invoked from a context where
the TCCL is not set up to actually see binding classes properly.
JIRA: MDSAL-379
Change-Id: I56d65494cbce32aee0592e3f0799a2bf283e6d17
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 13 Oct 2018 09:35:56 +0000 (11:35 +0200)]
Relax LazyDataObject.augmentations() implementation
We use double-checked locking to guard against concurrent
initialization of cachedAugmentations. While this ensures we do
not do the same work twice, it is a bit costly for the typical
case when the augmentations field is accessed once.
During the first call, we perform:
- a volatile read
- a lock acquire
- a volatile read
- compute the value (exclusive)
- a volatile write
- a lock release
Rather than doing that, allow the value to be computed concurrently
and use compare-and-swap to initialize it. Hence for the first call
we perform:
- a volatile read
- compute the value (concurrent)
- a compare-and-set
In case of concurrent initialization, all threads will compute
the value, but all except the first one will issue another volatile
read and throw their work away.
JIRA: MDSAL-377
Change-Id: I1dbf9c4e60cf9800720eea31bd9de936b1dae5aa
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 15 Oct 2018 10:22:09 +0000 (12:22 +0200)]
Speed up DataObjectCodecContext instantiation
Do not bounce multiple times to bindingClass(), but rather store
it in a local variable. Since we are here, also update other callers
of bindingClass().
Change-Id: Ia093d5dbdff16f6ec17f96c71895cb292eb12862
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 15 Oct 2018 09:00:12 +0000 (11:00 +0200)]
Do not instantiate entrySet when not needed
reloadAllAugmentations() does not need the key, hence we do not
need to instantiate entrySet(), values() is sufficient.
Change-Id: Ib58b5fac547370709ab916ca5f700bc4b841efb8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 14 Oct 2018 00:07:07 +0000 (02:07 +0200)]
Shorten java.util.Optional reference
All of our codebase is using JDK Optionals, hence we need not use
a FQCN.
Change-Id: Ib6b4fba3e8021fce4d238f8db84db32ac5bf746c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 13 Oct 2018 12:55:53 +0000 (14:55 +0200)]
Bump versions for 3.0.2-SNAPSHOT
This starts the next version development.
Change-Id: Ia3e479b1d364d6f92e7ff8405ada398c342227a6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 13 Oct 2018 12:52:30 +0000 (14:52 +0200)]
Bump yangtools to 2.1.2
This propagates the released version.
Change-Id: I404e82dcb0aa6102ef00fb1ee65cbbf7aa8f821a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 13 Oct 2018 08:54:39 +0000 (10:54 +0200)]
Optimize AbstractBuilderTemplate key property sort
Rather than using a lambda for each comparison, create a constant
Comparator and reuse it.
Change-Id: I0b5af97b485f65924adb2de369a69e03027af887
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 13 Oct 2018 08:08:42 +0000 (10:08 +0200)]
Optimize AbstractBuilderTemplate.generateAugmentField()
This moves the "private" field to its sole caller, eliminating
the need for a redundant IF. Also cache the importedName result
so we do not make multiple round-trips to cache.
Change-Id: I31bd9ffe51e6820d6b4b22f489ed0fbaf9dd1192
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 13 Oct 2018 08:38:32 +0000 (10:38 +0200)]
Use ArrayList.sort() instead of Collections.sort()
We do not need Collections, as we have Java 8 and hence can
directly use List.sort(). This has the side-effect of
short-circuiting to ArrayList's implementation.
Change-Id: If978265242275014c586fcf92d96d5ba09bb7bca
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sat, 13 Oct 2018 08:28:34 +0000 (10:28 +0200)]
Builder should acquire augmentations only once
While generated DataObjects have this method simple, LazyDataObject
constructs the map lazily and caches it -- hence additional access
is forcing an additional volatile read.
Therefore instead of invoking augmentations() twice, store its
result in a local variable and reuse that.
Change-Id: Ifbe2002bb7edbd253d65b5bdc1e53c4d687bed32
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 12 Oct 2018 12:31:54 +0000 (14:31 +0200)]
Bump yangtools to 2.1.2-SNAPSHOT
Preparatory patch to get validation of upcoming yangtools release.
Change-Id: Iaf6f4371216a85639d8f12089d69ca7c94b8822a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Thu, 11 Oct 2018 13:44:52 +0000 (15:44 +0200)]
Fix infinite recursion in ForwardingWriteTransaction
put() calls itself instead of delegating. This patch fixes that.
Change-Id: I4d42bbae0952e12f17ddfd46ad08cf06e746cf70
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Stephen Kitt [Thu, 11 Oct 2018 13:55:46 +0000 (15:55 +0200)]
Avoid StringBuilder's char constructor
Passing a char to StringBuilder's constructor is interpreted as
setting the initial capacity, not providing the initial content. This
was already accounted for; so this patch removes the char arguments
since they only end up being confusing.
Change-Id: Ic7b1281174e0faec891cb96dd89e0d4aa4ced670
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Thu, 11 Oct 2018 19:50:03 +0000 (21:50 +0200)]
Enable spotbugs in mdsal-binding-generator-impl
This patch fixes up violations and flips enforcement.
Change-Id: Ifc823e7bdc64b5d798f59b87b12a68f44f42af51
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 19:35:21 +0000 (21:35 +0200)]
Enable spotbugs in mdsal-binding-dom-adapter
This fixes up the issues reported and flips enforcement to on.
Change-Id: I50525331b45f556eae0840fbc8e3459fc903d9dd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 19:13:53 +0000 (21:13 +0200)]
Enable spotbugs in mdsal-binding-dom-codec
This fixes up the issues reported and flips enforcement to on.
Change-Id: I7e5b5c20a8b9f1ce3de42aac512ac3b31779821f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 18:57:37 +0000 (20:57 +0200)]
Enable spotbugs in mdsal-binding-dom-codec-osgi
This fixes up the issues reported and flips enforcement to on.
Change-Id: Ia58b4f08fb1b594446cec458268586db8df8d62c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 18:49:01 +0000 (20:49 +0200)]
Enable spotbugs in yang-binding
This fixes up the issues reported and flips enforcement to on.
Change-Id: I2e9b0c82af063d322428216be40e7562959f0824
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 18:43:43 +0000 (20:43 +0200)]
Enable spotbugs in mdsal-binding-generator-util
This fixes up the issues reported and flips enforcement to on.
Change-Id: I2f9d96aff277864f7e1edc1be69d45610947a250
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 18:32:36 +0000 (20:32 +0200)]
Enable mdsal-binding-generator-api spotbugs
This just flips enforcement to on.
Change-Id: I7fac526f853d156ff6c8d2c60433944f7670b9d6
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 18:31:02 +0000 (20:31 +0200)]
Enable spotbugs in mdsal-binding-spec-util
This fixes up the issues reported and flips enforcement to on.
Change-Id: I24d7722143253cc4c16cfac6f6d38976741ee6b2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 18:11:52 +0000 (20:11 +0200)]
Enable mdsal-binding-util spotbugs
This just flips enforcement to on.
Change-Id: I53d63c44e27a52d152535a0218d4b83f2ee35f59
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 18:08:51 +0000 (20:08 +0200)]
Enable spotbugs in entity-ownership-service
This fixes up the issues reported and flips enforcement to on.
Change-Id: Ifd8201eb6ad60c133559bc29b40fda487f4d2c5e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 15:38:26 +0000 (17:38 +0200)]
Fix checkstyle in mdsal-binding-java-api-generator
This fixes violations and flips enforcement on.
Change-Id: I08d96c67c0d072655529ed9890b85ca1c4e7059f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 17:49:59 +0000 (19:49 +0200)]
Enable spotbugs in singleton-service
This fixes up the issues reported and flips enforcement to on.
Change-Id: If2c1b8214a552f791eda8c68da12cafd59ad6a10
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 17:43:26 +0000 (19:43 +0200)]
Enable mdsal-dom-inmemory-datastore spotbugs
This fixes up the issues reported and flips enforcement to on.
Change-Id: Ic475fd76d3449c2ab165b2e5da41b693edb3cb8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 17:34:28 +0000 (19:34 +0200)]
Enable mdsal-dom-schema-service-osgi spotbugs
This just flips enforcement to on.
Change-Id: I3a3495d3442c6231e9fc25dc7d9ffab099bc75f4
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 16:42:48 +0000 (18:42 +0200)]
Enable mdsal-dom-broker spotbugs
This fixes up the issues reported and flips enforcement to on.
Change-Id: Iae6de422f027e6413b4e3021d4324b051f41a513
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 16:35:50 +0000 (18:35 +0200)]
Switch mdsal-binding-test-utils to spotbugs
This changes from findbugs to spotbugs.
Change-Id: I4f59b2ee72e593ac26d8f91fa3802d3ef87e6994
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 15:33:38 +0000 (17:33 +0200)]
Fix checkstyle in mdsal-binding-util-tests
This fixes a single violation and flips enforcement on.
Change-Id: I9b5aca10dc74f540d98fa4dca5db08b888ef4f8b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 13:39:22 +0000 (15:39 +0200)]
Fix checkstyle in mdsal-binding-generator-impl
This fixes violations and flips enforcement on.
Change-Id: Ida4e62f4c3ddf4d7d8066f3858e6ab98f0f92cf1
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 12:31:01 +0000 (14:31 +0200)]
Fix checkstyle in mdsal-binding-generator-util
This fixes violations and flips enforcement on.
Change-Id: Ibc12e6595498c4349695d62bcd74f3d126f4b8e7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 12:20:03 +0000 (14:20 +0200)]
Enable checkstyle in mdsal-binding-util
This fixes a few violations and flips enforcement on.
Change-Id: I6b0de1511bda6ad509991f343c2a456ba67866d7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 12:13:39 +0000 (14:13 +0200)]
Enable checkstyle in mdsal-binding-spec-util
This flips enforcement on.
Change-Id: I8e3db62a29d21fe727b1c31b0c3982b42eb58444
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 12:09:40 +0000 (14:09 +0200)]
Enable checkstyle in mdsal-binding-generator-api
This fixes a few violations and flips enforcement on.
Change-Id: Id55c011e8a7f5e85e678aefe793e6aba585ee083
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 11 Oct 2018 11:43:13 +0000 (13:43 +0200)]
Enable checkstyle in mdsal-dom-schema-service-osgi
This fixes a few violations and flips enforcement on.
Change-Id: I336e1624564f9f41c62f96294ebf5c9ef0ca839c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Thu, 11 Oct 2018 09:58:14 +0000 (11:58 +0200)]
Remove redundant string operations
* use StringBuilder::append to extract substrings directly;
* split combined append/concatenation into multiple append calls;
* use "" instead of new String();
* remove a couple of unnecessary toString() calls.
Change-Id: If09efe90d756c3b1faf30c27eb94d514593a4861
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 10 Oct 2018 17:43:41 +0000 (19:43 +0200)]
Separate out builder/impl copy generators
Builders are taking an immutable implementation of target type,
hence for list entries they can rely on the key to be present and
do not have to check it. Implementations need to account
for the builder key being set to null, hence they need to
instantiate the key themselves.
This patch separates the two code paths, so both cases are properly
expressed in the object hierarchy. This allows us to simplify
the abstract template, removing weird boolean-based decisions.
We also promote implementation constructor to package-visible, which
allows javac to skip generation of synthetic accessor.
We further optimize the template output by capturing importedNames
when they are reused -- leading to xtend generating cleaner Java code.
JIRA: MDSAL-374
Change-Id: I3274e35780b8e6a56d470caf80459e9e115a5374
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 10 Oct 2018 23:15:57 +0000 (01:15 +0200)]
Add feature-parent
This adds a utility parent (useful for downstreams, too),
which adds the mdsal imports.
Change-Id: If1bdad409b08a3f7cc47852b73439b18b1e07936
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 10 Oct 2018 23:13:44 +0000 (01:13 +0200)]
Remove project.groupId use
Having explicit groupId make things more explicit, making it a wee
bit more navigable between mdsal proper and models.
Change-Id: Ib7cce538930b51268e960cf27f4cbd8dbbec9793
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Stephen Kitt [Tue, 9 Oct 2018 14:21:50 +0000 (16:21 +0200)]
Use properties to skip deploy/install
odlparent-lite recognises maven.deploy.skip and maven.install.skip to
skip the deploy and install plugins, use those instead of re-declaring
the plugins.
Change-Id: I5cd645fe810b54e018abdb2f12487037ba3b01d8
Signed-off-by: Stephen Kitt <skitt@redhat.com>
Robert Varga [Mon, 8 Oct 2018 17:52:21 +0000 (19:52 +0200)]
Sort out BindingCodecTreeNode.streamChild() nullness
This method really cannot return null, which means there is some
dead code in DataContainerCodecContext. Remove the FIXME and kill
the superfluous code.
Change-Id: I7ee3e86b10e1ad2ccc5cfaa4aad228654b1445c5
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Oct 2018 17:29:20 +0000 (19:29 +0200)]
Fixup null warnings reported by eclipse
JDT annotations are flushing out some lazyness in tests, fix that
up by throwing UnsupportedOperationExceptions and proper mocking
in most places.
Change-Id: I2374a368e4a361c0e58d61e4b563f98036b4c540
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 8 Oct 2018 13:12:08 +0000 (15:12 +0200)]
Migrate mdsal-binding-dom-codec to JDT annotations
This removes the use of javax.annotation nullable annotations
to remove import-package.
Change-Id: I436b9f0d0b3c835fce9da9e4c99e4dad273f9bbe
JIRA: MDSAL-373
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 9 Oct 2018 12:59:31 +0000 (14:59 +0200)]
Override scala-lang to 2.11.12
In order to build with JDK10, we need to make sure we pull in
the latest 2.11.x scala.
Change-Id: Iccea3ffebed11580fc7ad108f5988a88e0e7a597
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>