Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Load time weaving agent with another java agent

Hey everybody,

I need to capture array element access in AspectJ. But it seems that AspectJ does not provide such a pointcut. In order to solve this problem my idea was to insert calls to an specific static method before array accesses and capture those method calls in AspectJ.
I wrote a java instrumentation agent (using ASM) that inserts the static method calls before array element accesses. The agent works fine.
I also wrote an aspect that captures that method call. I generated a load time weaving agent using that aspect. And that agent works fine too (by that I mean if I manually add the method calls to source code, the agent captures it at runtime)

Now I try to run both of the agents in order:
java -javaagent:myagent.jar -javaagent:asperctjweaver.jar MyClass

It is said that " Agents are invoked in the same order as specified in options.". and from that I except that myagent would insert method calls before array accesses and asperctjweaver would capture those calls. But it does not work this way: method calls get inserted before array accesses but they do not get captured. However, the method calls that already existed in the source code, get captured. 

Does anybody have any idea on what the problem might be?

Regards,
Ali




Back to the top