yangtools.git
8 years agoAdd test scope for junit 84/36884/1 stable/lithium
Thanh Ha [Mon, 14 Mar 2016 21:42:59 +0000 (17:42 -0400)]
Add test scope for junit

Change-Id: I35fbf975623e84f44c9477f226a31e9fda2bc780
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBumping versions by 0.0.1 for next dev cycle 03/35703/1
Thanh Ha [Fri, 4 Mar 2016 00:22:51 +0000 (19:22 -0500)]
Bumping versions by 0.0.1 for next dev cycle

Change-Id: I41287f0f29846b315ab83a745edf0d18a409a711
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoRelease Lithium-SR4 02/35702/1 release/lithium-sr4
Thanh Ha [Fri, 4 Mar 2016 00:22:49 +0000 (19:22 -0500)]
Release Lithium-SR4

Change-Id: Ia651255dbabf1b91b325a46e7f0043f80634d34e
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBug 4958: lithium yang parser tries to resolve one uses node twice 01/32601/3
Peter Kajsa [Thu, 14 Jan 2016 17:07:19 +0000 (18:07 +0100)]
Bug 4958: lithium yang parser tries to resolve one uses node twice

Lithium yang parser tries to resolve one uses node twice.
This happens only in case when a uses node is copied after
that it has been already resolved.

Change-Id: Ic4402b477aabd321a705e3d55abd644dbaeebba4
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBug 4079: Unable to compile pattern defined in module 16/34316/2
Igor Foltin [Fri, 2 Oct 2015 11:46:24 +0000 (13:46 +0200)]
Bug 4079: Unable to compile pattern defined in module
          when using Unicode blocks

In the XML Schema specification, Unicode character blocks are
matched by "\p{Is...}", whereas Java expects "\p{In...}".
This change has been added and tested.

Fixed handling of possible false replacements.
The pattern is now compiled ahead of time

Change-Id: I817e61c3f938166f8013e1733f7c7e4fb80faaf6
Signed-off-by: Igor Foltin <igor.foltin@pantheon.sk>
Signed-off-by: Igor Foltin <ifoltin@cisco.com>
8 years agoBug 2062 - StreamWriter APIs loses information about leaf-set ordering 31/32231/4
Jan Hajnar [Fri, 7 Aug 2015 12:20:01 +0000 (14:20 +0200)]
Bug 2062 - StreamWriter APIs loses information about leaf-set ordering

* added start methods for OrderedLeafSet
* modified classes that use NormalizedNodeStreamWriter to use
startOrderedLeafSet when needed.

Change-Id: I890a338313229b1600adcf5ac2ef1c8b440a220d
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
Signed-off-by: Robert Varga <robert.varga@pantheon.sk>
8 years agoBUG-4764: resolve serializer body before javassist callout 41/31441/1
Robert Varga [Wed, 16 Dec 2015 15:26:09 +0000 (16:26 +0100)]
BUG-4764: resolve serializer body before javassist callout

This moves the body generation phase out of the javassist lock, so that
it can perform cache lookups without the risk of hitting an AB-BA
deadlock.

Change-Id: I40d0237fef100f90bed9e91e3825a4121e4c503d
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-4623: YangSyntaxErrorException depending of the restictions/extensions order... 84/29984/3
icaro.damiani [Wed, 11 Nov 2015 15:12:26 +0000 (13:12 -0200)]
BUG-4623: YangSyntaxErrorException depending of the restictions/extensions order for the String type

* Modified the string_restriction rule on the YangParser.g4 to allow any order of restictions/extensions.

Change-Id: I31240adbe34e7d8f1afb93683713f75bbd4d1d57
Signed-off-by: icaro.damiani <icaro.damiani@datacom.ind.br>
8 years agoBumping versions by 0.0.1 for next dev cycle 63/30663/1
Thanh Ha [Thu, 3 Dec 2015 22:22:00 +0000 (17:22 -0500)]
Bumping versions by 0.0.1 for next dev cycle

Change-Id: Ica2fb3b6116f9283ac462025d7a47fdd05e0b02a
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoRelease Lithium-SR3 62/30662/1 release/lithium-sr3
Thanh Ha [Thu, 3 Dec 2015 22:21:57 +0000 (17:21 -0500)]
Release Lithium-SR3

Change-Id: Ia5642917cf4169528e15348267e98774ff984d9d
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBUG-4288: check for existing child modification 99/29499/2
Robert Varga [Thu, 10 Sep 2015 17:48:26 +0000 (19:48 +0200)]
BUG-4288: check for existing child modification

When we are issuing a merge on a previously-written node we need to make
sure the written node's data is pushed down to child nodes. This could
have ended up overwriting nodes which have occured under and after the
write being replaced. Guard against this mishap with an explicit check.

Change-Id: I2425dc758b8099de349641cd3bef9949cfccf57c
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit f57567345ea5fa7d38179889e2748003a38c384f)

8 years agoBUG-4556: enable DataSchemaContextTrees to be scavenged 27/29127/1
Robert Varga [Sun, 1 Nov 2015 12:09:02 +0000 (13:09 +0100)]
BUG-4556: enable DataSchemaContextTrees to be scavenged

DataSchemaContextTree contains an internal weak-keyed cache, which is
used to speed up lookups and share DataSchemaContextNodes.

Unfortunately the cache uses strong references for values (e.g.
DataSchemaContextTree) instances, which transitively (via
DataSchemaContextNode) retain the reference to the key. This has the
effect of the key being always reachable, thus causing a memory leak.

Make the cache use weak references for values, which ensures that it
gets scavenged whenever its contents are no longer referenced.

Change-Id: I1684d1bf2c2c5cdc44cda1e8e508149ff3a8fae4
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 6f14ad09b508858a7752eee74a29e14cad9278b3)

8 years agoBug 3799: NPE when including a submodule of a more recent revision than the module 06/27806/6
Peter Kajsa [Mon, 7 Sep 2015 15:12:35 +0000 (17:12 +0200)]
Bug 3799: NPE when including a submodule of a more recent revision than the module

