From 6f071d8474f75208e112f542d2759147889fe978 Mon Sep 17 00:00:00 2001 From: Michael Vorburger Date: Mon, 17 Oct 2016 17:52:45 +0200 Subject: [PATCH 1/1] Clean up apparently dead (and not thread safe) code YangTemplate's private static Module is necessarily always null, so this is dead code, and it should be perfectly safe, and clearer, to remove this. Full disclosure: I actually have absolutely no idea what writeIdentityNs was originally good for, but don't think I'm breaking anything with this clean up, because the way the code is now there is no way that this can ever be anything else than null. Change-Id: Ib08112c836efdc1c72443a5f93549a96f954dae8 Signed-off-by: Michael Vorburger (cherry picked from commit 24522e1ea2cbc45350697265fa90cf419fcb5689) --- .../binding/generator/impl/YangTemplate.xtend | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/YangTemplate.xtend b/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/YangTemplate.xtend index 322d335f65..ca3b43ca11 100644 --- a/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/YangTemplate.xtend +++ b/binding/mdsal-binding-generator-impl/src/main/java/org/opendaylight/yangtools/sal/binding/generator/impl/YangTemplate.xtend @@ -42,9 +42,6 @@ import org.opendaylight.yangtools.yang.model.api.type.EnumTypeDefinition.EnumPai class YangTemplate { - // FIXME: this is not thread-safe and seems to be unused! - private static var Module module = null - def static String generateYangSnipet(SchemaNode schemaNode) { if (schemaNode == null) return '' @@ -382,7 +379,7 @@ class YangTemplate { ''' identity «identity.QName.localName» { «IF identity.baseIdentity != null» - base "(«writeIdentityNs(identity.baseIdentity)»)«identity.baseIdentity»"; + base "()«identity.baseIdentity»"; «ENDIF» «IF !identity.description.nullOrEmpty» description @@ -399,17 +396,6 @@ class YangTemplate { ''' } - def private static writeIdentityNs(IdentitySchemaNode identity) { - if(module == null) - return '' - - val identityNs = identity.QName.namespace - - if(!module.namespace.equals(identityNs)) - return identityNs + ":" - return '' - } - def private static writeFeatures(Set features) { ''' «FOR feature : features» -- 2.36.6