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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Robert Varga [Fri, 27 Sep 2019 14:09:20 +0000 (16:09 +0200)]
Fix references to Any{Data,Xml}SchemaNode
This is a follow-up for renames of AnyXmlSchemaNode and
AnyDataSchemaNode.
Change-Id: I63f9ae94b1bc3fc72385b4ad947a16803d959d0c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 27 Sep 2019 14:05:20 +0000 (16:05 +0200)]
Adjust for AnyXmlNode changing its name
This is a follow-up patch to adjust uses of AnyXmlNode to either
AnyxmlNode or DOMSourceAnyxmlNode.
Change-Id: I98be4147b6515ab939dc9113d4b80c0a589786d0
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 24 Sep 2019 07:43:06 +0000 (09:43 +0200)]
Bump odlparent to 6.0.0
This switches to using a released version of odlparent.
Change-Id: Ia28c3bd0f87de01a993e6811e46012e6aa848383
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 22 Sep 2019 02:12:42 +0000 (04:12 +0200)]
Revert "Do not emit empty lists to NormalizedNodes"
This reverts commit
cbe6a8cafaec862f2a918ecc9af99720090d3c8a,
as it is breaing DTO behavior applications explicitly depend on.
The issue cannot be fixed without touching templates, i.e. requires
complete implementation of MDSAL-449.
JIRA: MDSAL-456
Change-Id: I07baf3a7be3867c6bee1b66a05b013ee0ba5171f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 6 Aug 2019 15:48:56 +0000 (17:48 +0200)]
Fix space stripping
This fixes the coded intended to strip leading/trailing spaces
from the line builder. This was ineffective due to how xtend
compares char-to-String and would not work anyway, as the stripping
was done in wrong order.
Change-Id: I119ed55492da17355e3f3137dcbb8862259dc44f
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 15 Sep 2019 18:47:23 +0000 (20:47 +0200)]
Force ReadOperations (and TypedReadTransaction) to be implemented
This removes the default implementation, forcing all implementations
to consider this method.
Change-Id: I1f7c9f0a66a5b4c9f95d8f1f9f82691df8a70515
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Sun, 15 Sep 2019 10:11:14 +0000 (12:11 +0200)]
Remove superfluous @NonNull annotation
MoreObjects.toStringHelper() is not tagged properly, hence generated
toString() methods generate a ton of nullness warnings. Fix that up
by removing the annotation (to mirror what we are otherwise doing
in other methods).
Change-Id: Ib4fc3d3fdd3fab1e5fb257f3e85c344999d6eb1a
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 13 Sep 2019 15:56:18 +0000 (17:56 +0200)]
Force BindingNormalizedNodeSerializers to deal with event instant
This is a bit of public API, which was retrofitted. Now make the
eventInstant-aware method mandatory-to-implement.
Change-Id: I9b9287bd62dc2c1ca789e0bc112a92e499ffd246
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 13 Sep 2019 15:52:22 +0000 (17:52 +0200)]
Make BindingCodecTree.getIdentityCodec() non-default
We want this method implemented, hence make it non-default.
Change-Id: I5fbd6a0685eb508c42d63dce69d716e5efaa4912
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 20:03:17 +0000 (22:03 +0200)]
Remove yang.binding.annotations.(Module)QName
These annotations are scope=runtime and are not used anywhere.
Furthermore they require refection access to classses, so just don't
bother.
Change-Id: Icb23fd1ffbd6ebc18e722ba6f0bff9109db5f356
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 10 Sep 2019 12:29:20 +0000 (14:29 +0200)]
Use String.repeat() instead of Strings.repeat()
Java 11 gives us this neat utility, use it instead of Guava, as it
is coder-aware and does not need to go through 'char'.
Change-Id: I669ddd5e2376d28297695a5f751ec83ff50f7d96
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Sep 2019 13:11:38 +0000 (15:11 +0200)]
Generate legacy value contructors for all classes
This expands legacy constructor compatibility to also include
Key classes, not only value wrappers. The codegen parts is relatively
straightforward.
IdentitiableItemCodec is coded on the assumption there are only
two constructors -- one copy and one all-value, which is now violated.
Hence we update IdentifiableItemCodec to also ignore any constructors
which are marked as deprecated.
JIRA: MDSAL-330
Change-Id: Ie23ba8b3788b320b2d11e263c9af228b4c2e41a9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Sep 2019 12:25:28 +0000 (14:25 +0200)]
Make BaseTemplate.asArguments() take a Collection
This side-steps the need for IterableExtensions, make the code
a tad faster.
Change-Id: I210d4da343bdae82b81dbb0fd30c6d8ed7d6c13e
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Sep 2019 10:05:57 +0000 (12:05 +0200)]
Remove use of new Integer(String)
This constructor has been deprecated in Java 9, migrate to
Integer.valueOf(String) instead.
Change-Id: I5b6dfe27502408bab9ae2f2453dd1a713c00b6bd
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Sep 2019 10:00:15 +0000 (12:00 +0200)]
Make BaseTemplate.fieldName() return String
Java 9+ has very efficient string concatenations, hence we can
use them. This allows us to better bind to to StringConcatenation,
as we'll end up wired to .append(String) rather than .append(Object),
as would be the case with CharSequences.
Change-Id: I2a93139c1b1af8b4c335aa4a4cb8a68bd76acb95
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Thu, 5 Sep 2019 09:38:22 +0000 (11:38 +0200)]
Add migration setter @return javadoc
This mitigates a warning emitted by javadoc.
JIRA: MDSAL-330
Change-Id: Ic3aa1cc517d7a5d0f3e460d9c1ca353450ae4c66
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 14:57:10 +0000 (16:57 +0200)]
Generate compatibility constructors for Uint wrapped types
We already are generating compatibility setters, this extends this
capability to wrapper classes (i.e. their constructors). As usual
the compatibility code is marked as deprecated for removal.
Also fixes some code formatting issues introduces in previous
patches.
JIRA: MDSAL-330
Change-Id: I0b2db136c27c26de33f8a756292dde4cdf53bebb
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 14:03:48 +0000 (16:03 +0200)]
Separate all-values constructor from typedef constructor
ClassTemplate.allValuesContructor() is actually two separate
templates, which is obfuscated by a number of checks. This patch
splits them out, eliminating the need for multiple checks for
the same thing.
JIRA: MDSAL-330
Change-Id: I298299ffe126fe5f51dc9c2776f46245eb0ce563
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 14:24:01 +0000 (16:24 +0200)]
Optimize array checks
Rather than bouncing through .importedName().contains("[]"), we
can make this check through .name().endsWith("[]"), which prevents
a round-trip to import mechanics and is potentially faster.
Change-Id: I4a939333c294ffa94ac1c013a8e3cee466e32cb9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 14:17:32 +0000 (16:17 +0200)]
Cache computed fieldName in templates
We end up using the same name multiple times, which really is an
invariant. Cache and reuse the constant, so that we end up with
more efficient code.
Change-Id: I6ee5cc162c43c542a08ba84250f42d9a30ba3f0d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 12:44:47 +0000 (14:44 +0200)]
Fix ClassTemplate.genConstructor() declaration
Using an array here is forcing us to needlessly unwrap the arraylist
(a perfectly iterable thing) to an array, which is only iterater over.
Fix this by passing down an iterable, which means the list can be
passed down as is.
Change-Id: I1572729d554c3ce8ae6ab94c1ba3d5547399e7ab
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 12:40:35 +0000 (14:40 +0200)]
Acquire first value manually in ClassTemplate
xtend's get(0) extension ends up creating a temporary list
holding a copy of the (single) value. This is not entirely
efficient, as we can get the same result from plain iterator.
Change-Id: I0f4398a47cb771e8ab7a212a67c5e402d49ffbf2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 12:30:47 +0000 (14:30 +0200)]
Acquire first entry of type constants in BuilderTemplate
Current code is relying on xtend Conversions to get first entry
from keySet/values separately. That code ends up copying the entire
collection into an array before picking the first element, which
is ... far from optimal.
Peel the first entrySet item using iterator().next() and then
reference key/value from there, which removes a dependency on
Conversions and is way more efficient.
Change-Id: I9cf16c416e65e538697aab26ebb5b9a81965e871
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 11:55:25 +0000 (13:55 +0200)]
Optimize allProperties sorting
Java 8 has list.sort(), which we can easily short-circuit to
ArrayList's implementation by using 'val' declaration. We can
also make the comparator a constant, so that it is widely reused.
Change-Id: Ib8ce132a806d4e1ab58746ce85e732d451d82845
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 11:46:14 +0000 (13:46 +0200)]
Optimize ClassTemplate.allProperties
This variable is guaranteed to be a List, declare it as such,
adding following benefits:
- eliminates ClassTemplate's reliance on IterableExtensions
- a few isEmpty() checks get be eliminated, as size() is now
handled through List.size()
Change-Id: I14354dfef3a6b663c9a027353704127437d4344d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 11:34:38 +0000 (13:34 +0200)]
Optimize BuilderTemplate string references
AUGMENTATION_FIELD.toFirstUpper is a true constant, make sure we
compute it only once.
Also, in case of augmentable, the augmentable imported name is an
invariant, hence precompute the string and use it multiple times
in the template.
Change-Id: I9607ac2e18e587118659545205323037db176fda
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 4 Sep 2019 11:15:12 +0000 (13:15 +0200)]
Backport code generation test
This backports the model used in binding2 testing.
JIRA: MDSAL-330
Change-Id: I8d2e3998523b78ceccf627134ed92496169a0ca8
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Sep 2019 20:01:24 +0000 (22:01 +0200)]
Improve generated builder documentation
This adds some sorely-needed guidelines as to how to use generated
builders.
Change-Id: I786a7e2f249f336363d4ddc107919edb861e0422
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 2 Sep 2019 14:28:48 +0000 (16:28 +0200)]
Remove BigIntegerRangeGenerator
We do not generate BigIntegers anymore, this removes related
generator.
JIRA: MDSAL-330
Change-Id: I29be15b970e8392f474136c8dd6a948fcbd4054c
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Tue, 3 Sep 2019 19:24:17 +0000 (21:24 +0200)]
Fix Builder javadoc mis-reference
Builders should reference target type in their documentation.
Change-Id: I3ba9c31c77be9d86bc4e2d854360b6f8cf0fb86b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 2 Sep 2019 08:34:32 +0000 (10:34 +0200)]
Change mapping of uint{8,16,32,64}
This changes the mapping of uint types to non-widening yang.common
classes and deals with them being used by yang.{data,model}.api:
YANG type Old Java type New Java Type
uint8 java.lang.Short org.opendaylight.yangtools.yang.common.Uint8
uint16 java.lang.Integer org.opendaylight.yangtools.yang.common.Uint16
uint32 java.lang.Long org.opendaylight.yangtools.yang.common.Uint32
uint64 java.math.BigInteger org.opendaylight.yangtools.yang.common.Uint64
This affects all getters, setters and value wrapper classes. For
setters, code generator emits a deprecated setter, which performs
the conversion internally.
JIRA: MDSAL-330
JIRA: YANGTOOLS-1018
Change-Id: Ic3913adc4a5d707b01671a982c58221cb028f6d9
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 2 Sep 2019 20:58:28 +0000 (22:58 +0200)]
Add a workaround for ARIES-1923
proxy-impl does not have an Opcodes.ASM7-compatible release, hence
it fails when it encounters JEP-181 nestmates.
As an interim solution, force mdsal-binding-api to target Java 10,
which does not have JEP-181.
Change-Id: I727082c7bc32e905ca4c23f8a35963bc69986f58
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 2 Sep 2019 15:57:36 +0000 (17:57 +0200)]
Improve BindingMapping lookup
Expose the fact that JAVA_RESERVED_WORDS is an ImmutableSet,
allowing callers to better bind to it.
Change-Id: I8131aa8d2be9a2b8b1e13f7c5d6231b9ccb5fd2d
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 2 Sep 2019 15:42:40 +0000 (17:42 +0200)]
Improve BaseYangTypes lookups
Update constant definition to be bound to ImmutableSet, so that
JIT has an easier time optimizing these lookups.
Change-Id: I7becd988d46f84972ef0c573ff5efeadcba2cc62
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 2 Sep 2019 15:13:02 +0000 (17:13 +0200)]
Improve TimerValue builder lookups
The constant is an ImmutableMap, make that explicit, so lookups
can binding directly to it.
Change-Id: Ia4026c5dc10c6e7dcb2e8c2f99709d97e3876e84
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Mon, 2 Sep 2019 12:55:20 +0000 (14:55 +0200)]
Add a dependency on blueprint annotations
We are using these and docs is complaining about not being able
to find the classes. Fix that up.
Change-Id: Ibbab75fb1226ff50dbca43e74711dafeb0c40789
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Aug 2019 15:11:48 +0000 (17:11 +0200)]
Remove sun.reflect meddling
It seems the issue has been somehow resolved, let's remove the
configuration.
Change-Id: Iee9baeb947c142c5749d5a8ab794fc3871990c56
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Aug 2019 08:24:40 +0000 (10:24 +0200)]
Remove ietf-restconf
This model has been superseded by RFC8040 and there the only
downstream user (netconf.git) is hosting the new version. This
model will live in the restconf projeect until it is needed.
Change-Id: I521d5f720a19c4885df5e8ba3483e6c1af7dbc0b
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Fri, 30 Aug 2019 11:18:02 +0000 (13:18 +0200)]
Fixup leaf caching test in face of lazy leaf nodes
In case we are doing lazy leaves, we end up not retaining them
and hence the test needs to do something different.
Change-Id: I68fded3a799d3c6c023eaa63336b7002ea4594c7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 28 Aug 2019 19:22:36 +0000 (21:22 +0200)]
Remove use of YangInstanceIdentifier.EMPTY
This constant is deprecated, migrate users to empty().
Change-Id: I8e71f90fb458f1155a0f4fb52ba40595b8e9e6bf
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 28 Aug 2019 15:09:12 +0000 (17:09 +0200)]
Add @ConstructorParameters to generated classes
This allows generated classes to be used with both java.beans
and javax.management even either of java.desktop or java.management
module is missing.
JIRA: MDSAL-468
Change-Id: I9903558102d094efeb60201673980685e2b5a253
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 28 Aug 2019 15:34:08 +0000 (17:34 +0200)]
Expose service group name from ServiceGroupIdentifier
AbstractIdentifier has removed public view of getValue(), hence
we need to expose a domain-specific accessor. This patch does that
and fixes up users.
Change-Id: I1645e86e5417e0a8c13660f8820a9df8b4c7cad7
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Robert Varga [Wed, 1 May 2019 12:23:15 +0000 (14:23 +0200)]
Switch to using VarHandles
VarHandles allow us to relax the memory ordering when accessing
cached CodecDataObject fields. Use them instead of
AtomicReferenceFieldUpdaters.
Change-Id: If95e4e058491cee4babfcbb49bb7cf47e62f9444
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>