Change-Id: Ieaff77303879d9f9eee4f4ae4840a517ada66a91
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBUG-4407: Fix Decimal64 range enforcement 80/28180/3
Robert Varga [Sun, 4 Oct 2015 02:32:00 +0000 (04:32 +0200)]
BUG-4407: Fix Decimal64 range enforcement

Baseline ranges did not take into account the number of fraction digits,
but rather instantiated the most permissive range. Fix this by
pre-calculating all ranges specified in RFC6020 Section 9.3.4.

Also enforce SchemaPath presence, as that is the unique identifier of
the type.

Change-Id: I5e8799da618398ba458606226e71e434f5214f33
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit e20ed3ad5e5ef3303048da9e21322f92ee79eb93)

8 years agoBug 4349: Allowed UnkeyedListItem to be start event in Writer. 37/28337/1
Tony Tkacik [Tue, 13 Oct 2015 08:13:58 +0000 (10:13 +0200)]
Bug 4349: Allowed UnkeyedListItem to be start event in Writer.

Change-Id: I42fd224974e6fcc691c548978beebce9a6828257
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
(cherry picked from commit b44368dc8c9c79310611cd7c8fa9404692583cd2)

8 years agoBUG-4359: use WRITE-implied metadata 81/28181/2
Robert Varga [Mon, 5 Oct 2015 17:30:13 +0000 (19:30 +0200)]
BUG-4359: use WRITE-implied metadata

When we apply an operation under a WRITE node, we need to look up the
metadata based on that write to correctly understand what the effect of
this operation is.

This is important when we modify data introduced by the WRITE node, as
without this lookup a WRITE/DELETE combination on the child will result
in a NONE logical operation, which means data introduced in the WRITE
node will not be modified and seemingly reappear.

Change-Id: I5a5a67470f1f8baafc7a71069341dead073ba84a
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit ea25d431092eaa10677bc936c86ec9a4c4e401c6)

8 years agoBug4231 - Yang tools failing to parse Augmentations under "uses" clause. 07/28207/1
Peter Kajsa [Wed, 2 Sep 2015 11:49:20 +0000 (13:49 +0200)]
Bug4231 - Yang tools failing to parse Augmentations under "uses" clause.

The problem occurs when uses-augment is nested in another Augment statement.
In this case the parent node of uses node is not subclass of SchemaNode
but it is AugmentationSchemaNode (it is not subclass of SchemaNode) and in
consequence class cast exception occurs.

(cherry picked from commit d417276b1c26ab5029b381657fd0be810970e572)
Change-Id: I8f58e3d326bb8a8dab9a187a333cd7b027223d75
Signed-off-by: Ryan Goulding <ryandgoulding@gmail.com>
8 years agoBumping versions by 0.0.1 after the Lithium SR2 release 77/28077/1
Thanh Ha [Thu, 8 Oct 2015 15:34:56 +0000 (11:34 -0400)]
Bumping versions by 0.0.1 after the Lithium SR2 release

Change-Id: I05c1d8259901b8607a82416cc67da2800e606e87
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoApplying the Lithium SR2 release patch 76/28076/1 release/lithium-sr2
Thanh Ha [Thu, 8 Oct 2015 15:34:52 +0000 (11:34 -0400)]
Applying the Lithium SR2 release patch

Change-Id: I674b38651390bf201a7738c1ac1815764c9d251e
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBug 4301: Incorrect union generated code when using decimal64 18/26918/4
Martin Ciglan [Mon, 14 Sep 2015 15:16:38 +0000 (17:16 +0200)]
Bug 4301: Incorrect union generated code when using decimal64

Binding Java API Generator shouldn't generate getValue() method
for java.math BigDecimal & BigInteger types, representing
YANG decimal64 & uint64 types.

Change-Id: I6f3d9207a441b2e92eef82a58d4730295256eb62
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
8 years agoBug 4183: Yang parser not able to deal with short-case-stmt in augment/uses-augment 43/27143/3
Martin Ciglan [Fri, 18 Sep 2015 06:52:44 +0000 (08:52 +0200)]
Bug 4183: Yang parser not able to deal with short-case-stmt in augment/uses-augment

If YANG model comes up with short-case-stmt augmented to choice (in fact, this is
recognized by ANTLR as data-def-stmt), this has to be expanded to full case,
otherwise NPE is thrown in code generator.

Change-Id: I96af1f29b1c495d53ac2123e2f60bf5b0f14cf45
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
8 years agoBUG-4309: include iana-afn-safi in model features 44/27144/2
Robert Varga [Thu, 17 Sep 2015 01:37:08 +0000 (03:37 +0200)]
BUG-4309: include iana-afn-safi in model features

This fixes a failure to package iana-afn-safi.

Change-Id: I68d53a9c30041da0196d9513872c1a05a661b18f
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 97e29e7c1cdd4fb4bdf63cdf83a4c5e0b4bcc6c8)

8 years agoBUG-4275: Improve MapAdaptor and LazyContainerNode map overhead 94/26894/2
Robert Varga [Mon, 7 Sep 2015 19:37:26 +0000 (21:37 +0200)]
BUG-4275: Improve MapAdaptor and LazyContainerNode map overhead

Analysis of a heap dump has shown that for two-entry containers we end
up allocating HashMaps with default load factor. This boils down to
HashMap's copy constructor enforcing allocation to at least 16 entries
and also us not properly sizing for small maps.

MapAdaptor is taught to use HashMap.clone() and fall back to conservative
sizing on small inputs.

LazyContainerNode is taught to properly size the copy map when being
converted to a Mutable.

Change-Id: I6ad36aea31aab2e5e70176143d74e97c6d6a9ca5
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 38ac687b3965ff80827780fd22979e69003d2186)

8 years agoBUG-4145: check if entire YangInstanceIdentifier is present in SchemaContext 01/26901/1
Robert Varga [Sun, 13 Sep 2015 18:47:09 +0000 (20:47 +0200)]
BUG-4145: check if entire YangInstanceIdentifier is present in SchemaContext

A failure to find the SchemaNode for a path argument results in a
NullPointerException. We need the SchemaNode to understand whether it
targets an augmentation, as those need to be pruned from string output.

