Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] How to apply advice to an interface in a jar?

Thanks a lot. Using call instead of execution works. 

On Tue, May 18, 2010 at 11:08 PM, <jeanlouis.pasturel@xxxxxxxxxxxxxxxxxx> wrote:
And you have to add the option -Xset:weaveJavaPackages=true in the options of element weaver
 

Cordialement / Best regards

Jean-Louis Pasturel

 


De : aspectj-users-bounces@xxxxxxxxxxx [mailto:aspectj-users-bounces@xxxxxxxxxxx] De la part de Simone Gianni
Envoyé : mardi 18 mai 2010 23:44
À : aspectj-users@xxxxxxxxxxx
Objet : Re: [aspectj-users] How to apply advice to an interface in a jar?

Hi Benyi,
you are trying to weave the JRE classes, which is quite tricky cause you have to weave the rt.jar at compie time and then run using the java bootclasspath option to use the weaved rt.jar. If you want to trace calls to lists only from inside your code, then try @Before("call(* java.util.List.*(..))") .

Simone

2010/5/18 Benyi Wang <bewang.tech@xxxxxxxxx>
How can add an advice to the methods of java.util.List?

I include the following into weaver options in aop.xml

<aspectj>
<aspects>
<aspect name="TestInterfaceAspect" />
</aspects>

<weaver options="-verbose -showWeaveInfo">
<include within="java.util.*"/>
</weaver>
</aspectj>

And

@Aspect
public class TestInterfaceAspect {

@Before("execution(* java.util.List.*(..))")
public void beforeListOperations(JoinPoint jp) {
System.out.println("Call " + jp.getSignature().toShortString());
}
}

but I always get a warning "advice defined in TestInterfaceAspect has not been applied [Xlint:adviceDidNotMatch]"?

I'm using Eclipse 3.5 with AJDT.

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


*********************************
This message and any attachments (the "message") are confidential and intended solely for the addressees. 
Any unauthorised use or dissemination is prohibited.
Messages are susceptible to alteration. 
France Telecom Group shall not be liable for the message if altered, changed or falsified.
If you are not the intended addressee of this message, please cancel it immediately and inform the sender.
********************************

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top