Fixed FELIX-3131
Manipulation metadata are now returned using the discovery order.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1175369 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/pom.xml b/ipojo/manipulator/pom.xml
index dd017ab..9e97f83 100644
--- a/ipojo/manipulator/pom.xml
+++ b/ipojo/manipulator/pom.xml
@@ -48,7 +48,7 @@
       <dependency>
         <groupId>org.apache.felix</groupId>
         <artifactId>org.apache.felix.ipojo.metadata</artifactId>
-        <version>1.4.0</version>
+        <version>1.5.0-SNAPSHOT</version>
       </dependency>
       <dependency>
         <groupId>org.apache.felix</groupId>
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
index f99c763..fe073f3 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
@@ -19,9 +19,9 @@
 package org.apache.felix.ipojo.manipulation;

 

 import java.util.ArrayList;

-import java.util.HashMap;

 import java.util.List;

 import java.util.Map;

+import java.util.TreeMap;

 

 import org.objectweb.asm.AnnotationVisitor;

 import org.objectweb.asm.ClassVisitor;

@@ -51,7 +51,7 @@
     /**

      * Field map [field name, type] discovered in the component class.

      */

-    private Map<String, String> m_fields = new HashMap<String, String>();

+    private Map<String, String> m_fields = new TreeMap<String, String>();

 

     /**

      * Method List of method descriptor discovered in the component class.

diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
index 9b6bb94..3187196 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/annotations/MetadataCollector.java
@@ -23,8 +23,10 @@
 import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.TreeMap;
 
 import javax.xml.parsers.DocumentBuilder;
 import javax.xml.parsers.DocumentBuilderFactory;
@@ -74,14 +76,14 @@
      * Map of [element ids, element].
      * This map is used to easily get an already created element.
      */
-    private Map<String, Element> m_ids = new HashMap<String, Element>();
+    private Map<String, Element> m_ids = new TreeMap<String, Element>();
 
     /**
      * Map of [element, referto].
      * This map is used to recreate the element hierarchy.
      * Stored element are added under referred element.
      */
-    private Map<Element, String> m_elements = new HashMap<Element, String>();
+    private Map<Element, String> m_elements = new LinkedHashMap<Element, String>();
 
     /**
      * Instance declaration.
@@ -126,8 +128,8 @@
      * @see org.objectweb.asm.ClassAdapter#visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
      */
     public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
-        m_ids = new HashMap<String, Element>();
-        m_elements = new HashMap<Element, String>();
+        m_ids = new TreeMap<String, Element>();
+        m_elements = new LinkedHashMap<Element, String>();
         m_className = name;
     }