This patch improves the behaviour by throwing an
IllegalArgumentException with a description of which component we failed
to find.

Change-Id: I128eb63cf05b278b1af7516d426a6f0bafa87b90
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 13bb06fa8a386783fa4796a8527b033b6d0f0271)

8 years agoBUG-4278: Improve TOUCH operation effects 59/26759/2
Robert Varga [Tue, 8 Sep 2015 09:31:14 +0000 (11:31 +0200)]
BUG-4278: Improve TOUCH operation effects

The implementation of TOUCH operation would bump the subtree version of
the node even if there were no children coming in, resulting in needless
promotion of LazyContainerNodes to MaterializedContainerNodes.

If a TOUCH operation does not result in any of the children being
modified, the subtree version should not be bumped, since the subtree
was not changed. This should be the case if the user-specified children
are empty and also if the all nodes end up not modifying the data tree.

Detect both conditions and reuse the original metadata node instead of
replacing it -- this preventing LazyContainerNode promotion.

Change-Id: Icdbde02e7c3f503a9ada28b58fd27e3e3a3ef812
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit 049e2e49f85525e83e13f0a4759e9126bc6edee0)

8 years agoBug 4145: Issue augmenting choice inside a list 17/26717/2
Peter Kajsa [Wed, 9 Sep 2015 11:28:42 +0000 (13:28 +0200)]
Bug 4145: Issue augmenting choice inside a list

The problem occurs when target node of uses-augment statement
is added by uses from another grouping and the uses statement
is not directly inside the grouping, but it is nested below
other elements (e.g. list, container etc.) in the grouping.
In this case the original of the target node is not found and
the IllegalStateException is thrown.

Change-Id: I51416b84e2bec81df814f214d2cebfaf93304d79
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
8 years agoBUG-4258: implement enumeration value canonicalization 96/26596/1
Robert Varga [Fri, 4 Sep 2015 16:57:35 +0000 (18:57 +0200)]
BUG-4258: implement enumeration value canonicalization

Convert the internal lookup set to a Map, which contains interned
strings. When asked to deserialize() a String, perform a lookup in the
Map and return the interned string instance instead of the serialized
instance.

Change-Id: I1eff1f3bd23446bf8b1090a386bb2d31d205f904
Signed-off-by: Robert Varga <rovarga@cisco.com>
(cherry picked from commit bf8bb3bbd805b64478de8ca0487c3e6f63125fc9)

8 years agoBug 3859: Use of reference keyword in a YANG extension 80/25680/1
Martin Ciglan [Fri, 21 Aug 2015 12:48:34 +0000 (14:48 +0200)]
Bug 3859: Use of reference keyword in a YANG extension
    causes YangSyntaxErrorException

Once reference or any other yang statement is defined within use of
extension (unknown statement), this should be correctly parsed
as another unknown statement. This behavior has been
added to RFC6020 ANTLR grammar and tested.

Change-Id: I5adb72172e4a2dc403342c768ffbc3dabcd0efe7
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
8 years agoUse odlparent version for maven-plugin-plugin 79/25679/1
Thanh Ha [Thu, 13 Aug 2015 16:57:53 +0000 (12:57 -0400)]
Use odlparent version for maven-plugin-plugin

Change-Id: Ib2d221c629f52ac85c7870545e68fb788b64136f
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBumping versions by 0.0.1 after the Lithium SR1 release 78/25678/1
Thanh Ha [Sat, 22 Aug 2015 03:17:46 +0000 (23:17 -0400)]
Bumping versions by 0.0.1 after the Lithium SR1 release

Change-Id: I9fc584ee2fff32aeb1c4ebcf509f63444a2fb297
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoApplying the Lithium SR1 release patch. 77/25677/1 release/lithium-sr1
Thanh Ha [Sat, 22 Aug 2015 03:17:41 +0000 (23:17 -0400)]
Applying the Lithium SR1 release patch.

Change-Id: I1246b73b1ea9f4504dbf028323d82fefb82497fe
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoRevert "Use odlparent version for maven-plugin-plugin" 76/25676/1
Thanh Ha [Sat, 22 Aug 2015 03:17:16 +0000 (23:17 -0400)]
Revert "Use odlparent version for maven-plugin-plugin"

This reverts commit 8aa174530a928c5522d280e57b7926b014656b8f.

Change-Id: I1ee553c7c298be3bd044999ec3b0cb87a0ac7259
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoRevert "Bug 3859: Use of reference keyword in a YANG extension" 75/25675/1
Thanh Ha [Sat, 22 Aug 2015 03:17:03 +0000 (23:17 -0400)]
Revert "Bug 3859: Use of reference keyword in a YANG extension"

This reverts commit e8a7058112bacbafada62cb71fef8207506d38d5.

Change-Id: I24a84a566af66bc1465b6713fa8d09ff9a5a3db1
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBug 3859: Use of reference keyword in a YANG extension 71/25571/1
Martin Ciglan [Fri, 21 Aug 2015 12:48:34 +0000 (14:48 +0200)]
Bug 3859: Use of reference keyword in a YANG extension
    causes YangSyntaxErrorException

Once reference or any other yang statement is defined within use of
extension (unknown statement), this should be correctly parsed
as another unknown statement. This behavior has been
added to RFC6020 ANTLR grammar and tested.

Change-Id: I3eed81e67ba6192e2c98154e7e6800215b1cc4bf
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
8 years agoUse odlparent version for maven-plugin-plugin 56/25256/1
Thanh Ha [Thu, 13 Aug 2015 16:57:53 +0000 (12:57 -0400)]
Use odlparent version for maven-plugin-plugin

Change-Id: Ia938e71c9ac9e899ee7c3a494ca7f9b6cb98cef3
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBug 2882: Fix off-by-one usage of cursor. 85/23885/1
Tony Tkacik [Wed, 8 Jul 2015 10:02:38 +0000 (12:02 +0200)]
Bug 2882: Fix off-by-one usage of cursor.

DataTreeCandidates#applyToModification
when dealing with cursor-aware transaction
entered writen / element twice - once with enter
and once with write which resulted in exception.

