BUG-4400: make sure we retain input ordering 32/27832/1
authorRobert Varga <rovarga@cisco.com>
Fri, 2 Oct 2015 16:32:12 +0000 (18:32 +0200)
committerRobert Varga <rovarga@cisco.com>
Fri, 2 Oct 2015 16:32:12 +0000 (18:32 +0200)
For key statements we must retain the definition order, so use a
LinkedHashSet instead of a regular HashSet.

Change-Id: I9d327e571b895ee4b9dadeb5c5d0817e81a4906c
Signed-off-by: Robert Varga <rovarga@cisco.com>
yang/yang-parser-impl/src/main/java/org/opendaylight/yangtools/yang/parser/spi/meta/StmtContextUtils.java

index 9bc3fcbf8a3d2231026a9a4989d631e74a682f43..b82f094b898c29da135dd79b7d527fa834dded31 100644 (file)
@@ -11,7 +11,7 @@ import com.google.common.base.Function;
 import com.google.common.base.Predicate;
 import com.google.common.base.Splitter;
 import java.util.Collection;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
 import java.util.Set;
 import org.opendaylight.yangtools.yang.common.QName;
 import org.opendaylight.yangtools.yang.common.QNameModule;
@@ -170,7 +170,7 @@ public final class StmtContextUtils {
             final StmtContext<Collection<SchemaNodeIdentifier>, KeyStatement, ?> keyStmtCtx,
             final QNameModule newQNameModule) {
 
-        Set<SchemaNodeIdentifier> newKeys = new HashSet<>();
+        Set<SchemaNodeIdentifier> newKeys = new LinkedHashSet<>();
         for (String keyToken : KEY_SPLITTER.split(keyStmtCtx.rawStatementArgument())) {
             QName keyQName = QName.create(newQNameModule, keyToken);
             SchemaNodeIdentifier keyIdentifier = SchemaNodeIdentifier.create(false, keyQName);