You can order advice between different aspects by applying a precedence rule: declare precedence: firstAspect, secondAspect. For advice within an aspect, the ordering is the order the advice appears in the aspect. So for your case below, if you move the static affecting advice before the advice for all methods you will get them in order. (Chapter 4.2 Laddad, AspectJ in Action) Elizabeth
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Henrique Mostaert Sent: August 31, 2007 12:47 PM To: [email protected] Subject: [aspectj-users] "AspectJ question" Hi All, I´m working with AspectJ and recently get a Problem: In order to ilustrate, consider the simple example: public class C{ public void m(int a, int b){ } } And an aspect like: public aspect AspectoC { // Advice to run at beginning of every execution of method m() before(C current) : execution(void C.m(int ,int)) && within(teste.C) && this(current){ System.out.println("Code executed (I want to run in SECOND, but it runs in FIRST!!) before any code of method m() in Class C executes"); } // Advice to run a specific code at beginning of all methods non-static! before(C current) : execution(!static * C.*(..)) && within(teste.C) && this(current){ System.out.println("This (I want to run in FIRST before everything) must execute before anything in methdo m() in Class C"); } } The question is: Is there a possibility to execute the second advice always in FIRST? - The second advice is applicable to all methods in Class C, but a method m() is affected by the first advice. Thus, the first advice executes first than the second. I want a way to apply to all methods non-static to execute the second advice at FIRST. And if there is a method that has an advice that affected it, I would like that this advice executes after that the advice that affect all methods non-static. IF I execute this code it returns this result: Code executed (I want to run in SECOND, but it runs in FIRST!!) before any code of method m() in Class C executes This (I want to run in FIRST before everything) must execute before anything in methdo m() in Class C (So , I want a way to bring me a inverse result!!!) Thanks to ALL! -- -------------------------------------------- Henrique Mostaert EIG 2005 - Eclipse Innovation Grant - Awards Program Sun Certified Programmer for Java2 platform 1.4 CONFIDENTIAL AND PRIVILEGED INFORMATION NOTICE This e-mail, and any attachments, may contain information that is confidential, subject to copyright, or exempt from disclosure. Any unauthorized review, disclosure, retransmission, dissemination or other use of or reliance on this information may be unlawful and is strictly prohibited. AVIS D'INFORMATION CONFIDENTIELLE ET PRIVILÉGIÉE Le présent courriel, et toute pièce jointe, peut contenir de l'information qui est confidentielle, régie par les droits d'auteur, ou interdite de divulgation. Tout examen, divulgation, retransmission, diffusion ou autres utilisations non autorisées de l'information ou dépendance non autorisée envers celle-ci peut être illégale et est strictement interdite.
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
