diff options
author | Stephan Herrmann | 2016-10-06 17:21:03 +0000 |
---|---|---|
committer | Stephan Herrmann | 2016-11-22 19:11:50 +0000 |
commit | 3dffdcf7358c5d5884d62f264640d7e7fdaeb533 (patch) | |
tree | 1e85973ece4bc1ac66c9ac7ac705c711cb72211a | |
parent | b3eaeb269ca3d41a67b7c157eefb21e9bb5b7e11 (diff) | |
download | org.eclipse.objectteams-3dffdcf7358c5d5884d62f264640d7e7fdaeb533.tar.gz org.eclipse.objectteams-3dffdcf7358c5d5884d62f264640d7e7fdaeb533.tar.xz org.eclipse.objectteams-3dffdcf7358c5d5884d62f264640d7e7fdaeb533.zip |
Bug 469761: [otdre] implement inheritable team activation
- also removes timing-dependence from tests
2 files changed, 11 insertions, 10 deletions
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AddThreadNotificationAdapter.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AddThreadNotificationAdapter.java index a30d5989e..8ded6f6e4 100644 --- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AddThreadNotificationAdapter.java +++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AddThreadNotificationAdapter.java @@ -24,7 +24,6 @@ import org.objectweb.asm.MethodVisitor; import org.objectweb.asm.Opcodes; import org.objectweb.asm.Type; import org.objectweb.asm.commons.AdviceAdapter; -import org.objectweb.asm.commons.Method; /** * Add code into all direct implementors of Runnable.run() / Thread.run() @@ -73,10 +72,10 @@ public class AddThreadNotificationAdapter extends ClassVisitor { final MethodVisitor methodVisitor = cv.visitMethod(access, methodName, desc, null, null); return new AdviceAdapter(this.api, methodVisitor, access, methodName, desc) { @Override - public void invokeConstructor(Type type, Method method) { - super.invokeConstructor(type, method); + public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itfc) { + super.visitMethodInsn(opcode, owner, name, desc, itfc); // ... that contains a super(..) call (rather than this(..)): - if (type.getInternalName().equals(clazz.getInternalSuperClassName())) { + if (opcode == Opcodes.INVOKESPECIAL && INIT.equals(name) && owner.equals(clazz.getInternalSuperClassName())) { // insert: // this._OT$creationThread = Thread.currentThread(); methodVisitor.visitIntInsn(Opcodes.ALOAD, 0); diff --git a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/teamactivation/ExplicitTeamActivation.java b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/teamactivation/ExplicitTeamActivation.java index 2c31a39b7..63b7a2c01 100644 --- a/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/teamactivation/ExplicitTeamActivation.java +++ b/testplugins/org.eclipse.objectteams.otdt.tests/otjld/org/eclipse/objectteams/otdt/tests/otjld/teamactivation/ExplicitTeamActivation.java @@ -2692,12 +2692,13 @@ public class ExplicitTeamActivation extends AbstractOTJLDTest { " org.objectteams.Team t = new Team5218ita1();\n" + " t.setInheritableActivation(true);\n" + " t.activate();\n" + - " new Thread(new Runnable() { \n" + + " Thread th = new Thread(new Runnable() { \n" + " public void run() {\n" + " new T5218ita1().o();\n" + " }\n" + - " }).start();\n" + - " Thread.sleep(10);\n" + + " });\n" + + " th.start();\n" + + " th.join();\n" + " }\n" + "}\n" + " \n", @@ -2729,12 +2730,13 @@ public class ExplicitTeamActivation extends AbstractOTJLDTest { " public static void main(String[] args) throws InterruptedException {\n" + " org.objectteams.Team t = new Team5218ita2();\n" + " t.activate();\n" + - " new Thread(new Runnable() { \n" + + " Thread th = new Thread(new Runnable() { \n" + " public void run() {\n" + " new T5218ita2().o();\n" + " }\n" + - " }).start();\n" + - " Thread.sleep(10);\n" + + " });\n" + + " th.start();\n" + + " th.join();\n" + " }\n" + "}\n" + " \n", |