[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] create pointcuts to external library code
|
Hi,
the weaver has to be able to process the code for the joinpoints in
order to match/weave them and so insert the advice calls. If those
classes are inside the JRE classes, AspectJ doesn't normally get to
see them. The simplest thing is to compile time weave the
rt.jar/classes.jar
ajc -inpath rt.jar -outjar rt_woven.jar MyAspect.java
and then use the woven version (syntax something like this):
java -Xbootclasspath/p:rt_woven.jar Something
cheers,
Andy
On 16 November 2011 11:44, Nemeth Denes <mr.nemeth.denes@xxxxxxxxx> wrote:
> Hi all
>
> Let's assume that Java JRE would contain these two classes
>
> package java.foo.moo;
>
> class Foo1{
> public void method1(Foo2 obj){
> obj.method2();
> }
> }
>
> package java.foo.moo;
> class Foo2{
> public void method2(Foo2 obj){
> System.out.println("capture this");
> }
> }
>
> How can I match to the method2 call (let's assume that method2 is only
> invoked from Foo1)
> neither of this works:
>
> pointcut foo1() : execution(public void java.foo.moo.Foo2.method2(Foo2));
> pointcut foo2() : call(public void java.foo.moo.Foo2.method2(Foo2));
>
> I assume the trick why it does not work is because neither the invocation
> point nor the declaration of the method is in the code defined by me.
>
> Thanks Denes
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>