Author: clement
Date: Sun May  4 17:00:18 2014
New Revision: 1592381

URL: http://svn.apache.org/r1592381
Log:
Fix FELIX 4509
Change the way frames are computed. This commit removes the previous 
"retroweaving" hack, and relies on ASM to compute frames. A simple extension of 
ClassWriter is provided to change the way ASM is implementing the 
getCommonSuperClass method.
  It also improves a bit the code of the iPOJO API by using generics and for 
each loops

Added:
    
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java
      - copied, changed from r1592340, 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCreator.java
    
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/NoClassLoaderClassWriter.java
Removed:
    
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCreator.java
Modified:
    felix/trunk/ipojo/manipulator/manipulator-it/pom.xml
    felix/trunk/ipojo/manipulator/manipulator/pom.xml
    
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
    
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java
    
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
    
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java
    
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java
    
felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java
    felix/trunk/ipojo/runtime/api/pom.xml
    
felix/trunk/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java
    felix/trunk/ipojo/runtime/composite/pom.xml
    felix/trunk/ipojo/runtime/core-it/pom.xml

Modified: felix/trunk/ipojo/manipulator/manipulator-it/pom.xml
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator-it/pom.xml?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator-it/pom.xml (original)
+++ felix/trunk/ipojo/manipulator/manipulator-it/pom.xml Sun May  4 17:00:18 
2014
@@ -69,8 +69,8 @@
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>2.5.1</version>
                 <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
+                    <source>1.7</source>
+                    <target>1.7</target>
                 </configuration>
             </plugin>
 

Modified: felix/trunk/ipojo/manipulator/manipulator/pom.xml
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/pom.xml?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/pom.xml (original)
+++ felix/trunk/ipojo/manipulator/manipulator/pom.xml Sun May  4 17:00:18 2014
@@ -123,8 +123,8 @@
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-compiler-plugin</artifactId>
         <configuration>
-          <source>1.5</source>
-          <target>1.5</target>
+          <source>1.8</source>
+          <target>1.8</target>
         </configuration>
       </plugin>
 

Modified: 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
 (original)
+++ 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
 Sun May  4 17:00:18 2014
