diff options
author | Andy Clement <aclement@pivotal.io> | 2015-09-08 13:33:06 -0700 |
---|---|---|
committer | Andy Clement <aclement@pivotal.io> | 2015-09-08 13:33:06 -0700 |
commit | 83acbdaf168b82f227c6307436ef90e7fb71155d (patch) | |
tree | 042e35d849143449de61f6979d0072c4ec3d342b /loadtime5 | |
parent | 09b57263e817325b7e9505060e8aca9ecd464096 (diff) | |
download | aspectj-83acbdaf168b82f227c6307436ef90e7fb71155d.tar.gz aspectj-83acbdaf168b82f227c6307436ef90e7fb71155d.zip |
458871: dynamically attach agent
Patch from Alexander Kriegisch
Diffstat (limited to 'loadtime5')
-rw-r--r-- | loadtime5/java5-src/org/aspectj/weaver/loadtime/Agent.java | 11 | ||||
-rw-r--r-- | loadtime5/loadtime5.mf.txt | 1 |
2 files changed, 10 insertions, 2 deletions
diff --git a/loadtime5/java5-src/org/aspectj/weaver/loadtime/Agent.java b/loadtime5/java5-src/org/aspectj/weaver/loadtime/Agent.java index 920d04e04..eeca8aeef 100644 --- a/loadtime5/java5-src/org/aspectj/weaver/loadtime/Agent.java +++ b/loadtime5/java5-src/org/aspectj/weaver/loadtime/Agent.java @@ -18,7 +18,8 @@ import java.lang.instrument.ClassFileTransformer; * Java 1.5 preMain agent to hook in the class pre processor * Can be used with -javaagent:aspectjweaver.jar * - * @author <a href="mailto:alex@gnilux.com">Alexandre Vasseur</a> + * @author Alexandre Vasseur + * @author Alexander Kriegisch */ public class Agent { @@ -47,12 +48,18 @@ public class Agent { s_instrumentation.addTransformer(s_transformer); } + public static void agentmain(String options, Instrumentation instrumentation) { + premain(options, instrumentation); + } + /** * Returns the Instrumentation system level instance */ public static Instrumentation getInstrumentation() { if (s_instrumentation == null) { - throw new UnsupportedOperationException("Java 5 was not started with preMain -javaagent for AspectJ"); + throw new UnsupportedOperationException( + "AspectJ weaving agent was neither started via '-javaagent' (preMain) " + + "nor attached via 'VirtualMachine.loadAgent' (agentMain)"); } return s_instrumentation; } diff --git a/loadtime5/loadtime5.mf.txt b/loadtime5/loadtime5.mf.txt index 57529ee04..729cae693 100644 --- a/loadtime5/loadtime5.mf.txt +++ b/loadtime5/loadtime5.mf.txt @@ -7,4 +7,5 @@ Implementation-Title: org.aspectj.weaver Implementation-Version: @build.version.short@ Implementation-Vendor: @company.name@ Premain-Class: org.aspectj.weaver.loadtime.Agent +Agent-Class: org.aspectj.weaver.loadtime.Agent Can-Redefine-Classes: true |