You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cl...@apache.org on 2014/05/04 14:36:11 UTC
svn commit: r1592340 [2/3] - in /felix/trunk/ipojo:
handler/temporal/temporal-dependency-handler/ manipulator/manipulator-bom/
manipulator/manipulator-it/
manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipo...
Modified: 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/MethodCreator.java?rev=1592340&r1=1592339&r2=1592340&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/MethodCreator.java Sun May 4 12:36:09 2014
@@ -22,7 +22,6 @@ package org.apache.felix.ipojo.manipulat
import java.util.*;
import org.apache.felix.ipojo.manipulation.ClassChecker.AnnotationDescriptor;
-import org.objectweb.asm.ClassAdapter;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
@@ -31,14 +30,13 @@ import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.GeneratorAdapter;
import org.objectweb.asm.tree.LocalVariableNode;
-import org.objectweb.asm.tree.MethodNode;
/**
* iPOJO Class Adapter.
* 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 ClassAdapter implements Opcodes {
+public class MethodCreator extends ClassVisitor implements Opcodes {
/**
* Instance Manager Field.
@@ -139,11 +137,11 @@ public class MethodCreator extends Class
/**
* Constructor.
- * @param arg0 : class visitor.
+ * @param visitor : class visitor.
* @param manipulator : the manipulator having analyzed the class.
*/
- public MethodCreator(ClassVisitor arg0, Manipulator manipulator) {
- super(arg0);
+ public MethodCreator(ClassVisitor visitor, Manipulator manipulator) {
+ super(Opcodes.ASM5, visitor);
m_manipulator = manipulator;
m_fields = manipulator.getFields().keySet();
m_visitedMethods = manipulator.getMethods();
@@ -160,7 +158,8 @@ public class MethodCreator extends Class
* @param signature : signature
* @param superName : parent class
* @param interfaces : implemented interface
- * @see org.objectweb.asm.ClassAdapter#visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
+ * @see org.objectweb.asm.ClassVisitor#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_owner = name;
@@ -182,7 +181,8 @@ public class MethodCreator extends Class
* @param signature : signature
* @param exceptions : declared exceptions.
* @return the MethodVisitor wich will visit the method code.
- * @see org.objectweb.asm.ClassAdapter#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
+ * @see org.objectweb.asm.ClassVisitor#visitMethod(int, java.lang.String, java.lang.String, java.lang.String,
+ * java.lang.String[])
*/
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
// Avoid manipulating special methods
@@ -281,11 +281,11 @@ public class MethodCreator extends Class
if (type.getSort() == Type.ARRAY) {
String gDesc = "()" + desc;
- createArrayGetter(name, gDesc, type);
+ createArrayGetter(name, gDesc);
// Generates setter method
String sDesc = "(" + desc + ")V";
- createArraySetter(name, sDesc, type);
+ createArraySetter(name, sDesc);
} else {
// Generate the getter method
@@ -331,28 +331,24 @@ public class MethodCreator extends Class
mv.visitVarInsn(ALOAD, 0);
mv.visitInsn(ACONST_NULL);
mv.loadArgs();
- mv.visitMethodInsn(INVOKESPECIAL, m_owner, "<init>", newDesc);
+ mv.visitMethodInsn(INVOKESPECIAL, m_owner, "<init>", newDesc, false);
mv.visitInsn(RETURN);
Label stop = new Label();
mv.visitLabel(stop);
// Move annotations
if (annotations != null) {
- for (int i = 0; i < annotations.size(); i++) {
- AnnotationDescriptor ad = annotations.get(i);
+ for (AnnotationDescriptor ad : annotations) {
ad.visitAnnotation(mv);
}
}
// Move parameter annotations if any
if (paramAnnotations != null && ! paramAnnotations.isEmpty()) {
- Iterator<Integer> ids = paramAnnotations.keySet().iterator();
- while(ids.hasNext()) {
- Integer id = ids.next();
+ for (Integer id : paramAnnotations.keySet()) {
List<AnnotationDescriptor> ads = paramAnnotations.get(id);
- for (int i = 0; i < ads.size(); i++) {
- AnnotationDescriptor ad = ads.get(i);
- ad.visitParameterAnnotation(id.intValue(), mv);
+ for (AnnotationDescriptor ad : ads) {
+ ad.visitParameterAnnotation(id, mv);
}
}
}
@@ -404,7 +400,7 @@ public class MethodCreator extends Class
// Compute result and exception stack location
int result = -1;
- int exception = -1;
+ int exception;
//int arguments = mv.newLocal(Type.getType((new Object[0]).getClass()));
@@ -428,7 +424,7 @@ public class MethodCreator extends Class
mv.visitVarInsn(ALOAD, 0);
mv.loadArgs();
- mv.visitMethodInsn(INVOKESPECIAL, m_owner, PREFIX + name, desc);
+ mv.visitMethodInsn(INVOKESPECIAL, m_owner, PREFIX + name, desc, false);
mv.visitInsn(returnType.getOpcode(IRETURN));
// end of the non intercepted method invocation.
@@ -440,13 +436,14 @@ public class MethodCreator extends Class
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(generateMethodId(name, desc));
mv.loadArgArray();
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", ENTRY, "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", 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_owner, PREFIX + name, desc);
+ mv.visitMethodInsn(INVOKESPECIAL, m_owner, PREFIX + name, desc, false);
if (returnType.getSort() != Type.VOID) {
mv.visitVarInsn(returnType.getOpcode(ISTORE), result);
@@ -462,7 +459,8 @@ public class MethodCreator extends Class
} else {
mv.visitInsn(ACONST_NULL);
}
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", EXIT, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", EXIT,
+ "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false);
mv.visitLabel(l1);
Label l7 = new Label();
@@ -475,7 +473,8 @@ public class MethodCreator extends Class
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(generateMethodId(name, desc));
mv.visitVarInsn(ALOAD, exception);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", ERROR, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Throwable;)V");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", ERROR,
+ "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Throwable;)V", false);
mv.visitVarInsn(ALOAD, exception);
mv.visitInsn(ATHROW);
@@ -494,21 +493,17 @@ public class MethodCreator extends Class
// Move annotations
if (annotations != null) {
- for (int i = 0; i < annotations.size(); i++) {
- AnnotationDescriptor ad = annotations.get(i);
+ for (AnnotationDescriptor ad : annotations) {
ad.visitAnnotation(mv);
}
}
// Move parameter annotations
if (paramAnnotations != null && ! paramAnnotations.isEmpty()) {
- Iterator<Integer> ids = paramAnnotations.keySet().iterator();
- while(ids.hasNext()) {
- Integer id = ids.next();
+ for (Integer id : paramAnnotations.keySet()) {
List<AnnotationDescriptor> ads = paramAnnotations.get(id);
- for (int i = 0; i < ads.size(); i++) {
- AnnotationDescriptor ad = ads.get(i);
- ad.visitParameterAnnotation(id.intValue(), mv);
+ for (AnnotationDescriptor ad : ads) {
+ ad.visitParameterAnnotation(id, mv);
}
}
}
@@ -638,17 +633,15 @@ public class MethodCreator extends Class
// Add the POJO interface to the interface list
// Check that the POJO interface is not already in the list
boolean found = false;
- for (int i = 0; i < interfaces.length; i++) {
- if (interfaces[i].equals(POJO)) {
+ for (String anInterface : interfaces) {
+ if (anInterface.equals(POJO)) {
found = true;
}
}
String[] itfs;
if (!found) {
itfs = new String[interfaces.length + 1];
- for (int i = 0; i < interfaces.length; i++) {
- itfs[i] = interfaces[i];
- }
+ System.arraycopy(interfaces, 0, itfs, 0, interfaces.length);
itfs[interfaces.length] = POJO;
} else {
itfs = interfaces;
@@ -657,6 +650,7 @@ public class MethodCreator extends Class
// 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;
@@ -668,7 +662,7 @@ public class MethodCreator extends Class
/**
* Visit end.
* Create helper methods.
- * @see org.objectweb.asm.ClassAdapter#visitEnd()
+ * @see org.objectweb.asm.ClassVisitor#visitEnd()
*/
public void visitEnd() {
// Create the component manager setter method
@@ -700,13 +694,13 @@ public class MethodCreator extends Class
// Super call
mv.visitVarInsn(ALOAD, 0);
- mv.visitMethodInsn(INVOKESPECIAL, m_superclass, "<init>", "()V");
+ mv.visitMethodInsn(INVOKESPECIAL, m_superclass, "<init>", "()V", false);
// Call set instance manager
mv.visitVarInsn(ALOAD, 0);
mv.visitVarInsn(ALOAD, 1);
mv.visitMethodInsn(INVOKEVIRTUAL, m_owner, "_setInstanceManager",
- "(Lorg/apache/felix/ipojo/InstanceManager;)V");
+ "(Lorg/apache/felix/ipojo/InstanceManager;)V", false);
mv.visitInsn(RETURN);
mv.visitMaxs(0, 0);
@@ -733,18 +727,17 @@ public class MethodCreator extends Class
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", "getRegistredFields", "()Ljava/util/Set;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", "getRegistredFields",
+ "()Ljava/util/Set;", false);
mv.visitVarInsn(ASTORE, 2);
mv.visitVarInsn(ALOAD, 2);
Label endif = new Label();
mv.visitJumpInsn(IFNULL, endif);
- Iterator<String> it = m_fields.iterator();
- while (it.hasNext()) {
- String field = it.next();
+ for (String field : m_fields) {
mv.visitVarInsn(ALOAD, 2);
mv.visitLdcInsn(field);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Set", "contains", "(Ljava/lang/Object;)Z");
+ mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Set", "contains", "(Ljava/lang/Object;)Z", true);
Label l3 = new Label();
mv.visitJumpInsn(IFEQ, l3);
mv.visitVarInsn(ALOAD, 0);
@@ -756,19 +749,19 @@ public class MethodCreator extends Class
mv.visitVarInsn(ALOAD, 0);
mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", "getRegistredMethods", "()Ljava/util/Set;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", "getRegistredMethods",
+ "()Ljava/util/Set;", false);
mv.visitVarInsn(ASTORE, 2);
mv.visitVarInsn(ALOAD, 2);
Label endif2 = new Label();
mv.visitJumpInsn(IFNULL, endif2);
- for (int i = 0; i < m_methods.size(); i++) {
- String methodId = m_methods.get(i);
+ for (String methodId : m_methods) {
if (!methodId.equals("<init>")) {
mv.visitVarInsn(ALOAD, 2);
mv.visitLdcInsn(methodId);
- mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Set", "contains", "(Ljava/lang/Object;)Z");
+ mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Set", "contains", "(Ljava/lang/Object;)Z", true);
Label l3 = new Label();
mv.visitJumpInsn(IFEQ, l3);
mv.visitVarInsn(ALOAD, 0);
@@ -802,9 +795,8 @@ public class MethodCreator extends Class
* Create a getter method for an array.
* @param name : field name
* @param desc : method description
- * @param type : contained type (inside the array)
*/
- private void createArraySetter(String name, String desc, Type type) {
+ private void createArraySetter(String name, String desc) {
MethodVisitor mv = cv.visitMethod(0, "__set" + name, desc, null, null);
mv.visitCode();
@@ -829,7 +821,8 @@ public class MethodCreator extends Class
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, 1);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET,
+ "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false);
mv.visitInsn(RETURN);
@@ -842,9 +835,8 @@ public class MethodCreator extends Class
* Create a setter method for an array.
* @param name : field name
* @param desc : method description
- * @param type : contained type (inside the array)
*/
- private void createArrayGetter(String name, String desc, Type type) {
+ private void createArrayGetter(String name, String desc) {
String methodName = "__get" + name;
MethodVisitor mv = cv.visitMethod(0, methodName, desc, null, null);
mv.visitCode();
@@ -864,7 +856,8 @@ public class MethodCreator extends Class
mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(name);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", GET,
+ "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false);
mv.visitTypeInsn(CHECKCAST, internalType);
mv.visitInsn(ARETURN);
@@ -912,7 +905,8 @@ public class MethodCreator extends Class
mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(name);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager",
+ GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false);
mv.visitVarInsn(ASTORE, 1);
mv.visitVarInsn(ALOAD, 1);
@@ -920,7 +914,7 @@ public class MethodCreator extends Class
mv.visitVarInsn(ASTORE, 2);
mv.visitVarInsn(ALOAD, 2);
- mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName);
+ mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName, false);
mv.visitInsn(type.getOpcode(IRETURN));
break;
@@ -944,7 +938,8 @@ public class MethodCreator extends Class
mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(name);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager",
+ GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false);
mv.visitVarInsn(ASTORE, 1);
mv.visitVarInsn(ALOAD, 1);
@@ -952,7 +947,7 @@ public class MethodCreator extends Class
mv.visitVarInsn(ASTORE, 2);
mv.visitVarInsn(ALOAD, 2);
- mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName);
+ mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName, false);
mv.visitInsn(LRETURN);
break;
@@ -977,7 +972,8 @@ public class MethodCreator extends Class
mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(name);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager",
+ GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false);
mv.visitVarInsn(ASTORE, 1);
mv.visitVarInsn(ALOAD, 1);
@@ -985,7 +981,7 @@ public class MethodCreator extends Class
mv.visitVarInsn(ASTORE, 2);
mv.visitVarInsn(ALOAD, 2);
- mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName);
+ mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName, false);
mv.visitInsn(DRETURN);
break;
@@ -1010,7 +1006,8 @@ public class MethodCreator extends Class
mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(name);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager",
+ GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false);
mv.visitVarInsn(ASTORE, 1);
mv.visitVarInsn(ALOAD, 1);
@@ -1018,7 +1015,7 @@ public class MethodCreator extends Class
mv.visitVarInsn(ASTORE, 2);
mv.visitVarInsn(ALOAD, 2);
- mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName);
+ mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName, false);
mv.visitInsn(FRETURN);
break;
@@ -1039,7 +1036,8 @@ public class MethodCreator extends Class
mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;");
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(name);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager",
+ GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false);
mv.visitTypeInsn(CHECKCAST, type.getInternalName());
mv.visitInsn(ARETURN);
@@ -1091,7 +1089,7 @@ public class MethodCreator extends Class
mv.visitTypeInsn(NEW, boxingType);
mv.visitInsn(DUP);
mv.visitVarInsn(type.getOpcode(ILOAD), 1);
- mv.visitMethodInsn(INVOKESPECIAL, boxingType, "<init>", "(" + internalName + ")V");
+ mv.visitMethodInsn(INVOKESPECIAL, boxingType, "<init>", "(" + internalName + ")V", false);
mv.visitVarInsn(ASTORE, 2);
Label l2 = new Label();
@@ -1101,7 +1099,8 @@ public class MethodCreator extends Class
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, 2);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET,
+ "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false);
Label l3 = new Label();
mv.visitLabel(l3);
@@ -1130,7 +1129,7 @@ public class MethodCreator extends Class
mv.visitTypeInsn(NEW, boxingType);
mv.visitInsn(DUP);
mv.visitVarInsn(type.getOpcode(ILOAD), 1);
- mv.visitMethodInsn(INVOKESPECIAL, boxingType, "<init>", "(" + internalName + ")V");
+ mv.visitMethodInsn(INVOKESPECIAL, boxingType, "<init>", "(" + internalName + ")V", false);
mv.visitVarInsn(ASTORE, 3); // Double space
l2 = new Label();
@@ -1140,7 +1139,8 @@ public class MethodCreator extends Class
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, 3);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager",
+ SET, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false);
l3 = new Label();
mv.visitLabel(l3);
@@ -1164,7 +1164,8 @@ public class MethodCreator extends Class
mv.visitVarInsn(ALOAD, 0);
mv.visitLdcInsn(name);
mv.visitVarInsn(ALOAD, 1);
- mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V");
+ mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET,
+ "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false);
mv.visitInsn(RETURN);
break;
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java Sun May 4 12:36:09 2014
@@ -23,11 +23,7 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.BindingRegistry;
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
-import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.FieldVisitor;
-import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.Opcodes;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.*;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.MethodNode;
@@ -35,7 +31,7 @@ import org.objectweb.asm.tree.MethodNode
/**
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ClassMetadataCollector extends EmptyVisitor {
+public class ClassMetadataCollector extends ClassVisitor {
/**
* Binding's registry.
@@ -62,6 +58,7 @@ public class ClassMetadataCollector exte
private Element instanceMetadata;
public ClassMetadataCollector(BindingRegistry registry, Reporter reporter) {
+ super(Opcodes.ASM5);
this.registry = registry;
this.reporter = reporter;
node = new ClassNode();
@@ -69,6 +66,7 @@ public class ClassMetadataCollector exte
/**
* Build metadata. May be {@literal null} if no "component type" was found.
+ *
* @return Build metadata. May be {@literal null} if no "component type" was found.
*/
public Element getComponentMetadata() {
@@ -77,6 +75,7 @@ public class ClassMetadataCollector exte
/**
* Build instance metadata. May be {@literal null} if no "component type" was found.
+ *
* @return Build metadata. May be {@literal null} if no "component type" was found.
*/
public Element getInstanceMetadata() {
@@ -92,10 +91,11 @@ public class ClassMetadataCollector exte
/**
* Visit class annotations.
* This method detects @component and @provides annotations.
- * @param desc : annotation descriptor.
+ *
+ * @param desc : annotation descriptor.
* @param visible : is the annotation visible at runtime.
* @return the annotation visitor.
- * @see org.objectweb.asm.ClassAdapter#visitAnnotation(java.lang.String, boolean)
+ * @see org.objectweb.asm.ClassVisitor#visitAnnotation(java.lang.String, boolean)
*/
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
@@ -110,13 +110,15 @@ public class ClassMetadataCollector exte
/**
* Visit a field.
* Call the field collector visitor.
- * @param access : field access.
- * @param name : field name
- * @param desc : field descriptor
+ *
+ * @param access : field access.
+ * @param name : field name
+ * @param desc : field descriptor
* @param signature : field signature
- * @param value : field value (static field only)
+ * @param value : field value (static field only)
* @return the field visitor.
- * @see org.objectweb.asm.ClassAdapter#visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object)
+ * @see org.objectweb.asm.ClassVisitor#visitField(int, java.lang.String, java.lang.String, java.lang.String,
+ * java.lang.Object)
*/
public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) {
return new FieldMetadataCollector(workbench, new FieldNode(access, name, desc, signature, value));
@@ -125,13 +127,14 @@ public class ClassMetadataCollector exte
/**
* Visit a method.
* Call the method collector visitor.
- * @param access : method access
- * @param name : method name
- * @param desc : method descriptor
- * @param signature : method signature
+ *
+ * @param access : method access
+ * @param name : method name
+ * @param desc : method descriptor
+ * @param signature : method signature
* @param exceptions : method exceptions
* @return the Method Visitor.
- * @see org.objectweb.asm.ClassAdapter#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
+ * @see org.objectweb.asm.ClassVisitor#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
*/
public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) {
return new MethodMetadataCollector(workbench, new MethodNode(access, name, desc, signature, exceptions), reporter);
@@ -139,7 +142,8 @@ public class ClassMetadataCollector exte
/**
* End of the visit : compute final elements.
- * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+ *
+ * @see org.objectweb.asm.ClassVisitor#visitEnd()
*/
@Override
public void visitEnd() {
@@ -153,8 +157,9 @@ public class ClassMetadataCollector exte
// That means that there is a missing 'component type' annotation
reporter.warn("Class %s has not been marked as a component type (no @Component, @Handler, " +
- "...). It will be ignored by the iPOJO manipulator.",
- workbench.getType().getClassName());
+ "...). It will be ignored by the iPOJO manipulator.",
+ workbench.getType().getClassName()
+ );
return;
} // else: no root and no elements
return;
@@ -165,7 +170,7 @@ public class ClassMetadataCollector exte
// If we have an instance declared and the component metadata has a name, we update the component's attribute
// of the instance (https://issues.apache.org/jira/browse/FELIX-4052).
- if (componentMetadata != null && componentMetadata.containsAttribute("name") && instanceMetadata != null) {
+ if (componentMetadata != null && componentMetadata.containsAttribute("name") && instanceMetadata != null) {
// Update the component attribute
instanceMetadata.addAttribute(new Attribute("component", componentMetadata.getAttribute("name")));
}
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/FieldMetadataCollector.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/FieldMetadataCollector.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/FieldMetadataCollector.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/FieldMetadataCollector.java Sun May 4 12:36:09 2014
@@ -22,13 +22,13 @@ package org.apache.felix.ipojo.manipulat
import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.BindingRegistry;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.FieldVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.FieldNode;
/**
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class FieldMetadataCollector extends EmptyVisitor implements FieldVisitor {
+public class FieldMetadataCollector extends FieldVisitor {
/**
* Binding's registry.
@@ -46,6 +46,7 @@ public class FieldMetadataCollector exte
private FieldNode node;
public FieldMetadataCollector(ComponentWorkbench workbench, FieldNode node) {
+ super(Opcodes.ASM5);
this.workbench = workbench;
this.node = node;
this.registry = workbench.getBindingRegistry();
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/MethodMetadataCollector.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/MethodMetadataCollector.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/MethodMetadataCollector.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/MethodMetadataCollector.java Sun May 4 12:36:09 2014
@@ -23,13 +23,13 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.BindingRegistry;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.MethodVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.MethodNode;
/**
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class MethodMetadataCollector extends EmptyVisitor implements MethodVisitor {
+public class MethodMetadataCollector extends MethodVisitor {
/**
* Binding's registry.
@@ -37,11 +37,6 @@ public class MethodMetadataCollector ext
private BindingRegistry registry;
/**
- * Output informations.
- */
- private Reporter reporter;
-
- /**
* The workbench currently in use.
*/
private ComponentWorkbench workbench;
@@ -52,8 +47,8 @@ public class MethodMetadataCollector ext
private MethodNode node;
public MethodMetadataCollector(ComponentWorkbench workbench, MethodNode node, Reporter reporter) {
+ super(Opcodes.ASM5);
this.workbench = workbench;
- this.reporter = reporter;
this.node = node;
this.registry = workbench.getBindingRegistry();
}
@@ -61,13 +56,12 @@ public class MethodMetadataCollector ext
/**
* Visit method annotations.
*
- * @param desc : annotation name.
+ * @param desc : annotation name.
* @param visible : is the annotation visible at runtime.
* @return the visitor paring the visited annotation.
- * @see org.objectweb.asm.commons.EmptyVisitor#visitAnnotation(java.lang.String, boolean)
+ * @see org.objectweb.asm.MethodVisitor#visitAnnotation(java.lang.String, boolean)
*/
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
-
// Return the visitor to be executed (may be null)
return registry.selection(workbench)
.method(this, node)
@@ -79,7 +73,7 @@ public class MethodMetadataCollector ext
/**
* Visit a parameter annotation.
*
- * @see org.objectweb.asm.commons.EmptyVisitor#visitParameterAnnotation(int, java.lang.String, boolean)
+ * @see org.objectweb.asm.MethodVisitor#visitParameterAnnotation(int, java.lang.String, boolean)
*/
public AnnotationVisitor visitParameterAnnotation(int index,
String desc,
@@ -98,5 +92,4 @@ public class MethodMetadataCollector ext
}
-
}
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java Sun May 4 12:36:09 2014
@@ -22,15 +22,14 @@ package org.apache.felix.ipojo.manipulat
import org.apache.felix.ipojo.annotations.HandlerBinding;
import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery;
import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
-import org.objectweb.asm.commons.EmptyVisitor;
/**
- * User: guillaume
- * Date: 09/07/13
- * Time: 14:52
+ * The annotation visitor responsible for parsing the {@link org.apache.felix.ipojo.annotations.HandlerBinding}
+ * annotation.
*/
-public class HandlerBindingDiscovery extends EmptyVisitor implements AnnotationDiscovery {
+public class HandlerBindingDiscovery extends AnnotationVisitor implements AnnotationDiscovery {
public static final String HANDLER_BINDING_DESCRIPTOR = Type.getType(HandlerBinding.class).getDescriptor();
@@ -38,6 +37,13 @@ public class HandlerBindingDiscovery ext
private String m_value = null;
private String m_namespace = null;
+ /**
+ * Constructs a new {@link org.objectweb.asm.AnnotationVisitor}.
+ */
+ public HandlerBindingDiscovery() {
+ super(Opcodes.ASM5);
+ }
+
public AnnotationVisitor visitAnnotation(final String desc) {
if (HANDLER_BINDING_DESCRIPTOR.equals(desc)) {
m_handlerBinding = true;
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java Sun May 4 12:36:09 2014
@@ -23,18 +23,20 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser.replay.AnnotationVisitorPlayback;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.ClassVisitor;
+import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
-import org.objectweb.asm.commons.EmptyVisitor;
/**
- * User: guillaume
- * Date: 01/07/13
- * Time: 15:59
+ *
*/
-public class AnnotationTypeVisitor extends EmptyVisitor implements ClassVisitor {
+public class AnnotationTypeVisitor extends ClassVisitor {
private AnnotationType annotationType;
+ public AnnotationTypeVisitor() {
+ super(Opcodes.ASM5);
+ }
+
@Override
public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) {
annotationType = new AnnotationType(Type.getObjectType(name));
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java Sun May 4 12:36:09 2014
@@ -19,20 +19,23 @@
package org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser.replay;
+import org.objectweb.asm.AnnotationVisitor;
+import org.objectweb.asm.Opcodes;
+
import java.util.ArrayList;
import java.util.List;
-import org.objectweb.asm.AnnotationVisitor;
-
/**
-* User: guillaume
-* Date: 30/05/13
-* Time: 17:22
-*/
-public class AnnotationRecorder implements AnnotationVisitor, Replay {
+ * Record annotation to be replayed later.
+ */
+public class AnnotationRecorder extends AnnotationVisitor implements Replay {
private List<Replay> m_replays = new ArrayList<Replay>();
+ public AnnotationRecorder() {
+ super(Opcodes.ASM5);
+ }
+
public void visit(final String name, final Object value) {
m_replays.add(new Visit(name, value));
}
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/module/DefaultBindingModule.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/module/DefaultBindingModule.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/module/DefaultBindingModule.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/module/DefaultBindingModule.java Sun May 4 12:36:09 2014
@@ -22,24 +22,10 @@ package org.apache.felix.ipojo.manipulat
import org.apache.felix.ipojo.annotations.*;
import org.apache.felix.ipojo.manipulator.Reporter;
import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ComponentVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ControllerVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.FieldPropertyVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.HandlerDeclarationVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.HandlerVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.InstantiateVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.LifecycleVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.MethodPropertyVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ParameterPropertyVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.PostRegistrationVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ProvidesVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.RequiresVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ServiceControllerVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.UpdatedVisitor;
+import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.*;
import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.bind.Action;
import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.bind.MethodBindVisitor;
import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.bind.ParameterBindVisitor;
-import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.GenericVisitor;
import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.GenericVisitorFactory;
import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Elements;
import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Names;
@@ -48,7 +34,6 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.manipulator.spi.BindingContext;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.MethodNode;
import javax.xml.parsers.DocumentBuilder;
@@ -113,7 +98,7 @@ public class DefaultBindingModule extend
.when(on(ElementType.FIELD))
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- return new RequiresVisitor(context.getWorkbench(), ((FieldNode) context.getNode()).name);
+ return new RequiresVisitor(context.getWorkbench(), context.getFieldNode().name);
}
})
.when(on(ElementType.PARAMETER))
@@ -126,14 +111,14 @@ public class DefaultBindingModule extend
bind(Controller.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- return new ControllerVisitor(context.getWorkbench(), ((FieldNode) context.getNode()).name);
+ return new ControllerVisitor(context.getWorkbench(), context.getFieldNode().name);
}
});
bind(ServiceProperty.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- String name = ((FieldNode) context.getNode()).name;
+ String name = context.getFieldNode().name;
ComponentWorkbench workbench = context.getWorkbench();
if (!workbench.getIds().containsKey("provides")) {
@@ -152,7 +137,7 @@ public class DefaultBindingModule extend
bind(ServiceController.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- String name = ((FieldNode) context.getNode()).name;
+ String name = context.getFieldNode().name;
ComponentWorkbench workbench = context.getWorkbench();
if (!workbench.getIds().containsKey("provides")) { // The provides annotation is already computed.
@@ -174,7 +159,7 @@ public class DefaultBindingModule extend
ComponentWorkbench workbench = context.getWorkbench();
Element properties = Elements.getPropertiesElement(workbench);
- String name = ((FieldNode) context.getNode()).name;
+ String name = context.getFieldNode().name;
return new FieldPropertyVisitor(name, properties);
}
@@ -186,7 +171,7 @@ public class DefaultBindingModule extend
ComponentWorkbench workbench = context.getWorkbench();
// @Property on method parameter
Element properties = Elements.getPropertiesElement(workbench);
- String name = ((MethodNode) context.getNode()).name;
+ String name = context.getMethodNode().name;
return new MethodPropertyVisitor(properties, name);
}
})
@@ -197,7 +182,7 @@ public class DefaultBindingModule extend
ComponentWorkbench workbench = context.getWorkbench();
// @Property on method parameter
Element properties = Elements.getPropertiesElement(workbench);
- MethodNode method = (MethodNode) context.getNode();
+ MethodNode method = context.getMethodNode();
return new ParameterPropertyVisitor(properties, method, context.getParameterIndex());
}
});
@@ -205,7 +190,7 @@ public class DefaultBindingModule extend
bind(Validate.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- MethodNode node = (MethodNode) context.getNode();
+ MethodNode node = context.getMethodNode();
return new LifecycleVisitor(context.getWorkbench(),
Names.computeEffectiveMethodName(node.name),
LifecycleVisitor.Transition.VALIDATE);
@@ -215,7 +200,7 @@ public class DefaultBindingModule extend
bind(Invalidate.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- MethodNode node = (MethodNode) context.getNode();
+ MethodNode node = context.getMethodNode();
return new LifecycleVisitor(context.getWorkbench(),
Names.computeEffectiveMethodName(node.name),
LifecycleVisitor.Transition.INVALIDATE);
@@ -225,7 +210,7 @@ public class DefaultBindingModule extend
bind(Updated.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- MethodNode node = (MethodNode) context.getNode();
+ MethodNode node = context.getMethodNode();
return new UpdatedVisitor(context.getWorkbench(),
Names.computeEffectiveMethodName(node.name));
}
@@ -234,7 +219,7 @@ public class DefaultBindingModule extend
bind(Bind.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- MethodNode node = (MethodNode) context.getNode();
+ MethodNode node = context.getMethodNode();
return new MethodBindVisitor(context.getWorkbench(), Action.BIND, node, context.getReporter());
}
});
@@ -242,7 +227,7 @@ public class DefaultBindingModule extend
bind(Unbind.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- MethodNode node = (MethodNode) context.getNode();
+ MethodNode node = context.getMethodNode();
return new MethodBindVisitor(context.getWorkbench(), Action.UNBIND, node, context.getReporter());
}
});
@@ -250,7 +235,7 @@ public class DefaultBindingModule extend
bind(Modified.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- MethodNode node = (MethodNode) context.getNode();
+ MethodNode node = context.getMethodNode();
return new MethodBindVisitor(context.getWorkbench(), Action.MODIFIED, node, context.getReporter());
}
});
@@ -258,7 +243,7 @@ public class DefaultBindingModule extend
bind(PostRegistration.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- MethodNode node = (MethodNode) context.getNode();
+ MethodNode node = context.getMethodNode();
return new PostRegistrationVisitor(context.getWorkbench(), node.name);
}
});
@@ -266,7 +251,7 @@ public class DefaultBindingModule extend
bind(PostUnregistration.class)
.to(new AnnotationVisitorFactory() {
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- MethodNode node = (MethodNode) context.getNode();
+ MethodNode node = context.getMethodNode();
return new PostRegistrationVisitor(context.getWorkbench(), node.name);
}
});
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistry.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistry.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistry.java Sun May 4 12:36:09 2014
@@ -19,13 +19,6 @@
package org.apache.felix.ipojo.manipulator.metadata.annotation.registry;
-import static java.util.Collections.emptyList;
-import static java.util.Collections.singletonList;
-import static org.apache.felix.ipojo.manipulator.spi.helper.Predicates.alwaysTrue;
-
-import java.util.List;
-import java.util.regex.Pattern;
-
import org.apache.felix.ipojo.manipulator.Reporter;
import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.FieldGenericVisitor;
import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.MethodGenericVisitor;
@@ -36,9 +29,13 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.manipulator.spi.BindingContext;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Type;
-import org.objectweb.asm.tree.ClassNode;
-import org.objectweb.asm.tree.FieldNode;
-import org.objectweb.asm.tree.MethodNode;
+
+import java.util.List;
+import java.util.regex.Pattern;
+
+import static java.util.Collections.emptyList;
+import static java.util.Collections.singletonList;
+import static org.apache.felix.ipojo.manipulator.spi.helper.Predicates.alwaysTrue;
/**
* User: guillaume
@@ -61,25 +58,25 @@ public class LegacyGenericBindingRegistr
binding.setFactory(new AnnotationVisitorFactory() {
// Need to build a new Element instance for each created visitor
public AnnotationVisitor newAnnotationVisitor(BindingContext context) {
- if (context.getNode() instanceof ClassNode) {
+ if (context.getClassNode() != null) {
return new TypeGenericVisitor(context.getWorkbench(),
- Elements.buildElement(type));
- } else if (context.getNode() instanceof FieldNode) {
+ Elements.buildElement(type));
+ } else if (context.getFieldNode() != null) {
return new FieldGenericVisitor(context.getWorkbench(),
- Elements.buildElement(type),
- (FieldNode) context.getNode());
+ Elements.buildElement(type),
+ context.getFieldNode());
- } else if ((context.getNode() instanceof MethodNode) &&
+ } else if ((context.getMethodNode() != null) &&
(context.getParameterIndex() == BindingContext.NO_INDEX)) {
return new MethodGenericVisitor(context.getWorkbench(),
- Elements.buildElement(type),
- (MethodNode) context.getNode());
+ Elements.buildElement(type),
+ context.getMethodNode());
} else {
// last case: method parameter annotation
return new ParameterGenericVisitor(context.getWorkbench(),
- Elements.buildElement(type),
- (MethodNode) context.getNode(),
- context.getParameterIndex());
+ Elements.buildElement(type),
+ context.getMethodNode(),
+ context.getParameterIndex());
}
}
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistry.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistry.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistry.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistry.java Sun May 4 12:36:09 2014
@@ -146,8 +146,7 @@ public class MetaAnnotationBindingRegist
(handler.getValue() == null)) {
// No attributes specified, use annotation type as element's source
element = Elements.buildElement(type);
- } else if ((handler.getNamespace() == null) &&
- (handler.getValue() != null)) {
+ } else if ((handler.getNamespace() == null)) {
// Namespace attribute is omitted
element = Elements.buildElement(handler.getValue());
} else {
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Selection.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Selection.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Selection.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Selection.java Sun May 4 12:36:09 2014
@@ -30,7 +30,6 @@ import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
-import org.objectweb.asm.tree.MemberNode;
import org.objectweb.asm.tree.MethodNode;
import java.lang.annotation.ElementType;
@@ -47,7 +46,9 @@ public class Selection {
private BindingRegistry registry;
private ComponentWorkbench workbench;
private Reporter reporter;
- private MemberNode node;
+ private FieldNode field;
+ private MethodNode method;
+ private ClassNode clazz;
private int index = BindingContext.NO_INDEX;
private String annotation;
private ElementType elementType = null;
@@ -61,21 +62,21 @@ public class Selection {
public Selection field(FieldVisitor visitor, FieldNode node) {
this.visitor = visitor;
- this.node = node;
+ this.field = node;
this.elementType = ElementType.FIELD;
return this;
}
public Selection method(MethodVisitor visitor, MethodNode node) {
this.visitor = visitor;
- this.node = node;
+ this.method = node;
this.elementType = ElementType.METHOD;
return this;
}
public Selection type(ClassVisitor visitor, ClassNode node) {
this.visitor = visitor;
- this.node = node;
+ this.clazz = node;
this.elementType = ElementType.TYPE;
return this;
}
@@ -83,7 +84,7 @@ public class Selection {
public Selection parameter(MethodVisitor visitor, MethodNode node, int index) {
this.visitor = visitor;
this.index = index;
- this.node = node;
+ this.method = node;
this.elementType = ElementType.PARAMETER;
return this;
}
@@ -110,8 +111,21 @@ public class Selection {
}
private List<AnnotationVisitor> list() {
+ BindingContext context;
+
+ if (elementType == ElementType.FIELD) {
+ context = new BindingContext(workbench, reporter, Type.getType(annotation), field,
+ elementType, index, visitor);
+ } else if (elementType == ElementType.TYPE) {
+ context = new BindingContext(workbench, reporter, Type.getType(annotation), clazz,
+ elementType, index, visitor);
+ } else {
+ // Parameter of method.
+ context = new BindingContext(workbench, reporter, Type.getType(annotation), method,
+ elementType, index, visitor);
+ }
+
- BindingContext context = new BindingContext(workbench, reporter, Type.getType(annotation), node, elementType, index, visitor);
List<Binding> predicates = registry.getBindings(annotation);
List<AnnotationVisitor> visitors = new ArrayList<AnnotationVisitor>();
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java Sun May 4 12:36:09 2014
@@ -24,14 +24,14 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
/**
* Parse the @Component annotation.
* @see org.apache.felix.ipojo.annotations.Component
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ComponentVisitor extends EmptyVisitor implements AnnotationVisitor {
+public class ComponentVisitor extends AnnotationVisitor {
private Reporter reporter;
@@ -45,6 +45,7 @@ public class ComponentVisitor extends Em
private ComponentWorkbench workbench;
public ComponentVisitor(ComponentWorkbench workbench, Reporter reporter) {
+ super(Opcodes.ASM5);
this.workbench = workbench;
this.reporter = reporter;
}
@@ -53,7 +54,7 @@ public class ComponentVisitor extends Em
* Visit @Component annotation attribute.
* @param name attribute name
* @param value attribute value
- * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
+ * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object)
*/
public void visit(String name, Object value) {
if (name.equals("public_factory") || name.equals("publicFactory")) {
@@ -115,7 +116,7 @@ public class ComponentVisitor extends Em
/**
* End of the visit.
* Append to the "component" element computed attribute.
- * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+ * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
*/
public void visitEnd() {
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ControllerVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ControllerVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ControllerVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ControllerVisitor.java Sun May 4 12:36:09 2014
@@ -23,27 +23,28 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
/**
* Parses the @Controller annotation.
* @see org.apache.felix.ipojo.annotations.Controller
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ControllerVisitor extends EmptyVisitor implements AnnotationVisitor {
+public class ControllerVisitor extends AnnotationVisitor {
private ComponentWorkbench workbench;
private String field;
public ControllerVisitor(ComponentWorkbench workbench, String field) {
+ super(Opcodes.ASM5);
this.workbench = workbench;
this.field = field;
}
/**
* Visit @Handler annotation attributes.
- * @see org.objectweb.asm.commons.EmptyVisitor#visit(String, Object)
+ * @see org.objectweb.asm.AnnotationVisitor#visit(String, Object)
*/
public void visitEnd() {
Element controller = new Element("controller", "");
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/FieldPropertyVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/FieldPropertyVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/FieldPropertyVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/FieldPropertyVisitor.java Sun May 4 12:36:09 2014
@@ -22,7 +22,7 @@ package org.apache.felix.ipojo.manipulat
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
/**
* Parses a Property or ServiceProperty annotation.
@@ -30,7 +30,7 @@ import org.objectweb.asm.commons.EmptyVi
* @see org.apache.felix.ipojo.annotations.Property
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class FieldPropertyVisitor extends EmptyVisitor implements AnnotationVisitor {
+public class FieldPropertyVisitor extends AnnotationVisitor {
/**
* Parent element element.
@@ -82,6 +82,7 @@ public class FieldPropertyVisitor extend
* @param field : field name.
*/
public FieldPropertyVisitor(String field, Element parent) {
+ super(Opcodes.ASM5);
m_parent = parent;
m_field = field;
}
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitor.java Sun May 4 12:36:09 2014
@@ -24,7 +24,7 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
@@ -40,7 +40,7 @@ import java.io.InputStream;
* @see org.apache.felix.ipojo.annotations.HandlerDeclaration
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class HandlerDeclarationVisitor extends EmptyVisitor implements AnnotationVisitor {
+public class HandlerDeclarationVisitor extends AnnotationVisitor {
/**
* XML accepted by the handler.
@@ -53,6 +53,7 @@ public class HandlerDeclarationVisitor e
private Reporter reporter;
public HandlerDeclarationVisitor(ComponentWorkbench workbench, DocumentBuilder builder, Reporter reporter) {
+ super(Opcodes.ASM5);
this.workbench = workbench;
this.builder = builder;
this.reporter = reporter;
@@ -62,7 +63,7 @@ public class HandlerDeclarationVisitor e
* Parses the value attribute.
* @param name 'value'
* @param value the value
- * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
+ * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object)
*/
public void visit(String name, Object value) {
// there is only a 'value' attribute
@@ -72,7 +73,7 @@ public class HandlerDeclarationVisitor e
/**
* End of the visit.
* Builds the XML document.
- * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+ * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
*/
public void visitEnd() {
// The value is an XML document
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerVisitor.java Sun May 4 12:36:09 2014
@@ -24,14 +24,15 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
/**
* Parses the @Handler annotation.
- * @see org.apache.felix.ipojo.annotations.Handler
+ *
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ * @see org.apache.felix.ipojo.annotations.Handler
*/
-public class HandlerVisitor extends EmptyVisitor implements AnnotationVisitor {
+public class HandlerVisitor extends AnnotationVisitor {
private Element handler = new Element("handler", "");
@@ -40,15 +41,17 @@ public class HandlerVisitor extends Empt
private Reporter reporter;
public HandlerVisitor(ComponentWorkbench workbench, Reporter reporter) {
+ super(Opcodes.ASM5);
this.workbench = workbench;
this.reporter = reporter;
}
/**
* Visit @Handler annotation attributes.
- * @param name : annotation attribute name
+ *
+ * @param name : annotation attribute name
* @param value : annotation attribute value
- * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
+ * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object)
*/
public void visit(String name, Object value) {
if (name.equals("name")) {
@@ -72,7 +75,8 @@ public class HandlerVisitor extends Empt
/**
* End of the visit.
* Append to the "component" element computed attribute.
- * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+ *
+ * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
*/
public void visitEnd() {
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/InstantiateVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/InstantiateVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/InstantiateVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/InstantiateVisitor.java Sun May 4 12:36:09 2014
@@ -23,28 +23,31 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
/**
* Parse the @Instantitate annotation.
- * @see org.apache.felix.ipojo.annotations.Instantiate
+ *
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ * @see org.apache.felix.ipojo.annotations.Instantiate
*/
-public class InstantiateVisitor extends EmptyVisitor implements AnnotationVisitor {
+public class InstantiateVisitor extends AnnotationVisitor {
private Element instance = new Element("instance", "");
private ComponentWorkbench workbench;
public InstantiateVisitor(ComponentWorkbench workbench) {
+ super(Opcodes.ASM5);
this.workbench = workbench;
}
/**
* Visit an annotation attribute.
- * @param name the attribute name
+ *
+ * @param name the attribute name
* @param value the attribute value
- * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
+ * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object)
*/
public void visit(String name, Object value) {
if (name.equals("name")) {
@@ -54,7 +57,8 @@ public class InstantiateVisitor extends
/**
* End of the visit. Creates the instance element.
- * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+ *
+ * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
*/
public void visitEnd() {
// We set the instance's component attribute to the class name, if the component type has a custom name,
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/LifecycleVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/LifecycleVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/LifecycleVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/LifecycleVisitor.java Sun May 4 12:36:09 2014
@@ -23,7 +23,7 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
/**
* Parse @Validate and @Invalidate annotations.
@@ -31,7 +31,7 @@ import org.objectweb.asm.commons.EmptyVi
* @see org.apache.felix.ipojo.annotations.Invalidate
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class LifecycleVisitor extends EmptyVisitor implements AnnotationVisitor {
+public class LifecycleVisitor extends AnnotationVisitor {
public static enum Transition {
VALIDATE, INVALIDATE
@@ -42,6 +42,7 @@ public class LifecycleVisitor extends Em
private Transition transition;
public LifecycleVisitor(ComponentWorkbench workbench, String name, Transition transition) {
+ super(Opcodes.ASM5);
this.workbench = workbench;
this.name = name;
this.transition = transition;
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/MethodPropertyVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/MethodPropertyVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/MethodPropertyVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/MethodPropertyVisitor.java Sun May 4 12:36:09 2014
@@ -22,14 +22,14 @@ package org.apache.felix.ipojo.manipulat
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
import static org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Names.computeEffectiveMethodName;
/**
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class MethodPropertyVisitor extends EmptyVisitor implements AnnotationVisitor {
+public class MethodPropertyVisitor extends AnnotationVisitor {
/**
* Parent element.
@@ -73,6 +73,7 @@ public class MethodPropertyVisitor exten
* @param method : attached method.
*/
public MethodPropertyVisitor(Element parent, String method) {
+ super(Opcodes.ASM5);
m_parent = parent;
m_method = method;
}
@@ -82,7 +83,7 @@ public class MethodPropertyVisitor exten
*
* @param name : annotation name
* @param value : annotation value
- * @see org.objectweb.asm.commons.EmptyVisitor#visit(java.lang.String, java.lang.Object)
+ * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object)
*/
public void visit(String name, Object value) {
if (name.equals("name")) {
@@ -110,7 +111,7 @@ public class MethodPropertyVisitor exten
* End of the visit.
* Append the computed element to the element element.
*
- * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+ * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
*/
public void visitEnd() {
Element prop = visitEndCommon();
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ParameterPropertyVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ParameterPropertyVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ParameterPropertyVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ParameterPropertyVisitor.java Sun May 4 12:36:09 2014
@@ -28,7 +28,7 @@ import org.objectweb.asm.tree.MethodNode
/**
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class ParameterPropertyVisitor extends MethodPropertyVisitor implements AnnotationVisitor {
+public class ParameterPropertyVisitor extends MethodPropertyVisitor {
/**
* If this is a parameter annotation, the index of the parameter.
@@ -54,7 +54,7 @@ public class ParameterPropertyVisitor ex
* End of the visit.
* Append the computed element to the element element.
*
- * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd()
+ * @see org.objectweb.asm.AnnotationVisitor#visitEnd()
*/
public void visitEnd() {
Element prop = visitEndCommon();
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostRegistrationVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostRegistrationVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostRegistrationVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostRegistrationVisitor.java Sun May 4 12:36:09 2014
@@ -23,25 +23,26 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
/**
- * @see org.apache.felix.ipojo.annotations.PostRegistration
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ * @see org.apache.felix.ipojo.annotations.PostRegistration
*/
-public class PostRegistrationVisitor extends EmptyVisitor implements AnnotationVisitor {
+public class PostRegistrationVisitor extends AnnotationVisitor {
private ComponentWorkbench workbench;
private String name;
public PostRegistrationVisitor(ComponentWorkbench workbench, String name) {
+ super(Opcodes.ASM5);
this.workbench = workbench;
this.name = name;
}
@Override
public void visitEnd() {
- Element provides = null;
+ Element provides;
if (workbench.getIds().containsKey("provides")) {
provides = workbench.getIds().get("provides");
provides.addAttribute(new Attribute("post-registration", name));
Modified: felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostUnregistrationVisitor.java
URL: http://svn.apache.org/viewvc/felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostUnregistrationVisitor.java?rev=1592340&r1=1592339&r2=1592340&view=diff
==============================================================================
--- felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostUnregistrationVisitor.java (original)
+++ felix/trunk/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostUnregistrationVisitor.java Sun May 4 12:36:09 2014
@@ -23,25 +23,26 @@ import org.apache.felix.ipojo.manipulato
import org.apache.felix.ipojo.metadata.Attribute;
import org.apache.felix.ipojo.metadata.Element;
import org.objectweb.asm.AnnotationVisitor;
-import org.objectweb.asm.commons.EmptyVisitor;
+import org.objectweb.asm.Opcodes;
/**
* @see org.apache.felix.ipojo.annotations.PostUnregistration
* @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
*/
-public class PostUnregistrationVisitor extends EmptyVisitor implements AnnotationVisitor {
+public class PostUnregistrationVisitor extends AnnotationVisitor {
private ComponentWorkbench workbench;
private String name;
public PostUnregistrationVisitor(ComponentWorkbench workbench, String name) {
+ super(Opcodes.ASM5);
this.workbench = workbench;
this.name = name;
}
@Override
public void visitEnd() {
- Element provides = null;
+ Element provides;
if (workbench.getIds().containsKey("provides")) {
provides = workbench.getIds().get("provides");
provides.addAttribute(new Attribute("post-unregistration", name));