@@ -90,7 +90,7 @@ public class ClassChecker extends ClassV
      */
     public FieldVisitor visitField(int access, String name, String desc,
                                    String signature, Object value) {
-        if (name.equals(MethodCreator.IM_FIELD)
+        if (name.equals(ClassManipulator.IM_FIELD)
                 && desc.equals("Lorg/apache/felix/ipojo/InstanceManager;")) {
             m_isAlreadyManipulated = true;
         } else if (name.startsWith("class$")) { // Does not add class$* field 
generated by 'x.class'
@@ -122,9 +122,9 @@ public class ClassChecker extends ClassV
     }
 
     private boolean isManipulatedField(String name) {
-        return ((MethodCreator.IM_FIELD.equals(name))
-                || (name.startsWith(MethodCreator.FIELD_FLAG_PREFIX))
-                || (name.startsWith(MethodCreator.METHOD_FLAG_PREFIX)));
+        return ((ClassManipulator.IM_FIELD.equals(name))
+                || (name.startsWith(ClassManipulator.FIELD_FLAG_PREFIX))
+                || (name.startsWith(ClassManipulator.METHOD_FLAG_PREFIX)));
     }
 
     /**
@@ -279,7 +279,7 @@ public class ClassChecker extends ClassV
     }
 
     private static boolean isManipulatedMethod(String name) {
-        return (name.startsWith(MethodCreator.PREFIX));
+        return (name.startsWith(ClassManipulator.PREFIX));
     }
 
     /**

Copied: 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java
 (from r1592340, 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCreator.java)
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java?p2=felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java&p1=felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCreator.java&r1=1592340&r2=1592381&rev=1592381&view=diff
==============================================================================
--- 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCreator.java
 (original)
+++ 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java
 Sun May  4 17:00:18 2014
@@ -36,7 +36,7 @@ import org.objectweb.asm.tree.LocalVaria
  * This class adapt the visited class to link the class with the container.
  * @author <a href="mailto:d...@felix.apache.org";>Felix Project Team</a>
  */
-public class MethodCreator extends ClassVisitor implements Opcodes {
+public class ClassManipulator extends ClassVisitor implements Opcodes {
 
     /**
      * Instance Manager Field.
@@ -140,7 +140,7 @@ public class MethodCreator extends Class
      * @param visitor : class visitor.
      * @param manipulator : the manipulator having analyzed the class.
      */
-    public MethodCreator(ClassVisitor visitor, Manipulator manipulator) {
+    public ClassManipulator(ClassVisitor visitor, Manipulator manipulator) {
         super(Opcodes.ASM5, visitor);
         m_manipulator = manipulator;
         m_fields = manipulator.getFields().keySet();
@@ -245,7 +245,7 @@ public class MethodCreator extends Class
     /**
      * Gets the method descriptor for the specified name and descriptor.
      * The method descriptor is looked inside the
-     * {@link MethodCreator#m_visitedMethods}
+     * {@link ClassManipulator#m_visitedMethods}
      * @param name the name of the method
      * @param desc the descriptor of the method
      * @return the method descriptor or <code>null</code> if not found.
@@ -384,6 +384,7 @@ public class MethodCreator extends Class
                                       List<LocalVariableNode> localVariables, 
List<AnnotationDescriptor> annotations,
                                       Map<Integer, List<AnnotationDescriptor>> 
paramAnnotations) {
         GeneratorAdapter mv = new GeneratorAdapter(cv.visitMethod(access, 
name, desc, signature, exceptions), access, name, desc);
+        mv.visitCode();
 
         // If we have variables, we wraps the code within labels. The 
`lifetime` of the variables are bound to those
         // two variables.
@@ -646,17 +647,7 @@ public class MethodCreator extends Class
         } else {
             itfs = interfaces;
         }
-        
-        // If version = 1.7, use 1.6 if the ipojo.downgrade.classes system 
property is either
-        // not set of set to true.
-        int theVersion = version;
-        //TODO HACK HERE !!!!
-        String downgrade = System.getProperty("ipojo.downgrade.classes");
-        if ((downgrade == null  || "true".equals(downgrade))  && version == 
Opcodes.V1_7) {
-            theVersion = Opcodes.V1_6;
-        }
-
-        cv.visit(theVersion, access, name, signature, superName, itfs);
+        cv.visit(version, access, name, signature, superName, itfs);
     }
 
     /**

Modified: 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java
 (original)
+++ 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java
 Sun May  4 17:00:18 2014
@@ -80,19 +80,6 @@ public class InnerClassAdapter extends C
         m_fields = manipulator.getFields().keySet();
     }
 
-    @Override
-    public void visit(int version, int access, String name, String signature, 
String superName, String[] interfaces) {
-        // If version = 1.7, use 1.6 if the ipojo.downgrade.classes system 
property is either
-        // not set of set to true.
-        int theVersion = version;
-        String downgrade = System.getProperty("ipojo.downgrade.classes");
-        //TODO FRAME HACK HERE
-        if ((downgrade == null  || "true".equals(downgrade))  && version == 
Opcodes.V1_7) {
-            theVersion = Opcodes.V1_6;
-        }
-        super.visit(theVersion, access, name, signature, superName, 
interfaces);
-    }
-
     /**
      * Visits a method.
      * This methods create a code visitor manipulating outer class field 
accesses.
@@ -140,16 +127,16 @@ public class InnerClassAdapter extends C
             }
 
             // The new name is the method name prefixed by the PREFIX.
-            MethodVisitor mv = super.visitMethod(access, MethodCreator.PREFIX 
+ name, desc, signature,
+            MethodVisitor mv = super.visitMethod(access, 
ClassManipulator.PREFIX + name, desc, signature,
                     exceptions);
-            return new MethodCodeAdapter(mv, m_outer, access,  
MethodCreator.PREFIX + name, desc, m_fields);
+            return new MethodCodeAdapter(mv, m_outer, access,  
ClassManipulator.PREFIX + name, desc, m_fields);
         } else {
             return super.visitMethod(access, name, desc, signature, 
exceptions);
         }
     }
 
     private String getMethodFlagName(String name, String desc) {
-        return MethodCreator.METHOD_FLAG_PREFIX + getMethodId(name, desc);
+        return ClassManipulator.METHOD_FLAG_PREFIX + getMethodId(name, desc);
     }
 
     private String getMethodId(String name, String desc) {
@@ -236,7 +223,7 @@ public class InnerClassAdapter extends C
 
         mv.visitVarInsn(ALOAD, 0);
         mv.loadArgs();
-        mv.visitMethodInsn(INVOKESPECIAL, m_name, MethodCreator.PREFIX + name, 
desc, false);
+        mv.visitMethodInsn(INVOKESPECIAL, m_name, ClassManipulator.PREFIX + 
name, desc, false);
         mv.visitInsn(returnType.getOpcode(IRETURN));
 
         // end of the non intercepted method invocation.
@@ -245,18 +232,18 @@ public class InnerClassAdapter extends C
 
         mv.visitVarInsn(ALOAD, 0);
         mv.visitFieldInsn(GETFIELD, m_name, "this$0", "L" + m_outer + ";");
-        mv.visitFieldInsn(GETFIELD, m_outer, MethodCreator.IM_FIELD, 
"Lorg/apache/felix/ipojo/InstanceManager;");
+        mv.visitFieldInsn(GETFIELD, m_outer, ClassManipulator.IM_FIELD, 
"Lorg/apache/felix/ipojo/InstanceManager;");
         mv.visitVarInsn(ALOAD, 0);
         mv.visitLdcInsn(getMethodId(name, desc));
         mv.loadArgArray();
-        mv.visitMethodInsn(INVOKEVIRTUAL, 
"org/apache/felix/ipojo/InstanceManager", MethodCreator.ENTRY,
+        mv.visitMethodInsn(INVOKEVIRTUAL, 
"org/apache/felix/ipojo/InstanceManager", ClassManipulator.ENTRY,
                 "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V", 
false);
 
         mv.visitVarInsn(ALOAD, 0);
 
         // Do not allow argument modification : just reload arguments.
         mv.loadArgs();
-        mv.visitMethodInsn(INVOKESPECIAL, m_name, MethodCreator.PREFIX + name, 
desc, false);
+        mv.visitMethodInsn(INVOKESPECIAL, m_name, ClassManipulator.PREFIX + 
name, desc, false);
 
         if (returnType.getSort() != Type.VOID) {
             mv.visitVarInsn(returnType.getOpcode(ISTORE), result);
@@ -264,7 +251,7 @@ public class InnerClassAdapter extends C
 
         mv.visitVarInsn(ALOAD, 0);
         mv.visitFieldInsn(GETFIELD, m_name, "this$0", "L" + m_outer + ";");
-        mv.visitFieldInsn(GETFIELD, m_outer, MethodCreator.IM_FIELD, 
"Lorg/apache/felix/ipojo/InstanceManager;");
+        mv.visitFieldInsn(GETFIELD, m_outer, ClassManipulator.IM_FIELD, 
"Lorg/apache/felix/ipojo/InstanceManager;");
         mv.visitVarInsn(ALOAD, 0);
         mv.visitLdcInsn(getMethodId(name, desc));
         if (returnType.getSort() != Type.VOID) {
@@ -274,7 +261,7 @@ public class InnerClassAdapter extends C
             mv.visitInsn(ACONST_NULL);
         }
         mv.visitMethodInsn(INVOKEVIRTUAL, 
"org/apache/felix/ipojo/InstanceManager",
-                MethodCreator.EXIT, 
"(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false);
+                ClassManipulator.EXIT, 
"(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false);
 
         mv.visitLabel(l1);
         Label l7 = new Label();
@@ -284,11 +271,11 @@ public class InnerClassAdapter extends C
         mv.visitVarInsn(ASTORE, exception);
         mv.visitVarInsn(ALOAD, 0);
         mv.visitFieldInsn(GETFIELD, m_name, "this$0", "L" + m_outer + ";");
-        mv.visitFieldInsn(GETFIELD, m_outer, MethodCreator.IM_FIELD, 
"Lorg/apache/felix/ipojo/InstanceManager;");
+        mv.visitFieldInsn(GETFIELD, m_outer, ClassManipulator.IM_FIELD, 
"Lorg/apache/felix/ipojo/InstanceManager;");
         mv.visitVarInsn(ALOAD, 0);
         mv.visitLdcInsn(getMethodId(name, desc));
         mv.visitVarInsn(ALOAD, exception);
-        mv.visitMethodInsn(INVOKEVIRTUAL, 
"org/apache/felix/ipojo/InstanceManager", MethodCreator.ERROR,
+        mv.visitMethodInsn(INVOKEVIRTUAL, 
"org/apache/felix/ipojo/InstanceManager", ClassManipulator.ERROR,
                 
"(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Throwable;)V", false);
         mv.visitVarInsn(ALOAD, exception);
         mv.visitInsn(ATHROW);
@@ -337,7 +324,7 @@ public class InnerClassAdapter extends C
     /**
      * Gets the method descriptor for the specified name and descriptor.
      * The method descriptor is looked inside the
-     * {@link MethodCreator#m_visitedMethods}
+     * {@link ClassManipulator#m_visitedMethods}
      * @param name the name of the method
      * @param desc the descriptor of the method
      * @return the method descriptor or <code>null</code> if not found.

Modified: 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
 (original)
+++ 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
 Sun May  4 17:00:18 2014
@@ -24,6 +24,7 @@ import org.apache.felix.ipojo.metadata.E
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassWriter;
 import org.objectweb.asm.Opcodes;
+import org.objectweb.asm.util.CheckClassAdapter;
 
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
@@ -118,9 +119,8 @@ public class Manipulator {
         if (!m_alreadyManipulated) {
             InputStream is2 = new ByteArrayInputStream(origin);
             ClassReader reader = new ClassReader(is2);
-            ClassWriter writer = new ClassWriter(ClassWriter.COMPUTE_MAXS);
-            //CheckClassAdapter ch = new CheckClassAdapter(writer);
-            MethodCreator process = new MethodCreator(writer, this);
+            ClassWriter writer = new 
NoClassLoaderClassWriter(ClassWriter.COMPUTE_FRAMES);
+            ClassManipulator process = new ClassManipulator(new 
CheckClassAdapter(writer, false), this);
             if (m_version >= Opcodes.V1_6) {
                 reader.accept(process, ClassReader.EXPAND_FRAMES);
             } else {
@@ -262,7 +262,7 @@ public class Manipulator {
             InputStream is1 = new ByteArrayInputStream(bytecode);
 
             ClassReader cr = new ClassReader(is1);
-            ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
+            ClassWriter cw = new 
NoClassLoaderClassWriter(ClassWriter.COMPUTE_FRAMES);
             InnerClassAdapter adapter = new InnerClassAdapter(inner, cw, 
m_className, this);
             if (m_version >= Opcodes.V1_6) {
                 cr.accept(adapter, ClassReader.EXPAND_FRAMES);

Added: 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/NoClassLoaderClassWriter.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/NoClassLoaderClassWriter.java?rev=1592381&view=auto
==============================================================================
--- 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/NoClassLoaderClassWriter.java
 (added)
+++ 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/NoClassLoaderClassWriter.java
 Sun May  4 17:00:18 2014
@@ -0,0 +1,65 @@
+/*
+ * 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.felix.ipojo.manipulation;
+
+import org.objectweb.asm.ClassReader;
+import org.objectweb.asm.ClassWriter;
+
+/**
+ * An extension of {@link org.objectweb.asm.ClassWriter} that doe snot trigger 
class loading to compute the common super
+ * class. It generally returns Object.
+ */
+public class NoClassLoaderClassWriter extends ClassWriter {
+
+    private static final String OBJECT_INTERNAL_NAME = "java/lang/Object";
+
+    public NoClassLoaderClassWriter(ClassReader reader, int flags) {
+        super(reader, flags);
+    }
+
+    public NoClassLoaderClassWriter(int flags) {
+        super(flags);
+    }
+
+    /**
+     * Implements the common super class lookup to be a bit more permissive. 
First we check is type1 == type2,
+     * because in this case, the lookup is done. Then, if one of the class is 
Object,
+     * returns object. If both checks failed, it returns Object.
+     * @param type1 the first class
+     * @param type2 the second class
+     * @return the common super class
+     */
+    @Override
+    protected final String getCommonSuperClass(String type1, String type2) {
+        //If the two are equal then return either
+        if (type1.equals(type2)) {
+            return type1;
+        }
+
+        //If either is Object, then Object must be the answer
+        if (type1.equals(OBJECT_INTERNAL_NAME) || 
type2.equals(OBJECT_INTERNAL_NAME)) {
+            return OBJECT_INTERNAL_NAME;
+        }
+
+        // We shunt the rest of the process.
+        return OBJECT_INTERNAL_NAME;
+    }
+}
+

Modified: 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java
 (original)
+++ 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java
 Sun May  4 17:00:18 2014
@@ -25,7 +25,7 @@ import java.util.Dictionary;
 import java.util.List;
 import java.util.Map;
 
-import org.apache.felix.ipojo.manipulation.MethodCreator;
+import org.apache.felix.ipojo.manipulation.ClassManipulator;
 import org.objectweb.asm.Type;
 import org.objectweb.asm.tree.MethodNode;
 
@@ -53,8 +53,8 @@ public class Names {
      * the prefix.
      */
     public static String computeEffectiveMethodName(String name) {
-        if (name != null && name.startsWith(MethodCreator.PREFIX)) {
-            return name.substring(MethodCreator.PREFIX.length());
+        if (name != null && name.startsWith(ClassManipulator.PREFIX)) {
+            return name.substring(ClassManipulator.PREFIX.length());
         } else {
             return name;
         }

Modified: 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java
 (original)
+++ 
felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java
 Sun May  4 17:00:18 2014
@@ -19,7 +19,7 @@
 
 package org.apache.felix.ipojo.manipulator.render;
 
-import org.apache.felix.ipojo.manipulation.MethodCreator;
+import org.apache.felix.ipojo.manipulation.ClassManipulator;
 import org.apache.felix.ipojo.metadata.Attribute;
 import org.apache.felix.ipojo.metadata.Element;
 
@@ -41,7 +41,7 @@ public class ManipulatedMetadataFilter i
             // * manipulated methods
             // * fields for the InstanceManager
             // * InstanceManager setter
-            if (value.startsWith(MethodCreator.PREFIX)
+            if (value.startsWith(ClassManipulator.PREFIX)
                     || value.contains("org.apache.felix.ipojo.InstanceManager")
                     || value.contains("_setInstanceManager")) {
                 return true;

Modified: 
felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- 
felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java
 (original)
+++ 
felix/trunk/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java
 Sun May  4 17:00:18 2014
@@ -22,7 +22,7 @@ package org.apache.felix.ipojo.manipulat
 import junit.framework.Assert;
 import junit.framework.TestCase;
 import org.apache.felix.ipojo.InstanceManager;
-import org.apache.felix.ipojo.manipulation.MethodCreator;
+import org.apache.felix.ipojo.manipulation.ClassManipulator;
 import org.apache.felix.ipojo.metadata.Attribute;
 import org.apache.felix.ipojo.metadata.Element;
 
@@ -37,7 +37,7 @@ public class ManipulatedMetadataFilterTe
 
     public void testFilterPrefixedMethod() throws Exception {
         Element main = new Element("test", null);
-        main.addAttribute(new Attribute("name", MethodCreator.PREFIX + 
"PropertyName"));
+        main.addAttribute(new Attribute("name", ClassManipulator.PREFIX + 
"PropertyName"));
 
         Assert.assertTrue(filter.accept(main));
     }

Modified: felix/trunk/ipojo/runtime/api/pom.xml
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/api/pom.xml?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/api/pom.xml (original)
+++ felix/trunk/ipojo/runtime/api/pom.xml Sun May  4 17:00:18 2014
@@ -71,7 +71,8 @@
                             org.objectweb.asm.commons,
                             org.objectweb.asm.signature,
                             org.objectweb.asm,
-                            org.objectweb.asm.tree,
+                            org.objectweb.asm.tree*,
+                            org.objectweb.asm.util,
                             org.apache.felix.ipojo.manipulation*,
                             org.apache.felix.ipojo.manipulator*
                         </Private-Package>
@@ -124,10 +125,5 @@
             <artifactId>org.apache.felix.ipojo.manipulator</artifactId>
             <version>1.11.3-SNAPSHOT</version>
         </dependency>
-        <dependency>
-            <groupId>asm</groupId>
-            <artifactId>asm-all</artifactId>
-            <version>3.3.1</version>
-        </dependency>
     </dependencies>
 </project>

Modified: 
felix/trunk/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- 
felix/trunk/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java
 (original)
+++ 
felix/trunk/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java
 Sun May  4 17:00:18 2014
@@ -75,24 +75,19 @@ public class PrimitiveComponentType exte
     private ComponentFactory m_factory;
 
     /**
-     * Component type metadata.
-     */
-    private Element m_metadata;
-
-    /**
      * List of provided services.
      */
-    private List m_services = new ArrayList(1);
+    private List<Service> m_services = new ArrayList<Service>(1);
 
     /**
      * List of service dependencies.
      */
-    private List m_dependencies = new ArrayList();
+    private List<Dependency> m_dependencies = new ArrayList<Dependency>();
 
     /**
      * List of configuration properties.
      */
-    private List m_properties = new ArrayList();
+    private List<Property> m_properties = new ArrayList<Property>();
 
     /**
      * The validate callback.
@@ -105,7 +100,7 @@ public class PrimitiveComponentType exte
     private String m_invalidate;
 
     /**
-     * The udpated callback.
+     * The updated callback.
      */
     private String m_updated;
 
@@ -132,13 +127,13 @@ public class PrimitiveComponentType exte
     /**
      * The temporal dependencies.
      */
-    private ArrayList m_temporals = new ArrayList();
+    private ArrayList<TemporalDependency> m_temporals = new 
ArrayList<TemporalDependency>();
 
     /**
      * List of Handler representing external
      * handler configuration.
      */
-    private List m_handlers = new ArrayList();
+    private List<HandlerConfiguration> m_handlers = new 
ArrayList<HandlerConfiguration>();
 
 
     /**
@@ -363,16 +358,13 @@ public class PrimitiveComponentType exte
         if (m_immediate) {
             element.addAttribute(new Attribute("immediate", "true"));
         }
-        for (int i = 0; i < m_services.size(); i++) {
-            Service svc = (Service) m_services.get(i);
+        for (Service svc : m_services) {
             element.addElement(svc.getElement());
         }
-        for (int i = 0; i < m_dependencies.size(); i++) {
-            Dependency dep = (Dependency) m_dependencies.get(i);
+        for (Dependency dep : m_dependencies) {
             element.addElement(dep.getElement());
         }
-        for (int i = 0; i < m_temporals.size(); i++) {
-            TemporalDependency dep = (TemporalDependency) m_temporals.get(i);
+        for (TemporalDependency dep : m_temporals) {
             element.addElement(dep.getElement());
         }
         if (m_validate != null) {
@@ -401,16 +393,14 @@ public class PrimitiveComponentType exte
             if (m_updated != null) {
                 properties.addAttribute(new Attribute("updated", m_updated));
             }
-            for (int i = 0; i < m_properties.size(); i++) {
-                Property prop = (Property) m_properties.get(i);
+            for (Property prop : m_properties) {
                 properties.addElement(prop.getElement());
             }
             element.addElement(properties);
         }
 
         // External handlers
-        for (int i = 0; i < m_handlers.size(); i++) {
-            HandlerConfiguration hc = (HandlerConfiguration) m_handlers.get(i);
+        for (HandlerConfiguration hc : m_handlers) {
             element.addElement(hc.getElement());
         }
 
@@ -436,8 +426,8 @@ public class PrimitiveComponentType exte
     private void createFactory() {
         ensureValidity();
         byte[] clazz = manipulate();
-        m_metadata = generateComponentMetadata();
-        Element meta = m_metadata;
+
+        Element meta = generateComponentMetadata();
         meta.addElement(m_manipulation);
         try {
             if (m_alreadyManipulated) { // Already manipulated

Modified: felix/trunk/ipojo/runtime/composite/pom.xml
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/composite/pom.xml?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/composite/pom.xml (original)
+++ felix/trunk/ipojo/runtime/composite/pom.xml Sun May  4 17:00:18 2014
@@ -82,7 +82,7 @@
                             org.apache.felix.ipojo.parser,
                             org.apache.felix.ipojo.util,
                             org.osgi.framework;version=1.3,
-                            !org.objectweb.asm.tree,
+                            !org.objectweb.asm.tree*,
                             !org.apache.felix.ipojo.xml.parser,
                             !org.apache.felix.ipojo.annotations,
                             *
@@ -94,8 +94,10 @@
                             org.apache.felix.ipojo.composite.util,
                             <!-- ASM (Manipulator dependencies) -->
                             org.objectweb.asm.commons,
+                            org.objectweb.asm.util,
                             org.objectweb.asm.signature,
                             org.objectweb.asm,
+                            org.objectweb.asm.tree*,
                             org.apache.felix.ipojo.manipulation*,
                             org.apache.felix.ipojo.manipulator*
                         </Private-Package>

Modified: felix/trunk/ipojo/runtime/core-it/pom.xml
URL: 
http://svn.apache.org/viewvc/felix/trunk/ipojo/runtime/core-it/pom.xml?rev=1592381&r1=1592380&r2=1592381&view=diff
==============================================================================
--- felix/trunk/ipojo/runtime/core-it/pom.xml (original)
+++ felix/trunk/ipojo/runtime/core-it/pom.xml Sun May  4 17:00:18 2014
@@ -93,8 +93,8 @@
                 <artifactId>maven-compiler-plugin</artifactId>
                 <version>2.5.1</version>
                 <configuration>
-                    <source>1.6</source>
-                    <target>1.6</target>
+                    <source>1.7</source>
+                    <target>1.7</target>
                 </configuration>
             </plugin>
 


Reply via email to