[ONOS-4303, ONOS-4508, ONOS-4509, ONOS-4510, ONOS-4351]notification,rpc,union,sub-module,augment
Change-Id: Ibeed9ff965c13fd66743c1080cb1350d93a3a435
diff --git a/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java b/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
index 6d05ba6..86c6787 100644
--- a/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
+++ b/src/main/java/org/onosproject/yangutils/translator/tojava/JavaCodeGeneratorUtil.java
@@ -78,8 +78,23 @@
while (codeGenNode != null) {
if (curTraversal != PARENT) {
- setCurNode(codeGenNode);
- generateCodeEntry(codeGenNode, yangPlugin);
+ if (codeGenNode instanceof JavaCodeGenerator) {
+ setCurNode(codeGenNode);
+ generateCodeEntry(codeGenNode, yangPlugin);
+ } else {
+ /*
+ * For grouping and uses, there is no code generation, skip the generation for the child.
+ */
+ if (codeGenNode.getNextSibling() != null) {
+ curTraversal = SIBILING;
+ codeGenNode = codeGenNode.getNextSibling();
+ } else {
+ curTraversal = PARENT;
+ codeGenNode = codeGenNode.getParent();
+ }
+ continue;
+ }
+
}
if (curTraversal != PARENT && codeGenNode.getChild() != null) {
curTraversal = CHILD;
@@ -238,7 +253,7 @@
throws IOException {
if (((TempJavaCodeFragmentFilesContainer) node).getTempJavaCodeFragmentFiles() != null) {
- ((TempJavaCodeFragmentFilesContainer) node).getTempJavaCodeFragmentFiles().close(true);
+ ((TempJavaCodeFragmentFilesContainer) node).getTempJavaCodeFragmentFiles().freeTemporaryResources(true);
}
}
}