Change-Id: Ifd4023c7ad54f2be1672c42725dd37f4e3ff8282
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoSpeed BooleanStringCodec up 47/23047/3
Robert Varga [Sun, 21 Jun 2015 21:01:16 +0000 (23:01 +0200)]
Speed BooleanStringCodec up

Do not instantiate lower-cased strings, but rather use
equalsIgnoreCase(). Also make sure we call it on a constant.

Change-Id: I6ac4219c3cb2e3c09565a9eaf00c7a634d17afd4
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-2882: implement DataTreeModificationCursor 37/22837/7
Robert Varga [Wed, 17 Jun 2015 11:40:58 +0000 (13:40 +0200)]
BUG-2882: implement DataTreeModificationCursor

This patch makes InMemoryDataTree's snapshots and modifications
implement CursorAware, allowing more efficient traversal.

Change-Id: I279fd6b7d2e14fdfa1827c500a6d323a53207ab5
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoAllow instantiation of rooted DataTrees 42/22742/8
Robert Varga [Tue, 16 Jun 2015 23:08:50 +0000 (01:08 +0200)]
Allow instantiation of rooted DataTrees

We are not restricted to instantiation of data trees only at the root,
but can also bind them to a particular SchemaPath. Accessing such a data
tree uses relative instance identifiers, thus increasing performance.

Change-Id: I065d224e851c723d775f2b5711f818747592fc74
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoEnforce sealed DataTreeModification 72/22672/12
Robert Varga [Tue, 16 Jun 2015 09:12:03 +0000 (11:12 +0200)]
Enforce sealed DataTreeModification

DataTree needs to enforce the modification being sealed before
validation or preparation can proceed.

Change-Id: If0f26002f393f6cae469d755076da283c06c89f0
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoIntroduce isMixin() 66/22766/5
Robert Varga [Wed, 17 Jun 2015 07:59:30 +0000 (09:59 +0200)]
Introduce isMixin()

Instead of using a marker interface, expose an explicit method.

Change-Id: I59ea238634fecfee7acc745700850c84fc7ca348
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoFix bug in ImmutableMapEntryNodeBuilder 45/23045/3
Tom Pantelis [Sat, 20 Jun 2015 09:20:07 +0000 (05:20 -0400)]
Fix bug in ImmutableMapEntryNodeBuilder

In ImmutableMapEntryNodeBuilder#build, for the call to

   getChild(childrenQNamesToPaths.get(key.getValue()));

it should use key.getKey(). As a result, key childs nodes are never
found and thus user-provided nodes are always replaced.

NOTE: https://git.opendaylight.org/gerrit/#/c/23044/ should be merged
first to avoid unit test failure in the controller project.

Change-Id: I736756ce8fc3e15a05641565f2f505a2db32e9fc
Signed-off-by: Tom Pantelis <tpanteli@brocade.com>
8 years agoBug 3834 - Unhelpful error messages when parsing 87/23087/4
Jan Hajnar [Mon, 22 Jun 2015 12:53:04 +0000 (14:53 +0200)]
Bug 3834 - Unhelpful error messages when parsing
incorrect instance identifier in payload

* added custom exception when xpath argument ends with slash (before it
threw string out of bounds exception)
* added null check in DataSchemaContextNode so unknown qname for child
node does not crash on null pointer exception

Change-Id: Ie8db9c3cc1726dd73306437cb4eebb24f88eb5d9
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
8 years agoBumping versions by 0.0.1 for next dev cycle 91/23291/1
Thanh Ha [Thu, 25 Jun 2015 18:21:28 +0000 (14:21 -0400)]
Bumping versions by 0.0.1 for next dev cycle

Change-Id: Id3160742fa5719d54ce43426857e0e1c56c3104e
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoRelease Lithium 90/23290/1 release/lithium
Thanh Ha [Tue, 23 Jun 2015 01:47:15 +0000 (01:47 +0000)]
Release Lithium

Change-Id: I6f23a994d6d12dcf65a275fda00f9961883de8dd
Signed-off-by: Thanh Ha <thanh.ha@linuxfoundation.org>
8 years agoBug 3821 - Augmentation codecs may be loaded after codec creation. 86/22986/2
Tony Tkacik [Fri, 19 Jun 2015 09:29:40 +0000 (11:29 +0200)]
Bug 3821 - Augmentation codecs may be loaded after codec creation.

In some scenarios - where schema context already contained
schema for introduced augmentation, but class was not known
at time codec creation was triggered - codec for augmenation
was not created and any subsequent uses of codec (class is
already known) failed with IncorrectNestingException.

This patch introduces

  - new exception MissingClassInLoadingStrategy
    which is subclass used by MD-SAL to retry after context update
    or timeout
  - supports loading of  augmentation codec after parent codec
    was created and augmentation is part of schema codec

Change-Id: If85f8e2be614a139947abc5daaa1e141b3c9b22c
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoRemove unused import 65/22765/3
Robert Varga [Wed, 17 Jun 2015 07:22:56 +0000 (09:22 +0200)]
Remove unused import

YangInstanceIdentifier is only used as base reference to its nested
class, which we already import.

Change-Id: I4ca53b63cbec0cc240f2687fd3ecb5e34011f701
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoImport YangInstanceIdentifier nested classes 64/22764/3
Robert Varga [Wed, 17 Jun 2015 06:57:43 +0000 (08:57 +0200)]
Import YangInstanceIdentifier nested classes

Rather than being verbose in referencing them, import and use them using
a short name.

Change-Id: If469f83c79beb339800b9593393a4ec027aa7d7c
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-3793 32/22832/2
Shaleen Saxena [Wed, 17 Jun 2015 22:16:22 +0000 (15:16 -0700)]
BUG-3793
Manually patching in changes from Bug 2291 as it does not cherry-pick cleanly.

Change-Id: I17f1c2347d7aa3a120fac0171253e88c46e99fae
Signed-off-by: Shaleen Saxena <ssaxena@brocade.com>
8 years agoBug 2528 - Binding Generator: Generated notification implements ChildOf 21/21121/2
Peter Kajsa [Thu, 8 Jan 2015 12:50:02 +0000 (13:50 +0100)]
Bug 2528 - Binding Generator: Generated notification implements ChildOf
interface

