Applied patch (FELIX-300) to change iPOJO to use ASM 3.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@542613 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/pom.xml b/ipojo/core/pom.xml
index d562295..610e81b 100644
--- a/ipojo/core/pom.xml
+++ b/ipojo/core/pom.xml
@@ -25,7 +25,7 @@
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
- <version>2.2.1</version>
+ <version>3.0</version>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java
index d45c862..8893540 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java
@@ -124,7 +124,7 @@
is = url.openStream();
cr = new ClassReader(is);
msv = new MethodSignatureVisitor();
- cr.accept(msv, true);
+ cr.accept(msv, ClassReader.SKIP_FRAMES);
is.close();
} catch (IOException e) {
m_handler.getManager().getFactory().getLogger().log(Logger.ERROR, "Cannot open " + name + " : " + e.getMessage());
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/manipulation/Manipulator.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/manipulation/Manipulator.java
index ff9b20a..eed45e8 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/manipulation/Manipulator.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/manipulation/Manipulator.java
@@ -79,7 +79,7 @@
// First check if the class is already manipulated :
ClassReader ckReader = new ClassReader(is1);
ClassChecker ck = new ClassChecker();
- ckReader.accept(ck, true);
+ ckReader.accept(ck, ClassReader.SKIP_FRAMES);
is1.close();
m_fields = ck.getFields();
@@ -104,9 +104,9 @@
// Instrument all fields
InputStream is2 = new ByteArrayInputStream(origin);
ClassReader cr0 = new ClassReader(is2);
- ClassWriter cw0 = new ClassWriter(true);
+ ClassWriter cw0 = new ClassWriter(ClassWriter.COMPUTE_MAXS);
PreprocessClassAdapter preprocess = new PreprocessClassAdapter(cw0);
- cr0.accept(preprocess, false);
+ cr0.accept(preprocess, ClassReader.SKIP_FRAMES);
is2.close();
finalWriter = cw0;
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/manipulation/POJOWriter.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/manipulation/POJOWriter.java
index 36ae9bc..3f304c4 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/manipulation/POJOWriter.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/composite/service/provides/manipulation/POJOWriter.java
@@ -95,12 +95,12 @@
is = url.openStream();
cr = new ClassReader(is);
MethodSignatureVisitor msv = new MethodSignatureVisitor();
- cr.accept(msv, true);
+ cr.accept(msv, ClassReader.SKIP_FRAMES);
is.close();
MethodSignature[] methodsSign = msv.getMethods();
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
// Create the class
className = className.replace('.', '/');
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
index 4d02926..899ddb9 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java
@@ -380,8 +380,8 @@
// Propagation of the properties to service registrations :
if (m_providedServiceHandler != null && !toPropagate.isEmpty()) {
m_providedServiceHandler.removeProperties(m_propagated);
-
- // Remove to name props
+
+ // Remove the name props
toPropagate.remove("name");
m_providedServiceHandler.addProperties(toPropagate);
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/NullableObjectWriter.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/NullableObjectWriter.java
index 132f56e..3b35a42 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/NullableObjectWriter.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/nullable/NullableObjectWriter.java
@@ -52,10 +52,10 @@
is = url.openStream();
cr = new ClassReader(is);
MethodSignatureVisitor msv = new MethodSignatureVisitor();
- cr.accept(msv, true);
+ cr.accept(msv, ClassReader.SKIP_FRAMES);
is.close();
- ClassWriter cw = new ClassWriter(true);
+ ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS);
// String[] segment = contractName.split("[.]");
// String className = "org/apache/felix/ipojo/" +
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
index 37fe087..5f57945 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java
@@ -143,7 +143,7 @@
private synchronized void removeProperty(String name) {
int idx = -1;
for (int i = 0; i < m_properties.length; i++) {
- if (m_properties[i].getName() == name) {
+ if (m_properties[i].getName().equals(name)) {
idx = i;
break;
}
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/FieldMetadata.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/FieldMetadata.java
index 46e0875..76180b1 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/FieldMetadata.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/parser/FieldMetadata.java
@@ -59,13 +59,23 @@
public String getReflectionType() {
// Primitive Array
if (m_type.endsWith("[]") && m_type.indexOf(".") == -1) {
- String t = m_type.substring(0, m_type.length() - 2);
- return "[" + getInternalPrimitiveType(t);
+ String arr = "";
+ for (int i = 0; i < m_type.length(); i++) {
+ if (m_type.charAt(i) == '[') { arr += '['; }
+ }
+ int index = m_type.indexOf('[');
+ String t = m_type.substring(0, index);
+ return arr + getInternalPrimitiveType(t);
}
// Non-Primitive Array
if (m_type.endsWith("[]") && m_type.indexOf(".") != -1) {
- String t = m_type.substring(0, m_type.length() - 2);
- return "[L" + t + ";";
+ String arr = "";
+ for (int i = 0; i < m_type.length(); i++) {
+ if (m_type.charAt(i) == '[') { arr += '['; }
+ }
+ int index = m_type.indexOf('[');
+ String t = m_type.substring(0, index);
+ return arr + "L" + t + ";";
}
// Simple type
if (!m_type.endsWith("[]")) {
diff --git a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Callback.java b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Callback.java
index b207565..7722076 100644
--- a/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Callback.java
+++ b/ipojo/core/src/main/java/org/apache/felix/ipojo/util/Callback.java
@@ -72,11 +72,21 @@
for (int i = 0; i < args.length; i++) {
// Primitive Array
if (args[i].endsWith("[]") && args[i].indexOf(".") == -1) {
- m_args[i] = "[" + getInternalPrimitiveType(args[i]);
+ String arr = "";
+ for (int j = 0; j < args[i].length(); j++) {
+ if (args[i].charAt(j) == '[') { arr += '['; }
+ }
+ int index = args[i].indexOf('[');
+ m_args[i] = arr + getInternalPrimitiveType(args[i].substring(0, index));
}
// Non-Primitive Array
if (args[i].endsWith("[]") && args[i].indexOf(".") != -1) {
- m_args[i] = "[L" + args[i] + ";";
+ String arr = "";
+ for (int j = 0; j < args[i].length(); j++) {
+ if (args[i].charAt(j) == '[') { arr += '['; }
+ }
+ int index = args[i].indexOf('[');
+ m_args[i] = arr + "L" + args[i].substring(0, index) + ";";
}
// Simple type
if (!args[i].endsWith("[]")) {
@@ -118,19 +128,26 @@
for (int i = 0; i < args.length; i++) {
// Primitive Array
if (args[i].endsWith("[]") && args[i].indexOf(".") == -1) {
- String t = args[i].substring(0, args[i].length() - 2);
- m_args[i] = "[" + getInternalPrimitiveType(t);
+ String arr = "";
+ for (int j = 0; j < args[i].length(); j++) {
+ if (args[i].charAt(j) == '[') { arr += '['; }
+ }
+ int index = args[i].indexOf('[');
+ m_args[i] = arr + getInternalPrimitiveType(args[i].substring(0, index));
}
// Non-Primitive Array
if (args[i].endsWith("[]") && args[i].indexOf(".") != -1) {
- String t = args[i].substring(0, args[i].length() - 2);
- m_args[i] = "[L" + t + ";";
+ String arr = "";
+ for (int j = 0; j < args[i].length(); j++) {
+ if (args[i].charAt(j) == '[') { arr += '['; }
+ }
+ int index = args[i].indexOf('[');
+ m_args[i] = arr + "L" + args[i].substring(0, index) + ";";
}
// Simple type
if (!args[i].endsWith("[]")) {
m_args[i] = args[i];
}
-
}
}
diff --git a/ipojo/plugin/pom.xml b/ipojo/plugin/pom.xml
index 3888168..463a3eb 100644
--- a/ipojo/plugin/pom.xml
+++ b/ipojo/plugin/pom.xml
@@ -33,7 +33,7 @@
<dependency>
<groupId>asm</groupId>
<artifactId>asm</artifactId>
- <version>2.2.1</version>
+ <version>3.0</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
diff --git a/ipojo/plugin/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java b/ipojo/plugin/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
index fa474d7..329f2eb 100644
--- a/ipojo/plugin/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
+++ b/ipojo/plugin/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java
@@ -106,7 +106,7 @@
// First check if the class is already manipulated :
ClassReader ckReader = new ClassReader(is1);
ClassChecker ck = new ClassChecker();
- ckReader.accept(ck, true);
+ ckReader.accept(ck, ckReader.SKIP_FRAMES);
is1.close();
m_fields = ck.getFields();
@@ -144,9 +144,9 @@
// Instrument all fields
InputStream is2 = url.openStream();
ClassReader cr0 = new ClassReader(is2);
- ClassWriter cw0 = new ClassWriter(true);
+ ClassWriter cw0 = new ClassWriter(ClassWriter.COMPUTE_MAXS);
PreprocessClassAdapter preprocess = new PreprocessClassAdapter(cw0);
- cr0.accept(preprocess, false);
+ cr0.accept(preprocess, ClassReader.SKIP_FRAMES);
is2.close();
try {