FELIX-3550 : Reimplement the SCR Generator

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1357504 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/scrplugin/generator/DEPENDENCIES b/scrplugin/generator/DEPENDENCIES
index cdfe014..f157121 100644
--- a/scrplugin/generator/DEPENDENCIES
+++ b/scrplugin/generator/DEPENDENCIES
@@ -12,11 +12,11 @@
 
 This product uses software developed at
 The OSGi Alliance (http://www.osgi.org/).
-Copyright (c) OSGi Alliance (2000, 2009).
+Copyright (c) OSGi Alliance (2000, 2012).
 Licensed under the Apache License 2.0. 
 
 This product uses software developed at http://asm.objectweb.org
-Copyright (c) 2000-2005 INRIA, France Telecom
+Copyright (c) 2000-2011 INRIA, France Telecom
 Licensed under the BSD License.
 
 
diff --git a/scrplugin/generator/pom.xml b/scrplugin/generator/pom.xml
index afa7a3e..6bd9754 100644
--- a/scrplugin/generator/pom.xml
+++ b/scrplugin/generator/pom.xml
@@ -47,9 +47,9 @@
     <dependencies>
         <!-- bind/unbind method generation -->
         <dependency>
-            <groupId>asm</groupId>
+            <groupId>org.ow2.asm</groupId>
             <artifactId>asm-all</artifactId>
-            <version>3.3.1</version>
+            <version>4.0</version>
             <scope>compile</scope>
         </dependency>
         <dependency>
diff --git a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java
index f51edfc..b856739 100644
--- a/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java
+++ b/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java
@@ -23,7 +23,6 @@
 import java.io.FileOutputStream;
 
 import org.apache.felix.scrplugin.SCRDescriptorException;
-import org.objectweb.asm.ClassAdapter;
 import org.objectweb.asm.ClassReader;
 import org.objectweb.asm.ClassWriter;
 import org.objectweb.asm.Label;
@@ -89,39 +88,18 @@
                     } while (!c.isAssignableFrom(d));
                     return c.getName().replace('.', '/');
                 }
-            };
-
-            // remove existing implementation von previous builds
-            final ClassAdapter adapter = new ClassAdapter(writer) {
-
-                protected final String bindMethodName = "bind" + referenceName.substring(0, 1).toUpperCase() + referenceName.substring(1);
-                protected final String unbindMethodName = "unbind" + referenceName.substring(0, 1).toUpperCase() + referenceName.substring(1);
-                protected final String description = "(L" + typeName.replace('.', '/') + ";)V";
-
-                /**
-                 * @see org.objectweb.asm.ClassAdapter#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[])
-                 */
-                public MethodVisitor visitMethod(final int access,
-                                final String name,
-                                final String desc,
-                                final String signature,
-                                final String[] exceptions) {
-                    if ( createBind && name.equals(bindMethodName) && description.equals(desc) ) {
-                        return null;
-                    }
-                    if ( createUnbind && name.equals(unbindMethodName)  && description.equals(desc) ) {
-                        return null;
-                    }
-                    return super.visitMethod(access, name, desc, signature, exceptions);
-                }
 
             };
 
-            cn.accept(adapter);
+            cn.accept(writer);
             if ( createBind ) {
+                System.out.println("Adding bind " + className + " " + fieldName);
+
                 createMethod(writer, className, referenceName, fieldName, typeName, true);
             }
             if ( createUnbind ) {
+                System.out.println("Adding unbind " + className + " " + fieldName);
+
                 createMethod(writer, className, referenceName, fieldName, typeName, false);
             }