Generated Notification interface implements ChildOf<DataObject> interface
which is incorrect. Generated Notification should not implement ChildOf
interface since it is not part of data tree. This could lead to use of
Notification in wrong context and may confuse consumers of APIs.

Notice: The solution replaces "implements ChildOf<DataObject>" with
"implements DataObject" in generated Notification interface. Notification
has structured content, so I think the generated Notification interface should
implements at least DataObject interface in order to be able to construct
InstanceIdentifier for the notification (analogously as it is by RPC's input
and output).

Change-Id: I55c7a8cc4ce450fd712c63f8e77881d4a18674e6
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
(cherry picked from commit 1fa4f51ce27b8a625d01f622f1261d51c0e852cb)

8 years agoBUG-1014: Moved recursive verify of written data to ready() 70/22670/4
Tony Tkacik [Tue, 16 Jun 2015 08:46:53 +0000 (10:46 +0200)]
BUG-1014: Moved recursive verify of written data to ready()

Moved recursive verify of written data to ready(), recursive
verify of written data needs only to be run for write and/or
merge.
For other operations validity of data was tested in previous
transactions or doing the walk of SchemaApplyOperation
to resolve necessary information.

Change-Id: I1958ff747225f87913e8eb603212228910e38df0
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBug 2816: Changed BooleanStringCodec deserialization 67/21867/2
Debalina Ghosh [Thu, 14 May 2015 16:59:57 +0000 (09:59 -0700)]
Bug 2816: Changed BooleanStringCodec deserialization

Added validate() to deserialize that checks whether input string is true or false.
If some other string is given, IllegalArgumentException is thrown.
Unit test is changed accordingly.

Change-Id: I51e7da19bd4cce85aa707d7741ae3956cc3e8890
Signed-off-by: Debalina Ghosh <debalina.ghosh@hp.com>
(cherry picked from commit 0686c2d01f18a44f65811dc3fffce0ade2e8cd4e)

8 years agoBug 3645 - instance-identifier parsing error 68/22668/4
Jan Hajnar [Tue, 16 Jun 2015 07:14:40 +0000 (09:14 +0200)]
Bug 3645 - instance-identifier parsing error

* added method deserializeKeyValue in AbstractStringInstanceIdentifierCodec
* added implementations for deserializeKeyValue for XML and JSON codecs

Change-Id: I97f68534d4ecc7b0cbb8e67ba899c9b4bfe91650
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
8 years agoIntroduce MapAdaptor.initialSnapshot() 46/22646/3
Robert Varga [Mon, 15 Jun 2015 22:28:54 +0000 (00:28 +0200)]
Introduce MapAdaptor.initialSnapshot()

In some circumstances we have an idea about how many entries will there
be in a map. This could cost us perform one additional copy, so expose a
method to create the appropriate map, behaving just as the one returned
by takeSnapshot(Collections.emptyMap()).

Also use ImmutableMaps for empty map, as it being immutable is recognized
by Guava, leading to quick reuse.

Change-Id: I40925e5d643c074277e9d11365a3b10fb9f22c1d
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-1014: TreeType should be Beta 49/22649/1
Robert Varga [Mon, 15 Jun 2015 23:25:03 +0000 (01:25 +0200)]
BUG-1014: TreeType should be Beta

It is not a finalized concept yet, so users should we vary before
relying on it.

Change-Id: I6af61e2cc402b34126c4631cfaec1791180c8ce0
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoUse sizeHints in ImmutableNode builders 27/22427/3
Robert Varga [Fri, 12 Jun 2015 01:09:13 +0000 (03:09 +0200)]
Use sizeHints in ImmutableNode builders

Instead of ignoring the size hint, use it.

Change-Id: I516fbb2a8c18bb6276b5863292f8b0e956ceb6da
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 1014 - Non-configuration items in the model appear in the config 01/20501/11
Jan Hajnar [Thu, 14 May 2015 12:30:49 +0000 (14:30 +0200)]
Bug 1014 - Non-configuration items in the model appear in the config
namespace

* added TreeType enum for tree type identification
* modified factory methods and constructor for InMemoryDataTree
* Modified factory of SchemaApplyOperation to filter subtree by tree type
* reworked verifyStructure() to recursivelly walk data tree
* added tests for config statement check

Change-Id: I3f4ebe84e4387965ff43714a1f45f75c738d4475
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
8 years agoBug 3669 - ietf-restconf binding is incomplete 78/22578/1
Peter Kajsa [Mon, 15 Jun 2015 09:36:29 +0000 (11:36 +0200)]
Bug 3669 - ietf-restconf binding is incomplete

- added implementation of ModuleRevisionBuilder.java

Change-Id: If50041c1b0befcb5fb8678cf95f915ef4b079bfb
Signed-off-by: Peter Kajsa <pkajsa@cisco.com>
(cherry picked from commit 7ec507df717ecde4c716c6811b71f322f8409626)

8 years agoProvide better error messages when parsing JSON. 71/20171/4
Colin Dixon [Fri, 10 Apr 2015 00:36:49 +0000 (20:36 -0400)]
Provide better error messages when parsing JSON.

Change-Id: Ia3a613964ce74a6179a568098b83f9d3755fb9a4
Signed-off-by: Colin Dixon <colin@colindixon.com>
8 years agoIntroduce YangInstanceIdentifier.toOptimized() 44/22544/2
Robert Varga [Sun, 14 Jun 2015 09:12:29 +0000 (11:12 +0200)]
Introduce YangInstanceIdentifier.toOptimized()

Users often need to retain a YangInstanceIdentifier for use in either
addressing the same element in the data tree, or to create child
instance identifiers. Create a new method, toOptimized(), which returns
an equivalent FixedYangInstanceIdentifier instance.

Change-Id: I057db1d539520195cd38c1bfc77a8be1384108e2
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove use of deprecated parser method 83/22483/1
Robert Varga [Fri, 12 Jun 2015 17:04:39 +0000 (19:04 +0200)]
Remove use of deprecated parser method

