[ 
https://issues.apache.org/jira/browse/SLING-7752?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16520171#comment-16520171
 ] 

ASF GitHub Bot commented on SLING-7752:
---------------------------------------

andreituicu commented on a change in pull request #2: SLING-7752 - 
Deserializing and serializing a feature model file suffles the configurations
URL: 
https://github.com/apache/sling-org-apache-sling-feature/pull/2#discussion_r197393248
 
 

 ##########
 File path: src/main/java/org/apache/sling/feature/impl/OrderedDictionary.java
 ##########
 @@ -0,0 +1,137 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.sling.feature.impl;
+
+import java.util.*;
+
+/**
+ * A dictionary implementation with predictable iteration order.
+ *
+ * Actually this class is a simple adapter from the Dictionary interface
+ * to a synchronized LinkedHashMap
+ *
+ * @param <K>
+ * @param <V>
+ */
+public class OrderedDictionary<K, V> extends Dictionary<K, V> implements 
Map<K, V> {
 
 Review comment:
   @rombert Yes, that is true, in `Configuration.java` it is only used as 
`Dictionary`, but I wanted to maintain backwards compatibility with all the 
other code that unknowingly used the implementation details of `Hashtable`. For 
example I've seen a lot of code doing things like `object instance of Map` and 
those conditions would fail.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Deserializing and serializing a feature model file suffles the configurations
> -----------------------------------------------------------------------------
>
>                 Key: SLING-7752
>                 URL: https://issues.apache.org/jira/browse/SLING-7752
>             Project: Sling
>          Issue Type: Bug
>          Components: Feature Model
>            Reporter: Andrei Tuicu
>            Priority: Major
>
> h3. Problem
> Deserializing and serializing a feature model file suffles the 
> configurations. This happens, because unordered maps (HashMaps/Hashtables) 
> are used in the implementations. The problem is relevant in the context of 
> adding these files in code versioning systems, because a minor change to a 
> file, done in an automated fashion, produces a big diff in the versioning 
> system and it becomes very hard to see exactly what is the relevant change. 



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to