Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorslewis2014-05-19 20:45:43 +0000
committerslewis2014-05-19 20:45:43 +0000
commit9910aeee944bf93fb5ea292b6a195e50719bb373 (patch)
tree1fb5895a716182c629dcdc115a9be74963385efa /protocols/bundles/ch.ethz.iks.r_osgi.remote
parent31e7ea0aaff6cc9f178ee6bd9f473dac0999a89c (diff)
downloadorg.eclipse.ecf-9910aeee944bf93fb5ea292b6a195e50719bb373.tar.gz
org.eclipse.ecf-9910aeee944bf93fb5ea292b6a195e50719bb373.tar.xz
org.eclipse.ecf-9910aeee944bf93fb5ea292b6a195e50719bb373.zip
Fixes for bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=430752.
Also addition/change for ecf.rmap file, to point to more recent Orbit repo...that contains version 5.0.1 of org.objectweb.asm bundle. Change-Id: I168060be1a40f5cb3cf2da97a5127e1c3a2545bd
Diffstat (limited to 'protocols/bundles/ch.ethz.iks.r_osgi.remote')
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/META-INF/MANIFEST.MF4
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/pom.xml4
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java21
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/CodeAnalyzer.java55
-rw-r--r--protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ProxyGenerator.java151
5 files changed, 128 insertions, 107 deletions
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/META-INF/MANIFEST.MF b/protocols/bundles/ch.ethz.iks.r_osgi.remote/META-INF/MANIFEST.MF
index c28658b9a..b999a71f0 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/META-INF/MANIFEST.MF
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/META-INF/MANIFEST.MF
@@ -2,9 +2,9 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %plugin.name
Bundle-SymbolicName: ch.ethz.iks.r_osgi.remote
-Bundle-Version: 1.0.0.RC4_qualifier
+Bundle-Version: 1.0.1.RC1_qualifier
Bundle-Vendor: %plugin.provider
-Import-Package: org.objectweb.asm;version="[3.1.0,4.0.0)",
+Import-Package: org.objectweb.asm;version="[5.0.1,6.0.0)",
org.osgi.framework,
org.osgi.service.event,
org.osgi.service.log,
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/pom.xml b/protocols/bundles/ch.ethz.iks.r_osgi.remote/pom.xml
index 0ee6cf331..d13cf65fa 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/pom.xml
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/pom.xml
@@ -58,9 +58,9 @@
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>asm</groupId>
+ <groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
- <version>3.0</version>
+ <version>5.0.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java
index 85acd857e..2f09e8656 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ChannelEndpointImpl.java
@@ -44,7 +44,6 @@ import java.util.Hashtable;
import java.util.List;
import java.util.Map;
import java.util.Set;
-import java.util.StringTokenizer;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -85,6 +84,7 @@ import ch.ethz.iks.r_osgi.streams.InputStreamProxy;
import ch.ethz.iks.r_osgi.streams.OutputStreamHandle;
import ch.ethz.iks.r_osgi.streams.OutputStreamProxy;
import ch.ethz.iks.util.CollectionUtils;
+import ch.ethz.iks.util.StringUtils;
/**
* <p>
@@ -819,10 +819,14 @@ public final class ChannelEndpointImpl implements ChannelEndpoint {
// store the bundle for state updates and cleanup
proxyBundles.put(ref.getURI().getFragment(), bundle);
}
+
+ // FIXME: debug output
+ System.err.println(RemoteOSGiActivator.getActivator().getContext().getDataFile("fii").getAbsolutePath());
+
// start the bundle
- bundle.start();
-
+ bundle.start();
+
} catch (final BundleException e) {
final Throwable nested = e.getNestedException() == null ? e : e
.getNestedException();
@@ -866,13 +870,14 @@ public final class ChannelEndpointImpl implements ChannelEndpoint {
*/
private String[] getTokens(final String str) {
final ArrayList result = new ArrayList();
- final StringTokenizer tokenizer = new StringTokenizer(str, ",");
- while (tokenizer.hasMoreTokens()) {
- final String token = tokenizer.nextToken();
+ //final StringTokenizer tokenizer = new StringTokenizer(str, ",");
+ final String[] tokens = StringUtils.stringToArray(str, ",");
+
+ for (int i=0; i<tokens.length; i++) {
final int pos;
// TODO: handle versions for R4!
- final String pkg = (pos = token.indexOf(";")) > -1 ? token
- .substring(0, pos).trim() : token.trim();
+ final String pkg = (pos = tokens[i].indexOf(";")) > -1 ? tokens[i]
+ .substring(0, pos).trim() : tokens[i].trim();
if (!RemoteOSGiServiceImpl.checkPackageImport(pkg)) {
result.add(pkg);
}
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/CodeAnalyzer.java b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/CodeAnalyzer.java
index 62dd55431..1df6fb1ed 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/CodeAnalyzer.java
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/CodeAnalyzer.java
@@ -67,7 +67,7 @@ import ch.ethz.iks.util.StringUtils;
* @author Jan S. Rellermeyer, ETH Zurich
* @since 0.6
*/
-final class CodeAnalyzer implements ClassVisitor {
+final class CodeAnalyzer extends ClassVisitor {
/**
* the class loader of the service provider bundle.
@@ -128,6 +128,7 @@ final class CodeAnalyzer implements ClassVisitor {
*/
CodeAnalyzer(final ClassLoader loader, final String imports,
final String exports) {
+ super(Opcodes.ASM5);
this.loader = loader;
if (imports != null) {
@@ -136,8 +137,8 @@ final class CodeAnalyzer implements ClassVisitor {
for (int i = 0; i < tokens.length; i++) {
final int pos = tokens[i].indexOf(";"); //$NON-NLS-1$
if (pos > -1) {
- importsMap.put(tokens[i].substring(0, pos), tokens[i]
- .substring(pos + 1, tokens[i].length()));
+ importsMap.put(tokens[i].substring(0, pos),
+ tokens[i].substring(pos + 1, tokens[i].length()));
} else {
importsMap.put(tokens[i], null);
}
@@ -152,8 +153,8 @@ final class CodeAnalyzer implements ClassVisitor {
for (int i = 0; i < tokens.length; i++) {
final int pos = tokens[i].indexOf(";"); //$NON-NLS-1$
if (pos > -1) {
- exportsMap.put(tokens[i].substring(0, pos), tokens[i]
- .substring(pos + 1, tokens[i].length()));
+ exportsMap.put(tokens[i].substring(0, pos),
+ tokens[i].substring(pos + 1, tokens[i].length()));
} else {
exportsMap.put(tokens[i], null);
}
@@ -184,8 +185,8 @@ final class CodeAnalyzer implements ClassVisitor {
DeliverServiceMessage analyze(final String[] ifaces,
final String smartProxy, final String[] explicitInjections,
final String presentation) throws ClassNotFoundException,
- IOException {
-
+ IOException {
+
closure.addAll(Arrays.asList(ifaces));
if (smartProxy != null) {
@@ -197,11 +198,11 @@ final class CodeAnalyzer implements ClassVisitor {
if (explicitInjections != null) {
closure.addAll(Arrays.asList(explicitInjections));
}
-
+
while (!closure.isEmpty()) {
visit((String) closure.remove(0));
}
-
+
for (int i = 0; i < ifaces.length; i++) {
proxyImports.add(packageOf(ifaces[i]));
proxyExports.add(packageOf(ifaces[i]));
@@ -217,7 +218,7 @@ final class CodeAnalyzer implements ClassVisitor {
final StringBuffer exportDeclaration = new StringBuffer();
final String[] pi = (String[]) proxyImports
.toArray(new String[proxyImports.size()]);
-
+
for (int i = 0; i < pi.length; i++) {
importDeclaration.append(pi[i]);
final Object v = importsMap.get(pi[i]);
@@ -244,6 +245,8 @@ final class CodeAnalyzer implements ClassVisitor {
}
}
+ System.out.println("INJECTIONS: " + injections);
+
final DeliverServiceMessage message = new DeliverServiceMessage();
message.setInterfaceNames(ifaces);
message.setSmartProxyName(smartProxy);
@@ -269,8 +272,8 @@ final class CodeAnalyzer implements ClassVisitor {
*/
private void visit(final String className) throws ClassNotFoundException {
currentClass = className.replace('.', '/');
- // remove array indicators
- if(currentClass.startsWith("[L")) {
+ // remove array indicators
+ if (currentClass.startsWith("[L")) {
currentClass = currentClass.substring(2);
} else if (currentClass.startsWith("L")) {
currentClass = currentClass.substring(1);
@@ -283,14 +286,14 @@ final class CodeAnalyzer implements ClassVisitor {
proxyExports.add(pkg);
}
try {
- final ClassReader reader = new ClassReader(loader
- .getResourceAsStream(classFile));
+ final ClassReader reader = new ClassReader(
+ loader.getResourceAsStream(classFile));
injections.put(classFile, reader.b);
if (exportsMap.containsKey(pkg)) {
proxyExports.add(pkg);
}
- reader.accept(this, ClassReader.SKIP_DEBUG
+ reader.accept(this, ClassReader.SKIP_DEBUG
+ ClassReader.SKIP_FRAMES);
} catch (final IOException ioe) {
throw new ClassNotFoundException(className);
@@ -316,7 +319,7 @@ final class CodeAnalyzer implements ClassVisitor {
* the type.
*/
void visitType(final Type t) {
-
+
if (t.getSort() < Type.ARRAY) {
visited.add(t.getClassName());
return;
@@ -367,7 +370,7 @@ final class CodeAnalyzer implements ClassVisitor {
public void visit(final int version, final int access, final String name,
final String signature, final String superName,
final String[] interfaces) {
-
+
if (superName != null && !visited.contains(superName)) {
visitType(Type.getType('L' + superName + ';'));
}
@@ -486,7 +489,11 @@ final class CodeAnalyzer implements ClassVisitor {
*
* @author Jan S. Rellermeyer, ETH Zurich
*/
- final class MethodAnalyzer implements MethodVisitor {
+ final class MethodAnalyzer extends MethodVisitor {
+
+ protected MethodAnalyzer() {
+ super(Opcodes.ASM5);
+ }
/**
*
@@ -495,6 +502,7 @@ final class CodeAnalyzer implements ClassVisitor {
*/
public AnnotationVisitor visitAnnotation(final String desc,
final boolean visible) {
+
if (!visited.contains(desc)) {
visitType(Type.getType("L" + desc + ";")); //$NON-NLS-1$ //$NON-NLS-2$
}
@@ -639,6 +647,17 @@ final class CodeAnalyzer implements ClassVisitor {
}
/**
+ * @see org.objectweb.asm.MethodVisitor#visitMethodInsn(int,
+ * java.lang.String, java.lang.String, java.lang.String, boolean)
+ */
+ public void visitMethodInsn(int opcode, String owner, String name,
+ String desc, boolean itf) {
+ if (!visited.contains(owner)) {
+ visitType(Type.getType("L" + owner + ";")); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+
+ /**
*
* @see org.objectweb.asm.MethodVisitor#visitMultiANewArrayInsn(java.lang.String,
* int)
diff --git a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ProxyGenerator.java b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ProxyGenerator.java
index a7936092a..32f8d3a54 100644
--- a/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ProxyGenerator.java
+++ b/protocols/bundles/ch.ethz.iks.r_osgi.remote/src/main/java/ch/ethz/iks/r_osgi/impl/ProxyGenerator.java
@@ -46,13 +46,11 @@ import java.util.zip.CRC32;
import org.objectweb.asm.AnnotationVisitor;
import org.objectweb.asm.Attribute;
-import org.objectweb.asm.ClassAdapter;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.FieldVisitor;
import org.objectweb.asm.Label;
-import org.objectweb.asm.MethodAdapter;
import org.objectweb.asm.MethodVisitor;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
@@ -72,7 +70,7 @@ import ch.ethz.iks.r_osgi.types.ServiceUIComponent;
* @author Jan S. Rellermeyer, ETH Zurich.
* @since 0.1
*/
-class ProxyGenerator implements ClassVisitor, Opcodes {
+class ProxyGenerator extends ClassVisitor implements Opcodes {
/**
* sourceID.
@@ -185,7 +183,7 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
* constructor.
*/
ProxyGenerator() {
-
+ super(Opcodes.ASM5);
}
/**
@@ -207,9 +205,9 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
injections = deliv.getInjections();
final byte[] bytes = deliv.getSmartProxyName() == null ? generateProxyClass(
deliv.getInterfaceNames(), deliv.getInterfaceClass())
- : generateProxyClass(deliv.getInterfaceNames(), deliv
- .getInterfaceClass(), deliv.getSmartProxyName(), deliv
- .getProxyClass());
+ : generateProxyClass(deliv.getInterfaceNames(),
+ deliv.getInterfaceClass(), deliv.getSmartProxyName(),
+ deliv.getProxyClass());
final String className = implName.replace('/', '.');
JarEntry jarEntry;
@@ -221,15 +219,15 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
attr.putValue("Created-By", "R-OSGi Proxy Generator"); //$NON-NLS-1$ //$NON-NLS-2$
attr.putValue("Bundle-Activator", className); //$NON-NLS-1$
attr.putValue("Bundle-Classpath", "."); //$NON-NLS-1$ //$NON-NLS-2$
- attr.putValue("Bundle-SymbolicName", "R-OSGi Proxy Bundle generated for Endpoint " + uri.toString()); //$NON-NLS-1$ //$NON-NLS-2$
- attr
- .putValue(
- "Import-Package", //$NON-NLS-1$
- "org.osgi.framework, ch.ethz.iks.r_osgi, ch.ethz.iks.r_osgi.types, ch.ethz.iks.r_osgi.channels" //$NON-NLS-1$
- + ("".equals(deliv.getOptionalImports()) ? "" : ", " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ attr.putValue(
+ "Bundle-SymbolicName", "R-OSGi Proxy Bundle generated for Endpoint " + uri.toString()); //$NON-NLS-1$ //$NON-NLS-2$
+ attr.putValue(
+ "Import-Package", //$NON-NLS-1$
+ "org.osgi.framework, ch.ethz.iks.r_osgi, ch.ethz.iks.r_osgi.types, ch.ethz.iks.r_osgi.channels" //$NON-NLS-1$
+ + ("".equals(deliv.getOptionalImports()) ? "" : ", " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ deliv.getOptionalImports())
- + ("".equals(deliv.getImports()) ? "" : ", ") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- + deliv.getImports());
+ + ("".equals(deliv.getImports()) ? "" : ", ") //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ + deliv.getImports());
if (!"".equals(deliv.getExports())) { //$NON-NLS-1$
attr.putValue("Export-Package", deliv.getExports()); //$NON-NLS-1$
}
@@ -374,10 +372,9 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
final ClassReader reader;
if (bytes == null) {
try {
- final Class clazz = Class.forName(
- superIface.replace('/', '.'));
- ClassLoader classLoader = clazz
- .getClassLoader();
+ final Class clazz = Class.forName(superIface
+ .replace('/', '.'));
+ ClassLoader classLoader = clazz.getClassLoader();
if (classLoader == null) {
// For classes loaded by the bootstrap CL, the
// CL will be null. This happens e.g. on classes
@@ -386,8 +383,9 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
// (see https://bugs.eclipse.org/420112)
classLoader = getClass().getClassLoader();
}
- reader = new ClassReader(classLoader.getResourceAsStream(
- superIface + ".class")); //$NON-NLS-1$
+ reader = new ClassReader(
+ classLoader.getResourceAsStream(superIface
+ + ".class")); //$NON-NLS-1$
} catch (final IOException ioe) {
throw new IOException("While processing " //$NON-NLS-1$
+ superIface.replace('/', '.') + ": " //$NON-NLS-1$
@@ -452,12 +450,11 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
ifaces.add("org/osgi/framework/BundleActivator"); //$NON-NLS-1$
ifaces.addAll(Arrays.asList(serviceInterfaces));
// V1_1
- writer
- .visit(
- (version >= V1_5 && RemoteOSGiServiceImpl.IS_JAVA5) ? V1_5
- : V1_2, ACC_PUBLIC + ACC_SUPER,
- implName, null, superName, (String[]) ifaces
- .toArray(new String[ifaces.size()]));
+ writer.visit(
+ (version >= V1_5 && RemoteOSGiServiceImpl.IS_JAVA5) ? V1_5
+ : V1_2, ACC_PUBLIC + ACC_SUPER, implName, null,
+ superName, (String[]) ifaces.toArray(new String[ifaces
+ .size()]));
if (java.util.Arrays.asList(interfaces).contains(
"ch/ethz/iks/r_osgi/SmartProxy")) { //$NON-NLS-1$
@@ -467,12 +464,10 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
} else {
// we have an interface
- writer
- .visit(
- (version >= V1_5 && RemoteOSGiServiceImpl.IS_JAVA5) ? V1_5
- : V1_2, ACC_PUBLIC + ACC_SUPER,
- implName, null,
- "java/lang/Object", serviceInterfaces); //$NON-NLS-1$
+ writer.visit(
+ (version >= V1_5 && RemoteOSGiServiceImpl.IS_JAVA5) ? V1_5
+ : V1_2, ACC_PUBLIC + ACC_SUPER, implName, null,
+ "java/lang/Object", serviceInterfaces); //$NON-NLS-1$
if (RemoteOSGiServiceImpl.PROXY_DEBUG) {
RemoteOSGiServiceImpl.log.log(LogService.LOG_DEBUG,
"Creating Proxy Bundle from Interfaces " //$NON-NLS-1$
@@ -510,16 +505,14 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
method.visitVarInsn(ALOAD, 1);
method.visitVarInsn(ALOAD, 1);
method.visitLdcInsn(Remoting.class.getName());
- method
- .visitMethodInsn(INVOKEINTERFACE,
- "org/osgi/framework/BundleContext", //$NON-NLS-1$
- "getServiceReference", //$NON-NLS-1$
- "(Ljava/lang/String;)Lorg/osgi/framework/ServiceReference;"); //$NON-NLS-1$
- method
- .visitMethodInsn(INVOKEINTERFACE,
- "org/osgi/framework/BundleContext", //$NON-NLS-1$
- "getService", //$NON-NLS-1$
- "(Lorg/osgi/framework/ServiceReference;)Ljava/lang/Object;"); //$NON-NLS-1$
+ method.visitMethodInsn(INVOKEINTERFACE,
+ "org/osgi/framework/BundleContext", //$NON-NLS-1$
+ "getServiceReference", //$NON-NLS-1$
+ "(Ljava/lang/String;)Lorg/osgi/framework/ServiceReference;"); //$NON-NLS-1$
+ method.visitMethodInsn(INVOKEINTERFACE,
+ "org/osgi/framework/BundleContext", //$NON-NLS-1$
+ "getService", //$NON-NLS-1$
+ "(Lorg/osgi/framework/ServiceReference;)Ljava/lang/Object;"); //$NON-NLS-1$
method.visitTypeInsn(CHECKCAST, REMOTING_I);
method.visitVarInsn(ASTORE, 2);
method.visitVarInsn(ALOAD, 0);
@@ -563,16 +556,14 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
method.visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I,
"getProperties", //$NON-NLS-1$
"(Ljava/lang/String;)Ljava/util/Dictionary;"); //$NON-NLS-1$
- method
- .visitMethodInsn(
- INVOKEINTERFACE,
- "org/osgi/framework/BundleContext", //$NON-NLS-1$
- "registerService", //$NON-NLS-1$
- "([Ljava/lang/String;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration;"); //$NON-NLS-1$
- method
- .visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I,
- "trackRegistration", //$NON-NLS-1$
- "(Ljava/lang/String;Lorg/osgi/framework/ServiceRegistration;)V"); //$NON-NLS-1$
+ method.visitMethodInsn(
+ INVOKEINTERFACE,
+ "org/osgi/framework/BundleContext", //$NON-NLS-1$
+ "registerService", //$NON-NLS-1$
+ "([Ljava/lang/String;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration;"); //$NON-NLS-1$
+ method.visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I,
+ "trackRegistration", //$NON-NLS-1$
+ "(Ljava/lang/String;Lorg/osgi/framework/ServiceRegistration;)V"); //$NON-NLS-1$
method.visitVarInsn(ALOAD, 0);
method.visitFieldInsn(GETFIELD, implName, "endpoint", "L" //$NON-NLS-1$ //$NON-NLS-2$
+ ENDPOINT_I + ";"); //$NON-NLS-1$
@@ -598,10 +589,9 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
method.visitVarInsn(ALOAD, 4);
method.visitVarInsn(ALOAD, 0);
method.visitVarInsn(ALOAD, 1);
- method
- .visitMethodInsn(INVOKEINTERFACE, UICOMP_I,
- "initComponent", //$NON-NLS-1$
- "(Ljava/lang/Object;Lorg/osgi/framework/BundleContext;)V"); //$NON-NLS-1$
+ method.visitMethodInsn(INVOKEINTERFACE, UICOMP_I,
+ "initComponent", //$NON-NLS-1$
+ "(Ljava/lang/Object;Lorg/osgi/framework/BundleContext;)V"); //$NON-NLS-1$
method.visitVarInsn(ALOAD, 1);
method.visitLdcInsn(ServiceUIComponent.class.getName());
method.visitVarInsn(ALOAD, 4);
@@ -612,12 +602,11 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
method.visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I,
"getPresentationProperties", //$NON-NLS-1$
"(Ljava/lang/String;)Ljava/util/Dictionary;"); //$NON-NLS-1$
- method
- .visitMethodInsn(
- INVOKEINTERFACE,
- "org/osgi/framework/BundleContext", //$NON-NLS-1$
- "registerService", //$NON-NLS-1$
- "(Ljava/lang/String;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration;"); //$NON-NLS-1$
+ method.visitMethodInsn(
+ INVOKEINTERFACE,
+ "org/osgi/framework/BundleContext", //$NON-NLS-1$
+ "registerService", //$NON-NLS-1$
+ "(Ljava/lang/String;Ljava/lang/Object;Ljava/util/Dictionary;)Lorg/osgi/framework/ServiceRegistration;"); //$NON-NLS-1$
method.visitInsn(POP);
method.visitLabel(l0);
if (addLifecycleSupport) {
@@ -852,10 +841,8 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
needsBoxing = true;
}
}
- method
- .visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I,
- "invokeMethod", //$NON-NLS-1$
- "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;"); //$NON-NLS-1$
+ method.visitMethodInsn(INVOKEINTERFACE, ENDPOINT_I, "invokeMethod", //$NON-NLS-1$
+ "(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/Object;"); //$NON-NLS-1$
// unboxing of primitive type return values.
final Type returnType = Type.getReturnType(desc);
@@ -918,18 +905,18 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
writer.visitEnd();
}
- private final class ClassRewriter extends ClassAdapter {
+ private final class ClassRewriter extends ClassVisitor {
/**
*
*/
ClassRewriter(final ClassWriter writer) {
- super(writer);
+ super(Opcodes.ASM5, writer);
}
/**
*
- * @see org.objectweb.asm.ClassAdapter#visit(int, int, 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(final int version, final int access,
@@ -945,7 +932,7 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
/**
*
- * @see org.objectweb.asm.ClassAdapter#visitField(int, java.lang.String,
+ * @see org.objectweb.asm.ClassVisitor#visitField(int, java.lang.String,
* java.lang.String, java.lang.String, java.lang.Object)
*/
public FieldVisitor visitField(final int access, final String name,
@@ -978,7 +965,7 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
/**
*
- * @see org.objectweb.asm.ClassAdapter#visitInnerClass(java.lang.String,
+ * @see org.objectweb.asm.ClassVisitor#visitInnerClass(java.lang.String,
* java.lang.String, java.lang.String, int)
*/
public void visitInnerClass(final String name, final String outerName,
@@ -989,7 +976,7 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
/**
*
- * @see org.objectweb.asm.ClassAdapter#visitMethod(int,
+ * @see org.objectweb.asm.ClassVisitor#visitMethod(int,
* java.lang.String, java.lang.String, java.lang.String,
* java.lang.String[])
*/
@@ -1011,13 +998,13 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
*
* @author Jan S. Rellermeyer, ETH Zurich
*/
- private final class MethodRewriter extends MethodAdapter {
+ private final class MethodRewriter extends MethodVisitor {
/**
* @param methodWriter
* methodWriter
*/
MethodRewriter(final MethodVisitor methodWriter) {
- super(methodWriter);
+ super(Opcodes.ASM5, methodWriter);
}
/**
@@ -1070,6 +1057,16 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
}
/**
+ * @see org.objectweb.asm.MethodVisitor#visitMethodInsn(int,
+ * java.lang.String, java.lang.String, java.lang.String, boolean)
+ */
+ public void visitMethodInsn(int opcode, String owner, String name,
+ String desc, boolean itf) {
+ super.mv.visitMethodInsn(opcode, checkRewrite(owner), name,
+ checkRewriteDesc(desc), itf);
+ }
+
+ /**
* @param desc
* desc
* @param dims
@@ -1134,8 +1131,8 @@ class ProxyGenerator implements ClassVisitor, Opcodes {
*/
private static String generateSourceID(final String id) {
final int pos1 = id.indexOf("://"); //$NON-NLS-1$
- final char[] chars = id.substring(pos1 + 3).replace('/', '_').replace(
- ':', '_').replace('-', '_').toCharArray();
+ final char[] chars = id.substring(pos1 + 3).replace('/', '_')
+ .replace(':', '_').replace('-', '_').toCharArray();
final StringBuffer buffer = new StringBuffer();
for (int i = 0; i < chars.length; i++) {
if (chars[i] == '.') {

Back to the top