This simplifies SchemaContext construction in test.

Change-Id: I784075dd28a36aae9e679abbdb8370d9ea415388
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-3674: delete of non-existing data is a no-op 71/22471/3
Robert Varga [Fri, 12 Jun 2015 13:59:56 +0000 (15:59 +0200)]
BUG-3674: delete of non-existing data is a no-op

As noted in the comments, a delete on non-existing data is a no-op. That
means the user should see an UNMODIFIED modification, not a DELETE.

Change-Id: Ic9f79b99eefa352549b363c4754566da66ed0d55
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoLower the size of ModifiedNode children maps 28/22428/4
Robert Varga [Fri, 12 Jun 2015 01:17:20 +0000 (03:17 +0200)]
Lower the size of ModifiedNode children maps

This lowers the default allocation of 16 to 8, hopefully lowering memory
pressure.

Change-Id: I72218f71a4407e0cdd802984b2edaf8fdfe8d3b2
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3687 - StreamWriterGenerator emits UNKNOWN_SIZE 52/22452/4
Tony Tkacik [Fri, 12 Jun 2015 10:28:04 +0000 (12:28 +0200)]
Bug 3687 - StreamWriterGenerator emits UNKNOWN_SIZE

StreamWriterGenerator always emitted sizing hint
for fully-completed data and sometimes even
counting all availble augmentations, which actually
lead-up to larger sizes of collections then needed.

Fix changes the SIZE HINT for "constant" max-sized
types (containers, augmentations, list entries)
to -1 so underlaying implementation could size
them based on actual data.

Change-Id: Ibd446f71c4b066f4dab4a7d73b1bc851d9e62c99
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoUse an ImmutableMap for empty case 19/22419/1
Robert Varga [Thu, 11 Jun 2015 22:25:34 +0000 (00:25 +0200)]
Use an ImmutableMap for empty case

Instead of using Collections.emptyMap(), use ImmutableMap.of(). This
will result in an immutable map, taking the immutable shortcut in the
previous check.

Change-Id: I83a58b0dcd5f075d0ac7a7b5073b801ce8a47d08
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-2402: introduce CloneableChildrenMap 09/22409/1
Robert Varga [Thu, 11 Jun 2015 20:28:38 +0000 (22:28 +0200)]
BUG-2402: introduce CloneableChildrenMap

This exposes the appropriate interface to create a copy of the
underlying map in the most efficient manner. Makes
AbstractImmutableDataContainerNodeBuilder check for presence of the
interface and use it to create an efficient copy.

Change-Id: I8ad8159076fa199f315857e339fc83363ce73289
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoCleanup NodeIdentifierWithPredicates references 08/22408/1
Robert Varga [Thu, 11 Jun 2015 21:05:01 +0000 (23:05 +0200)]
Cleanup NodeIdentifierWithPredicates references

Import NodeIdentifierWithPredicates directly, so we do not have to
qualify it with YangInstanceIdentifier.

Change-Id: Ibfaf62bf808b683bae57b120749db23fed3683eb
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoTypeDefinition is a generic type 51/22351/1
Robert Varga [Thu, 11 Jun 2015 11:15:54 +0000 (13:15 +0200)]
TypeDefinition is a generic type

Do not use it in raw format, eliminating warnings.

Change-Id: I6012f812ce7a5aba75f163a8910fb0583fefd6cc
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMake methods static 47/22347/2
Robert Varga [Thu, 11 Jun 2015 10:40:28 +0000 (12:40 +0200)]
Make methods static

All these can be made static, so improve their efficiency.

Change-Id: Ie6aa238eab7fef728dd22af12a64a155a9db776e
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoMake BaseYangTypes.TYPE_MAP immutable 46/22346/1
Robert Varga [Thu, 11 Jun 2015 10:32:44 +0000 (12:32 +0200)]
Make BaseYangTypes.TYPE_MAP immutable

The lookup map is expected to be immutable.

Change-Id: I0ed6c263d34e585dcca2445ec963ea785c934ab8
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoImprove stored map memory efficiency 62/22262/3
Robert Varga [Wed, 10 Jun 2015 09:25:01 +0000 (11:25 +0200)]
Improve stored map memory efficiency

When we deal with small maps, we can improve our memory efficiency by
turning it into an ImmutableMap instead of wrapping it in another
instance.

For 1M fake BGP routes, this lowers the memory footprint by ~300MB,
which is about 10%.

Change-Id: I7fbac729f635ea089ac144e8a264df884d94c512
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoThrow an exception from private constructor 42/22242/4
Robert Varga [Tue, 9 Jun 2015 22:58:12 +0000 (00:58 +0200)]
Throw an exception from private constructor

This is a utility class, it should never be instantiated.

Change-Id: Ic2edd90d0cf084a3a38e5a6c068172b9d774799e
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-3641: cache hashCode value 41/22241/4
Robert Varga [Tue, 9 Jun 2015 23:09:51 +0000 (01:09 +0200)]
BUG-3641: cache hashCode value

Builder-derived classes can be used as HashMap keys, which means they
can see their hashcode computed multiple times. Since this is a
recursive operation, the cost of it can be quite high, so dedicate two
fields for caching the hashcode result.

Change-Id: I0d95fd94187a421e4018b2f6992dfeaf2e126732
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3191: Optimisation of serialisation of IdentityrefTypeDefinition 10/21610/10
Maros Marsalek [Tue, 9 Jun 2015 14:16:30 +0000 (16:16 +0200)]
Bug 3191: Optimisation of serialisation of IdentityrefTypeDefinition

Workaround for the case when prefix and namespace within element
and its value is same as parent namespace.

Change-Id: I1c8f8b503dc38385aa8cd23a517e067531081661
Signed-off-by: Marian Dubai <mdubai@cisco.com>
Signed-off-by: Tomas Cere <tcere@cisco.com>
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
8 years agoBug 1485: Invoke lengthCheck only on non-null object. 89/22189/1
Tony Tkacik [Tue, 9 Jun 2015 12:59:25 +0000 (14:59 +0200)]
Bug 1485: Invoke lengthCheck only on non-null object.

