Bug3659: UnknownSchemaNodeImpl retains empty ArrayLists FIX 53/22353/5
authorMartin Ciglan <mciglan@cisco.com>
Thu, 11 Jun 2015 11:55:22 +0000 (13:55 +0200)
committerMartin Ciglan <mciglan@cisco.com>
Fri, 26 Jun 2015 14:06:27 +0000 (16:06 +0200)
Change-Id: I291eb3f87a3bc1655d0966513e1c74154558cbce
Signed-off-by: Martin Ciglan <mciglan@cisco.com>
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/builder/impl/UnknownSchemaNodeImpl.java

index 60137aa50d5e443215c5428f3ca09af065ec8ca5..89c1a86f4ffabfcb055c5bea3a6c92573ffeb422 100644 (file)
@@ -7,7 +7,7 @@
  */
 package org.opendaylight.yangtools.yang.parser.builder.impl;
 
-import java.util.ArrayList;
+import com.google.common.collect.ImmutableList;
 import java.util.List;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.model.api.ExtensionDefinition;
@@ -22,7 +22,7 @@ final class UnknownSchemaNodeImpl implements UnknownSchemaNode {
     String description;
     String reference;
     Status status = Status.CURRENT;
-    private final List<UnknownSchemaNode> unknownNodes = new ArrayList<>();
+    private List<UnknownSchemaNode> unknownNodes = ImmutableList.of();
     private QName nodeType;
     private String nodeParameter;
     boolean addedByUses;
@@ -78,7 +78,7 @@ final class UnknownSchemaNodeImpl implements UnknownSchemaNode {
 
     void setUnknownSchemaNodes(final List<UnknownSchemaNode> unknownNodes) {
         if (unknownNodes != null) {
-            this.unknownNodes.addAll(unknownNodes);
+            this.unknownNodes = ImmutableList.copyOf(unknownNodes);
         }
     }