[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Catch-all pointcut

On Mon, Apr 11, 2011 at 11:23 AM, Tiago Espinha <tiago@xxxxxxxxxx> wrote:
> Assume I have two jars:
> - RunnableFile.jar
> - Library.jar
> The RunnableFile.jar is a runnable jar, contains a main method in one of its
> classes but it depends on Library.jar . This means that whenever I run the
> RunnableFile, I need to include Library.jar in the classpath, otherwise it
> won't work.
> Let's also assume that I absolutely cannot touch Library.jar, but I want to
> be able to catch method calls of any method contained in Library.jar. Is
> there any way of instrumenting RunnableFile.jar so that any method calls of
> any library that it loads are also captured?
> I've done a * *.* pointcut that I wove into RunnableFile.jar but since only
> this JAR is instrumented, only the methods of classes within this JAR
> actually get advised. Is there any way of going around this by instrumenting
> just the "main" JAR?

Correct me if I'm wrong : you want to advise all method calls, even
those done by the classes in Library.jar themselves? You could use
load-time weaving instead of compile time-time weaving. Otherwise, you
can't advise methods of classes you can't modify.

Frank