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
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1592381 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/manipulator/manipulator-it/pom.xml b/ipojo/manipulator/manipulator-it/pom.xml
index 99b94e2..81c2aed 100644
--- a/ipojo/manipulator/manipulator-it/pom.xml
+++ b/ipojo/manipulator/manipulator-it/pom.xml
@@ -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>
diff --git a/ipojo/manipulator/manipulator/pom.xml b/ipojo/manipulator/manipulator/pom.xml
index 484f362..12cd751 100644
--- a/ipojo/manipulator/manipulator/pom.xml
+++ b/ipojo/manipulator/manipulator/pom.xml
@@ -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>
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
index 1c2fc36..a83f0f7 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java
@@ -90,7 +90,7 @@
*/
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 @@
}
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 @@
}
private static boolean isManipulatedMethod(String name) {
- return (name.startsWith(MethodCreator.PREFIX));
+ return (name.startsWith(ClassManipulator.PREFIX));
}
/**
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCreator.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java
similarity index 98%
rename from ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCreator.java
rename to ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java
index 11a6cc6..de5fd3f 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCreator.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java
@@ -36,7 +36,7 @@
* This class adapt the visited class to link the class with the container.
* @author <a href="mailto:dev@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 @@
* @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 @@
/**
* 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 @@
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 @@
} 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);
}
/**
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java
index 35c682c..be26162 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java
@@ -80,19 +80,6 @@
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 @@
}
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
/**
* 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.
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
index 6c931c2..e7ffe00 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
@@ -24,6 +24,7 @@
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 @@
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 @@
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);
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/NoClassLoaderClassWriter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/NoClassLoaderClassWriter.java
new file mode 100644
index 0000000..d24ed82
--- /dev/null
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/NoClassLoaderClassWriter.java
@@ -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;
+ }
+}
+
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java
index 302de8e..e8da6ff 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java
@@ -25,7 +25,7 @@
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 @@
* 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;
}
diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java
index 32527f7..4b8fc3e 100644
--- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java
+++ b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java
@@ -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 @@
// * 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;
diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java
index 6e85bf1..64b446f 100644
--- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java
+++ b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java
@@ -22,7 +22,7 @@
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 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));
}
diff --git a/ipojo/runtime/api/pom.xml b/ipojo/runtime/api/pom.xml
index d484aca..30a263c 100644
--- a/ipojo/runtime/api/pom.xml
+++ b/ipojo/runtime/api/pom.xml
@@ -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>
diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java
index c90f03d..00bb278 100644
--- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java
+++ b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java
@@ -75,24 +75,19 @@
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 @@
private String m_invalidate;
/**
- * The udpated callback.
+ * The updated callback.
*/
private String m_updated;
@@ -132,13 +127,13 @@
/**
* 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 @@
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 @@
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 @@
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
diff --git a/ipojo/runtime/composite/pom.xml b/ipojo/runtime/composite/pom.xml
index 101e329..0f2c867 100644
--- a/ipojo/runtime/composite/pom.xml
+++ b/ipojo/runtime/composite/pom.xml
@@ -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>
diff --git a/ipojo/runtime/core-it/pom.xml b/ipojo/runtime/core-it/pom.xml
index 881a723..6dfb8e8 100644
--- a/ipojo/runtime/core-it/pom.xml
+++ b/ipojo/runtime/core-it/pom.xml
@@ -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>