Change-Id: Iec3cf2fe08fbdac4e5139acab7865cd4c4b6224f
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBUG-706 Ignore anyxml nodes in binding serializer 97/22097/2
Maros Marsalek [Mon, 8 Jun 2015 12:39:02 +0000 (14:39 +0200)]
BUG-706 Ignore anyxml nodes in binding serializer

AnyXml is not supported on that level and currently leads to null pointer ex.

Change-Id: I5c2a64ab9502e4bba02efd822d2b5294ef456cef
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
8 years agoIntroduce NormalizedNodes.findDuplicates() 14/21614/5
Robert Varga [Tue, 2 Jun 2015 08:29:20 +0000 (10:29 +0200)]
Introduce NormalizedNodes.findDuplicates()

This is an analytics utility method to find duplicate entries within a
NormalizedNode subtree.

Change-Id: Iedb3c9f71848c546f6e303b66e3f129b5f4da54f
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-3051: Fix error reporting string 16/22116/1
Robert Varga [Mon, 8 Jun 2015 16:43:05 +0000 (18:43 +0200)]
BUG-3051: Fix error reporting string

The exception thrown does not accurately describe what has happened. Be
more user-friendly and report the exact pattern which failed to match.

Change-Id: I0818c92c4a8cdf8c180234635c1efe059ff1c4e2
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-1485: convert BuilderTemplate to use LengthGenerator 14/21514/4
Robert Varga [Sun, 31 May 2015 17:51:43 +0000 (19:51 +0200)]
BUG-1485: convert BuilderTemplate to use LengthGenerator

This converts BuilderTemplate to use the LengthGenerator class as
appropriate, speeding operations up. Also removes caching fields.

Change-Id: I1a0bfc56df8ab36880ae8e14c111cb9aca68c626
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-1485: Switch ClassTemplate length checker 10/21510/7
Robert Varga [Sun, 31 May 2015 12:05:02 +0000 (14:05 +0200)]
BUG-1485: Switch ClassTemplate length checker

Switch ClassTemplate to use LengthGenerator. Also removes the static field
used to hold ranges, as that is only used by deprecated length() method.

Change-Id: I2a084a71d21c8c63a2d9733fc767aa7ecd3cff67
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-1485: Create LengthGenerator 09/21509/8
Robert Varga [Sun, 31 May 2015 11:33:03 +0000 (13:33 +0200)]
BUG-1485: Create LengthGenerator

LengthGenerator is akin to AbstractRangeGenerator, only simpler. Since
the type of the checked property can only be an integer, we can live
without subclasses. One weirdness is that it needs to support both
String and byte[] fields, but that is easily catered with two distinct
methods.

Change-Id: I6b714b4094c332c18ee210451b3bd1672ca74129
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3051: Fixed pattern checks in generated DTOs 73/18973/6
Tony Tkacik [Thu, 23 Apr 2015 15:13:36 +0000 (17:13 +0200)]
Bug 3051: Fixed pattern checks in generated DTOs

Pattern checks in generated DTOs were generated as
OR checks in case model type specified multiple
patterns, but correct behaviour is to do AND.

So in order string needs to verified against
all patterns and match all of them.

Change-Id: If82e282312c82dd71de79534c7fa599fcdcefab4
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoBug 3336 - Binding DTOs: fix binary-derived constructor 60/21560/3
Jan Hajnar [Mon, 1 Jun 2015 14:40:16 +0000 (16:40 +0200)]
Bug 3336 - Binding DTOs: fix binary-derived constructor

* added condition to only check for null in value assignmet if class has
one property (because then CheckNull is generated before assgnment)

Change-Id: I3bd18ec60347b3d1d5dec32e7bcafa432c56b5ad
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
8 years agoBug 3224 - Parsing data with choice in case via augmentation results in 14/19814/7
Jan Hajnar [Thu, 7 May 2015 15:09:37 +0000 (17:09 +0200)]
Bug 3224 - Parsing data with choice in case via augmentation results in
incorrect parsing

* added tests for multiple choices from augmentation parsing
for json, xml and bindinging aware context
* modified json parsing tests
* fixed choice augmentation resolution in ChoiceNodeCodecContext
and CompositeNodeDataWithSchema
* moved findCorrespondingAugment to SchemaUtils since it is useful for
multiple Classes
* replaced getNodeIdentifierForAugmentation code in SchemaUtils  with
the one from CompositeNodeDataWithSchema.

Change-Id: Ibf57a771b92de14ecb70dcbbe250d7c559066882
Signed-off-by: Jan Hajnar <jhajnar@cisco.com>
8 years agoStop calling get on a possible absent value. 46/21646/2
Tomas Cere [Tue, 2 Jun 2015 12:03:58 +0000 (14:03 +0200)]
Stop calling get on a possible absent value.

Change-Id: I76cc4d6decd7cf65f988dcb87553b280aab21b24
Signed-off-by: Tomas Cere <tcere@cisco.com>
8 years agoImprove deltaChildren() 49/21849/2
Robert Varga [Thu, 4 Jun 2015 00:48:40 +0000 (02:48 +0200)]
Improve deltaChildren()

Instead of instantiating and mutating an index map, we perform a full
search in both old and new data, building the result as we go.

Change-Id: I4aae9cdbf18080a63da3416728b3b5dbb8e312ab
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBindingReflections' cache should use cached references 08/21808/2
Robert Varga [Wed, 3 Jun 2015 17:32:11 +0000 (19:32 +0200)]
BindingReflections' cache should use cached references

Since we will be giving out these all over the place, it is a good idea
to make sure the returned reference is system-global.

Change-Id: I46c4f62c5ea8f8ee13e7745e6c9efd7d865bd6d4
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoAdd YangInstanceIdentifierBuilder.node(PathArgument) 07/21807/1
Robert Varga [Wed, 3 Jun 2015 17:17:20 +0000 (19:17 +0200)]
Add YangInstanceIdentifierBuilder.node(PathArgument)

Forcing users of builder to not reuse PathArgument instances seems
wrong. Allow passing of pre-made PathArguments to a builder.

