Solve the Felix-372 bugs about static method manipulation.
Avoid importing org.objectweb.asm.tree that is not used (Maven transitive dependency).
Fix warning messages when compiling iPOJO core about split-packages.
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@577607 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/ipojo/core/pom.xml b/ipojo/core/pom.xml
index 67d6ae6..241023b 100644
--- a/ipojo/core/pom.xml
+++ b/ipojo/core/pom.xml
@@ -48,7 +48,8 @@
<Import-Package>
org.osgi.framework,
org.osgi.service.cm,
- org.osgi.service.log
+ org.osgi.service.log,
+ !org.objectweb.asm*
</Import-Package>
<Private-Package>
org.apache.felix.ipojo.manipulation,
@@ -60,9 +61,7 @@
org.apache.felix.ipojo.handlers.dependency.nullable,
org.apache.felix.ipojo.handlers.lifecycle.callback,
org.apache.felix.ipojo.handlers.lifecycle.controller,
- org.objectweb.asm,
- org.objectweb.asm.commons,
- org.objectweb.asm.tree <!-- to remove -->
+ org.objectweb.asm*;-split-package:=merge-first
</Private-Package>
<Export-Package>
org.apache.felix.ipojo; version="0.7.3",
diff --git a/ipojo/manipulator/pom.xml b/ipojo/manipulator/pom.xml
index 1d78e3c..01aabb0 100644
--- a/ipojo/manipulator/pom.xml
+++ b/ipojo/manipulator/pom.xml
@@ -21,12 +21,12 @@
<groupId>asm</groupId>
<artifactId>asm-commons</artifactId>
<version>3.0</version>
- </dependency>
- <!-- to remove -->
- <dependency>
- <groupId>asm</groupId>
- <artifactId>asm-tree</artifactId>
- <version>3.0</version>
+ <exclusions>
+ <exclusion>
+ <groupId>asm</groupId>
+ <artifactId>asm-tree</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>${pom.groupId}</groupId>
@@ -45,15 +45,14 @@
<instructions>
<Bundle-Name>iPOJO Manipulator</Bundle-Name>
<Bundle-Vendor>Clement ESCOFFIER</Bundle-Vendor>
- <Bundle-Description> iPOJO Manipulator </Bundle-Description>
+ <Bundle-Description> iPOJO Manipulator </Bundle-Description>
<Export-Package>org.apache.felix.ipojo.manipulator</Export-Package>
<Private-Package>
- org.apache.felix.ipojo.manipulation,
+ org.apache.felix.ipojo.manipulation,
org.apache.felix.ipojo.manipulation.annotations,
org.apache.felix.ipojo.xml.parser,
org.objectweb.asm,
- org.objectweb.asm.commons,
- org.objectweb.asm.tree <!-- to remove -->
+ org.objectweb.asm.commons
</Private-Package>
</instructions>
</configuration>
diff --git a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
index 6930f2b..8234d25 100644
--- a/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
+++ b/ipojo/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/PojoAdapter.java
@@ -172,9 +172,11 @@
* @see org.objectweb.asm.ClassAdapter#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) {
- if (name.equals("<clinit>") || name.equals("class$")) {
+ // Avoid manipulating special method
+ if (name.equals("<clinit>") || name.equals("class$")) {
return super.visitMethod(access, name, desc, signature, exceptions);
}
+ // The constructor is manipulated separatly
if (name.equals("<init>")) {
// 1) change the constructor descriptor (add a component manager arg as first argument)
String newDesc = desc.substring(1);
@@ -189,7 +191,13 @@
//return new ConstructorCodeAdapter(mv, access, desc, m_owner);
return new ConstructorCodeAdapter(mv, m_owner);
}
- } else {
+ } else { // "Normal methods"
+
+ // avoid manipulating static methods.
+ if ((access & ACC_STATIC) == ACC_STATIC) {
+ return super.visitMethod(access, name, desc, signature, exceptions);
+ }
+
Type[] args = Type.getArgumentTypes(desc);
String id = name;
for (int i = 0; i < args.length; i++) {