Author: cziegeler
Date: Thu Jul 5 09:02:30 2012
New Revision: 1357504
URL: http://svn.apache.org/viewvc?rev=1357504&view=rev
Log:
FELIX-3550 : Reimplement the SCR Generator
Modified:
felix/trunk/scrplugin/generator/DEPENDENCIES
felix/trunk/scrplugin/generator/pom.xml
felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java
Modified: felix/trunk/scrplugin/generator/DEPENDENCIES
URL:
http://svn.apache.org/viewvc/felix/trunk/scrplugin/generator/DEPENDENCIES?rev=1357504&r1=1357503&r2=1357504&view=diff
==============================================================================
--- felix/trunk/scrplugin/generator/DEPENDENCIES (original)
+++ felix/trunk/scrplugin/generator/DEPENDENCIES Thu Jul 5 09:02:30 2012
@@ -12,11 +12,11 @@ II. Used Third-Party Software
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.
Modified: felix/trunk/scrplugin/generator/pom.xml
URL:
http://svn.apache.org/viewvc/felix/trunk/scrplugin/generator/pom.xml?rev=1357504&r1=1357503&r2=1357504&view=diff
==============================================================================
--- felix/trunk/scrplugin/generator/pom.xml (original)
+++ felix/trunk/scrplugin/generator/pom.xml Thu Jul 5 09:02:30 2012
@@ -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>
Modified:
felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java
URL:
http://svn.apache.org/viewvc/felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java?rev=1357504&r1=1357503&r2=1357504&view=diff
==============================================================================
---
felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java
(original)
+++
felix/trunk/scrplugin/generator/src/main/java/org/apache/felix/scrplugin/helper/ClassModifier.java
Thu Jul 5 09:02:30 2012
@@ -23,7 +23,6 @@ import java.io.FileInputStream;
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 @@ public abstract class ClassModifier {
} 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);
}