Change-Id: Iae7d2a8c8dd60542a11c946dc3ced18e09afb62b
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoRemove code duplication in YangInstanceIdentifierBuilder 06/21806/1
Robert Varga [Wed, 3 Jun 2015 17:13:03 +0000 (19:13 +0200)]
Remove code duplication in YangInstanceIdentifierBuilder

The various node() methods share a tail-end, concentrate in a private
method.

Change-Id: Ice0f1b8824b6c5a11a2fdec696a1453817493b5e
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoAdd a quick identity check for map comparison 63/21763/2
Robert Varga [Wed, 3 Jun 2015 13:14:06 +0000 (15:14 +0200)]
Add a quick identity check for map comparison

This should speed up the case of copied values. Also add a TODO for
future improvement.

Change-Id: Ie5122bd9b4941f05b6a94d30ecacbaab8dab2923
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBug 3344: Make sure StackedPathArgument stack is non empty. 95/21795/3
Tony Tkacik [Wed, 3 Jun 2015 15:26:32 +0000 (17:26 +0200)]
Bug 3344: Make sure StackedPathArgument stack is non empty.

The while cycle in StackedYangInstanceIdentifier did double
check of tryPathArguments for same instance identifier,
which led to shared state during creation. This may have
resulted in StackedPathArgumements with empty stack.

Changing it into do-while cycle makes sure stack is non empty
and also state during construction is not shared between
multiple invokers.

Change-Id: I834c1f22c477bb03a6bae9c4a366308a0988ce4e
Signed-off-by: Tony Tkacik <ttkacik@cisco.com>
8 years agoFix performance of RecursiveReplaceCandidateNode.getModifiedChild() 25/21725/1
Robert Varga [Wed, 3 Jun 2015 08:16:17 +0000 (10:16 +0200)]
Fix performance of RecursiveReplaceCandidateNode.getModifiedChild()

This implementation was accidentally left out of conversion which
introduced AbstractDataTreeCandidateNode.deltaChild(). Convert the
callsite, increasing its efficiency.

Change-Id: I3bf434fb5fa843ade0c64999e1cf75dd1374b393
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-1485: remove holder for deprecated Class ranges 70/21370/9
Robert Varga [Thu, 28 May 2015 20:34:01 +0000 (22:34 +0200)]
BUG-1485: remove holder for deprecated Class ranges

With the switchover to new range checks, the static caching field is not
needed. We still retain compatibility with possible users out there, but
they are now responsible for caching the result.

Change-Id: I119615255559263f98fc382b324026c4f5d35cfc
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-1485: remove holder for deprecated Builder field ranges 69/21369/9
Robert Varga [Thu, 28 May 2015 20:05:51 +0000 (22:05 +0200)]
BUG-1485: remove holder for deprecated Builder field ranges

Caching the result was important as long as ranges were used internally,
now that they are not, do not retain them and re-generate them on each
call. Any callers out there are now responsible for caching them
themselves.

Change-Id: Idcba7fe54c59e33d6eedb6b596a2bf4f4a5ca10c
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-1485: switch BuilderTemplate to new range enforcement 68/21368/9
Robert Varga [Thu, 28 May 2015 19:33:18 +0000 (21:33 +0200)]
BUG-1485: switch BuilderTemplate to new range enforcement

This switches the template for builders to the new range enforcement
code.

Change-Id: I1368a6a6922b2e982b9f4274dca32cf73b888d4b
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoInvoke equals() on a constant reference 35/21335/2
Robert Varga [Thu, 28 May 2015 14:54:54 +0000 (16:54 +0200)]
Invoke equals() on a constant reference

Inverting how we perform the equality check makes it obvious that the
invoked method is bound to a specific class object, helping compiler
just a tiny bit.

Change-Id: Ia8209f50143b0c3af71a962ab2a3ab167396836f
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-1485: switch ClassTemplate to new range enformcement 74/21274/13
Robert Varga [Wed, 27 May 2015 20:00:18 +0000 (22:00 +0200)]
BUG-1485: switch ClassTemplate to new range enformcement

Switch range checks for simple classes (typedefs and similar) to the new
range checker. Also move printRangeConstraint() from BaseTemplate to
BuilderTemplate, as it ends up being used only there.

Change-Id: I16e4c1faf239d838ff415c0173ef3d06acc61701
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-1485: optimize primitive range checks 80/21380/4
Robert Varga [Thu, 28 May 2015 23:50:23 +0000 (01:50 +0200)]
BUG-1485: optimize primitive range checks

When we are dealing with a primitive type, we can force unboxing of the
type by declaring the range checker method's argument as the primitive
type. This will result in the stack not containing references for the
fast path (e.g. successful check) as well as reduce the number of
virtual calls to one. Checks will then be performed using primitive
manipulation instructions, which should result in better fast-path
execution.

The slow path will take a hit, as for throwing the exception, we will
end up re-boxing the primitive type.

Change-Id: I7e6b0e25790f9a43dc99f2fc7426bb9fe25c505c
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoBUG-1485: make AbstractRangeGenerator deal with GTOs 49/21349/6
Robert Varga [Thu, 28 May 2015 14:57:20 +0000 (16:57 +0200)]
BUG-1485: make AbstractRangeGenerator deal with GTOs

For enforcement of ranges in builders, we will need to deal with types
other than ConcreteType. Also clean up internal interfaces, add some
javadocs and remove some trailing whitespace.

Also perform Number class conversion silently if it does not result in
loss of precision. Emit a warning if it does.

Change-Id: I8f3ba96c104fb28f6d2cfc4b05b5d24bb7f80aa1
Signed-off-by: Robert Varga <rovarga@cisco.com>
8 years agoClarify GeneratedTransferObject.getSuperType() 48/21348/1
Robert Varga [Thu, 28 May 2015 15:23:27 +0000 (17:23 +0200)]
Clarify GeneratedTransferObject.getSuperType()

The Javadoc for this method is confusing and actually misleading.
Clarify it a bit for future's sake.

Change-Id: I52f09e2e9cf864dc00fb4883099ca4df5219327f
Signed-off-by: Robert Varga <rovarga@cisco.com>