|
View:
New views
12 Messages
—
Rating Filter:
Alert me
|
|
|
Frustrated NewbieSo I continued on and tried to implement some simple enforcement policies that I read in the book from the Eclipse Series (trying to support development by buying products and all). It isn’t working at all and my frustration level trying to implement even simple enforcement policies is off the scale. Yesterday, I posted the following to the AspectJ newsgroup without a response yet. I continued researching on my own, even using the latest milestone AspectJ release for Eclipse 3.3M5. Still no luck. --------------- Newsgroup post: --------------- I'm new to AspectJ so please no flames. I'm using AJDT for Eclipse 3.2.1 and have been following the details from the "eclipse AspectJ" book. I'm trying to enforce simple errors such as "It is an error to implement any listener interface unless you also implement interface Foo." To do this, I want to try: pointcut listeners() : within(*..*Listener*+); pointcut myCode() : within(com.mycompany..*+); pointcut mySpecialInterface() : within(com.mycompany.Foo+); declare error: listeners() && myCode() && !mySpecialInterface() : "All listeners must implement Foo"; Since this did not work, I tried various experiments. So, I tried the following: declare error: within(*..*Listener*+) : "A"; declare error: within(com.mycompany..*+) : "B"; declare error: within(*..*Listener*+) && within(com.mycompany..*+) : "A intersect B"; declare error: within(*..*Listener*+ && com.mycompany..*+) : "A intersect' B"; declare error: within(*..*Listener*+) || within(com.mycompany..*+) : "A union B"; declare error: within(*..*Listener*+ || com.mycompany..*+) : "A union' B"; A seems to be tagged correctly on all classes that implement any interface with the word Listener in its name. B seems to tag only a fraction of the classes I have written. A intersect B and A intersect' B both result in no tags. A union B and A union' B both seem to result in the union of what A and B tagged above. AOP seems so powerful yet so cryptic. Can anybody help? _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Frustrated NewbieHello Kevin,
Could you try the following and tell us if this is what you need, please? public pointcut listeners() : within(*..*.Listener+) && !within(*..*.Listener); public pointcut mySpecialInterface() : within(*..*.Foo+) && !within(*..*.Foo); public pointcut myCode() : within(com.mycompany..*+); declare error : listeners() && !mySpecialInterface() && myCode() : "All listeners must implement Foo"; The previous has a limitation, though, since it is not possible to have interfaces extending Listener but, from what you said in your e-mail, that does not seem to be a problem. Kind regards, Paulo Zenida Citando Kevin F <aj@...>: > I¹ve been at this for 4 days now. I had some good luck with a few initial > cases where I was able to clean up some code and verify through testing it > worked like a charm. I made a couple minor tweaks to those which broke them > giving the technology an unreliable feel. I¹m willing to write that off as > inexperience. > > So I continued on and tried to implement some simple enforcement policies > that I read in the book from the Eclipse Series (trying to support > development by buying products and all). It isn¹t working at all and my > frustration level trying to implement even simple enforcement policies is > off the scale. > > Yesterday, I posted the following to the AspectJ newsgroup without a > response yet. I continued researching on my own, even using the latest > milestone AspectJ release for Eclipse 3.3M5. Still no luck. > > --------------- > Newsgroup post: > --------------- > > I'm new to AspectJ so please no flames. I'm using AJDT for Eclipse 3.2.1 > and have been following the details from the "eclipse AspectJ" book. > > I'm trying to enforce simple errors such as "It is an error to implement any > listener interface unless you also implement interface Foo." To do this, I > want to try: > > pointcut listeners() : within(*..*Listener*+); > pointcut myCode() : within(com.mycompany..*+); > pointcut mySpecialInterface() : within(com.mycompany.Foo+); > declare error: listeners() && myCode() && !mySpecialInterface() > : "All listeners must implement Foo"; > > > Since this did not work, I tried various experiments. So, I tried the > following: > > declare error: within(*..*Listener*+) > : "A"; > declare error: within(com.mycompany..*+) > : "B"; > declare error: within(*..*Listener*+) && within(com.mycompany..*+) > : "A intersect B"; > declare error: within(*..*Listener*+ && com.mycompany..*+) > : "A intersect' B"; > declare error: within(*..*Listener*+) || within(com.mycompany..*+) > : "A union B"; > declare error: within(*..*Listener*+ || com.mycompany..*+) > : "A union' B"; > > A seems to be tagged correctly on all classes that implement any interface > with the word Listener in its name. > > B seems to tag only a fraction of the classes I have written. > > A intersect B and A intersect' B both result in no tags. > > A union B and A union' B both seem to result in the union of what A and B > tagged above. > > > AOP seems so powerful yet so cryptic. Can anybody help? > > > _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Frustrated NewbieHowever, I did find one trick that seems to work. If Listener and Foo are in different packages, "listener" and "foo", respectively, the following seems to work: declare error: within(*..listener.*+) && !within(*..listener.*) && !within(*..foo.*+): "message"; The second subexpression, !within(*..listener.*) prevents an error being reported on Listener itself, since it obviously doesn't implement Foo. Not too obvious and maybe it's not convenient to organize your packages this way, but it seems to work. dean Kevin F wrote:
--
_______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Frustrated NewbieAmazingly, things seemed to behave exactly as they should. With this happy event, I tried the tests from my original posting. At the time of posting, the pointcut “within(com.mycompany..*+)” allowed 118 join points. Now, it allows > 3000 which is approximately what I expected. When I thought back on my installation within Eclipse 3.2.1, I downloaded AJDT from eclipse.org, extracted the file, copied the features to .../eclipse_3.2.1/features/, and copied the plugins to .../eclipse_3.2.1/plugins. When I installed AJDT for Eclipse 3.3M5, I used the feature installer. Is it possible that an improper installation the first time caused my AJ project to be setup incorrectly and caused all my problems? Due to my 4 days of pain, I am a bit timid at the moment; however, I want to believe that AJ is stable and reliable because
Thanks again for the responses, Kevin From: Kevin F <aj@...> Reply-To: <aspectj-users@...> Date: Sun, 25 Feb 2007 08:07:22 -0500 To: <aspectj-users@...> Conversation: Frustrated Newbie Subject: [aspectj-users] Frustrated Newbie I’ve been at this for 4 days now. I had some good luck with a few initial cases where I was able to clean up some code and verify through testing it worked like a charm. I made a couple minor tweaks to those which broke them giving the technology an unreliable feel. I’m willing to write that off as inexperience. So I continued on and tried to implement some simple enforcement policies that I read in the book from the Eclipse Series (trying to support development by buying products and all). It isn’t working at all and my frustration level trying to implement even simple enforcement policies is off the scale. Yesterday, I posted the following to the AspectJ newsgroup without a response yet. I continued researching on my own, even using the latest milestone AspectJ release for Eclipse 3.3M5. Still no luck. --------------- Newsgroup post: --------------- I'm new to AspectJ so please no flames. I'm using AJDT for Eclipse 3.2.1 and have been following the details from the "eclipse AspectJ" book. I'm trying to enforce simple errors such as "It is an error to implement any listener interface unless you also implement interface Foo." To do this, I want to try: pointcut listeners() : within(*..*Listener*+); pointcut myCode() : within(com.mycompany..*+); pointcut mySpecialInterface() : within(com.mycompany.Foo+); declare error: listeners() && myCode() && !mySpecialInterface() : "All listeners must implement Foo"; Since this did not work, I tried various experiments. So, I tried the following: declare error: within(*..*Listener*+) : "A"; declare error: within(com.mycompany..*+) : "B"; declare error: within(*..*Listener*+) && within(com.mycompany..*+) : "A intersect B"; declare error: within(*..*Listener*+ && com.mycompany..*+) : "A intersect' B"; declare error: within(*..*Listener*+) || within(com.mycompany..*+) : "A union B"; declare error: within(*..*Listener*+ || com.mycompany..*+) : "A union' B"; A seems to be tagged correctly on all classes that implement any interface with the word Listener in its name. B seems to tag only a fraction of the classes I have written. A intersect B and A intersect' B both result in no tags. A union B and A union' B both seem to result in the union of what A and B tagged above. AOP seems so powerful yet so cryptic. Can anybody help? _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Frustrated NewbieI do believe it's wise to proceed cautiously, since as you've seen, it can take some effort to understand the join point language and other aspects (pardon the pun ;) of AspectJ. I don't know what other aspects you've tried to use, but "policy enforcement" aspects like the one you posted are a good place to start, since they don't implement production functionality, but provide a supporting development role. As you build confidence, you can proceed to more "missing critical" aspects. Best wishes. dean Kevin F wrote:
--
_______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Frustrated NewbieActually, I want to use it to implement various mission critical orthogonal crosscuts to dramatically improve project velocity for a deadline in early April. Do you have experience using AJ for mission critical functionality? I spent 30+ hours on this problem in the 4 days so I will be able to devote time to fixing problems as long as I can observe the effects of my AJ changes. How likely is it that I’ll run into any more circumstances where my pointcuts filter far too many joinpoints such as my example below (118 when >3000 should have been found)? Debugging problems of the nature “the ubiquitous framework chooses not to call my code” are extreme timewasters. Kevin From: Dean Wampler <dean@...> Organization: Aspect Programming Reply-To: <aspectj-users@...> Date: Sun, 25 Feb 2007 10:51:52 -0600 To: <aspectj-users@...> Subject: Re: [aspectj-users] Frustrated Newbie I'm glad you made some headway. I'm not sure if your original installation process caused problems. I think it should have worked, but I've only used the feature installer myself. I do believe it's wise to proceed cautiously, since as you've seen, it can take some effort to understand the join point language and other aspects (pardon the pun ;) of AspectJ. I don't know what other aspects you've tried to use, but "policy enforcement" aspects like the one you posted are a good place to start, since they don't implement production functionality, but provide a supporting development role. As you build confidence, you can proceed to more "missing critical" aspects. Best wishes. dean Kevin F wrote: Re: [aspectj-users] Frustrated Newbie Paulo & Dean, thank you for your replies. I had given up and was actually in the process of purging AspectJ from my project when they arrived. So, I copied my AspectJ-free project to a new directory and used the Eclipse option to convert to AJ project. I didn’t think your suggestions were going to help since the failure I had been getting were on the expression “within(com.mycompany..*+)”; however, I tried anyway. -- Dean Wampler's Signature Dean Wampler, Ph.D. dean at aspectprogramming.com objectmentor.com <http://www.objectmentor.com> aspectprogramming.com <http://www.aspectprogramming.com> contract4j.org <http://www.contract4j.org> I want my tombstone to say: Unknown Application Error in Dean Wampler.exe. Application Terminated. Okay Cancel _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Frustrated NewbieIn general, don't forget the important lessons we've learned from pure OOD, especially the value of working with interfaces and annotations, which are another form of abstraction. In particular, when writing aspects and especially pointcuts for these production aspects, try to use only interfaces or annotations that are not likely to change often. A common pitfall in the early days of AOP and AspectJ was to hard-code concrete details of package, class, and method names. As soon as someone refactored one of these names, the aspect broke. Our tools aren't good enough yet to handle these refactorings robustly. (Your example below used interfaces; the point is worth emphasizing, though!) Of course, this means that the classes you want to advise must implement the interfaces and or have the annotations you need for your pointcuts. Exposing such abstractions is a good idea, anyway! Good luck and don't hesitate to ask for help on the list as you proceed. dean Kevin F wrote:
--
_______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
RE: Frustrated NewbieKevin,
I guess the question that springs into my mind is, when implementing any new technology you can and should expect some sort of ramp up period. It sounds to me like that is in part what has played into your frustrations. I know I for one has spent many hours on learning a new framework, getting frustrated, etc. until I hit that ah ha moment where it finally clicked. I would say that using AJDT within Eclipse should help you tremendously in accelerating the learning curve because you get immediate visual feedback on what may/may not be wrong with your pointcut definitions. I remember a time when AJDT did not exist and you have to perform trial and error and generate the source to find out what was going on. I have experience using AJ for mission critical applications and it worked just fine. I used it to convert an entire section of my application to effectively implement a template method without changing the external interface of that section of code. Ron ________________________________ From: aspectj-users-bounces@... on behalf of Kevin F Sent: Sun 2/25/2007 12:15 PM To: aspectj-users@... Subject: Re: [aspectj-users] Frustrated Newbie Thanks. Actually, I want to use it to implement various mission critical orthogonal crosscuts to dramatically improve project velocity for a deadline in early April. Do you have experience using AJ for mission critical functionality? I spent 30+ hours on this problem in the 4 days so I will be able to devote time to fixing problems as long as I can observe the effects of my AJ changes. How likely is it that I'll run into any more circumstances where my pointcuts filter far too many joinpoints such as my example below (118 when >3000 should have been found)? Debugging problems of the nature "the ubiquitous framework chooses not to call my code" are extreme timewasters. Kevin ________________________________ From: Dean Wampler <dean@...> Organization: Aspect Programming Reply-To: <aspectj-users@...> Date: Sun, 25 Feb 2007 10:51:52 -0600 To: <aspectj-users@...> Subject: Re: [aspectj-users] Frustrated Newbie I'm glad you made some headway. I'm not sure if your original installation process caused problems. I think it should have worked, but I've only used the feature installer myself. I do believe it's wise to proceed cautiously, since as you've seen, it can take some effort to understand the join point language and other aspects (pardon the pun ;) of AspectJ. I don't know what other aspects you've tried to use, but "policy enforcement" aspects like the one you posted are a good place to start, since they don't implement production functionality, but provide a supporting development role. As you build confidence, you can proceed to more "missing critical" aspects. Best wishes. dean Kevin F wrote: Re: [aspectj-users] Frustrated Newbie Paulo & Dean, thank you for your replies. I had given up and was actually in the process of purging AspectJ from my project when they arrived. So, I copied my AspectJ-free project to a new directory and used the Eclipse option to convert to AJ project. I didn't think your suggestions were going to help since the failure I had been getting were on the expression "within(com.mycompany..*+)"; however, I tried anyway. Amazingly, things seemed to behave exactly as they should. With this happy event, I tried the tests from my original posting. At the time of posting, the pointcut "within(com.mycompany..*+)" allowed 118 join points. Now, it allows > 3000 which is approximately what I expected. When I thought back on my installation within Eclipse 3.2.1, I downloaded AJDT from eclipse.org, extracted the file, copied the features to .../eclipse_3.2.1/features/, and copied the plugins to .../eclipse_3.2.1/plugins. When I installed AJDT for Eclipse 3.3M5, I used the feature installer. Is it possible that an improper installation the first time caused my AJ project to be setup incorrectly and caused all my problems? Due to my 4 days of pain, I am a bit timid at the moment; however, I want to believe that AJ is stable and reliable because 1. it is used in a lot of projects 2. it has the awesome power (for good or bad) to make massive changes to the code that I write 3. Thanks again for the responses, Kevin ________________________________ From: Kevin F <aj@...> <mailto:aj@...> <mailto:aj@...> Reply-To: <aspectj-users@...> <mailto:aspectj-users@...> <mailto:aspectj-users@...> Date: Sun, 25 Feb 2007 08:07:22 -0500 To: <aspectj-users@...> <mailto:aspectj-users@...> <mailto:aspectj-users@...> Conversation: Frustrated Newbie Subject: [aspectj-users] Frustrated Newbie I've been at this for 4 days now. I had some good luck with a few initial cases where I was able to clean up some code and verify through testing it worked like a charm. I made a couple minor tweaks to those which broke them giving the technology an unreliable feel. I'm willing to write that off as inexperience. So I continued on and tried to implement some simple enforcement policies that I read in the book from the Eclipse Series (trying to support development by buying products and all). It isn't working at all and my frustration level trying to implement even simple enforcement policies is off the scale. Yesterday, I posted the following to the AspectJ newsgroup without a response yet. I continued researching on my own, even using the latest milestone AspectJ release for Eclipse 3.3M5. Still no luck. --------------- Newsgroup post: --------------- I'm new to AspectJ so please no flames. I'm using AJDT for Eclipse 3.2.1 and have been following the details from the "eclipse AspectJ" book. I'm trying to enforce simple errors such as "It is an error to implement any listener interface unless you also implement interface Foo." To do this, I want to try: pointcut listeners() : within(*..*Listener*+); pointcut myCode() : within(com.mycompany..*+); pointcut mySpecialInterface() : within(com.mycompany.Foo+); declare error: listeners() && myCode() && !mySpecialInterface() : "All listeners must implement Foo"; Since this did not work, I tried various experiments. So, I tried the following: declare error: within(*..*Listener*+) : "A"; declare error: within(com.mycompany..*+) : "B"; declare error: within(*..*Listener*+) && within(com.mycompany..*+) : "A intersect B"; declare error: within(*..*Listener*+ && com.mycompany..*+) : "A intersect' B"; declare error: within(*..*Listener*+) || within(com.mycompany..*+) : "A union B"; declare error: within(*..*Listener*+ || com.mycompany..*+) : "A union' B"; A seems to be tagged correctly on all classes that implement any interface with the word Listener in its name. B seems to tag only a fraction of the classes I have written. A intersect B and A intersect' B both result in no tags. A union B and A union' B both seem to result in the union of what A and B tagged above. AOP seems so powerful yet so cryptic. Can anybody help? ________________________________ _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users ________________________________ _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users -- Dean Wampler's Signature Dean Wampler, Ph.D. dean at aspectprogramming.com objectmentor.com <http://www.objectmentor.com> <http://www.objectmentor.com/> aspectprogramming.com <http://www.aspectprogramming.com> <http://www.aspectprogramming.com/> contract4j.org <http://www.contract4j.org> <http://www.contract4j.org/> I want my tombstone to say: Unknown Application Error in Dean Wampler.exe. Application Terminated. Okay Cancel ________________________________ _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Frustrated NewbieFrom: Ron DiFrango <rdifrango@...> Reply-To: <aspectj-users@...> Date: Sun, 25 Feb 2007 13:13:12 -0500 To: <aspectj-users@...> Conversation: [aspectj-users] Frustrated Newbie Subject: RE: [aspectj-users] Frustrated Newbie Kevin, I guess the question that springs into my mind is, when implementing any new technology you can and should expect some sort of ramp up period. It sounds to me like that is in part what has played into your frustrations. I know I for one has spent many hours on learning a new framework, getting frustrated, etc. until I hit that ah ha moment where it finally clicked. I would say that using AJDT within Eclipse should help you tremendously in accelerating the learning curve because you get immediate visual feedback on what may/may not be wrong with your pointcut definitions. I remember a time when AJDT did not exist and you have to perform trial and error and generate the source to find out what was going on. I have experience using AJ for mission critical applications and it worked just fine. I used it to convert an entire section of my application to effectively implement a template method without changing the external interface of that section of code. Ron ________________________________ From: aspectj-users-bounces@... on behalf of Kevin F Sent: Sun 2/25/2007 12:15 PM To: aspectj-users@... Subject: Re: [aspectj-users] Frustrated Newbie Thanks. Actually, I want to use it to implement various mission critical orthogonal crosscuts to dramatically improve project velocity for a deadline in early April. Do you have experience using AJ for mission critical functionality? I spent 30+ hours on this problem in the 4 days so I will be able to devote time to fixing problems as long as I can observe the effects of my AJ changes. How likely is it that I'll run into any more circumstances where my pointcuts filter far too many joinpoints such as my example below (118 when >3000 should have been found)? Debugging problems of the nature "the ubiquitous framework chooses not to call my code" are extreme timewasters. Kevin ________________________________ From: Dean Wampler <dean@...> Organization: Aspect Programming Reply-To: <aspectj-users@...> Date: Sun, 25 Feb 2007 10:51:52 -0600 To: <aspectj-users@...> Subject: Re: [aspectj-users] Frustrated Newbie I'm glad you made some headway. I'm not sure if your original installation process caused problems. I think it should have worked, but I've only used the feature installer myself. I do believe it's wise to proceed cautiously, since as you've seen, it can take some effort to understand the join point language and other aspects (pardon the pun ;) of AspectJ. I don't know what other aspects you've tried to use, but "policy enforcement" aspects like the one you posted are a good place to start, since they don't implement production functionality, but provide a supporting development role. As you build confidence, you can proceed to more "missing critical" aspects. Best wishes. dean Kevin F wrote: Re: [aspectj-users] Frustrated Newbie Paulo & Dean, thank you for your replies. I had given up and was actually in the process of purging AspectJ from my project when they arrived. So, I copied my AspectJ-free project to a new directory and used the Eclipse option to convert to AJ project. I didn't think your suggestions were going to help since the failure I had been getting were on the expression "within(com.mycompany..*+)"; however, I tried anyway. Amazingly, things seemed to behave exactly as they should. With this happy event, I tried the tests from my original posting. At the time of posting, the pointcut "within(com.mycompany..*+)" allowed 118 join points. Now, it allows > 3000 which is approximately what I expected. When I thought back on my installation within Eclipse 3.2.1, I downloaded AJDT from eclipse.org, extracted the file, copied the features to .../eclipse_3.2.1/features/, and copied the plugins to .../eclipse_3.2.1/plugins. When I installed AJDT for Eclipse 3.3M5, I used the feature installer. Is it possible that an improper installation the first time caused my AJ project to be setup incorrectly and caused all my problems? Due to my 4 days of pain, I am a bit timid at the moment; however, I want to believe that AJ is stable and reliable because 1. it is used in a lot of projects 2. it has the awesome power (for good or bad) to make massive changes to the code that I write 3. Thanks again for the responses, Kevin ________________________________ From: Kevin F <aj@...> aj@... aj@... Reply-To: <aspectj-users@...> aspectj-users@... aspectj-users@... Date: Sun, 25 Feb 2007 08:07:22 -0500 To: <aspectj-users@...> aspectj-users@... aspectj-users@... Conversation: Frustrated Newbie Subject: [aspectj-users] Frustrated Newbie I've been at this for 4 days now. I had some good luck with a few initial cases where I was able to clean up some code and verify through testing it worked like a charm. I made a couple minor tweaks to those which broke them giving the technology an unreliable feel. I'm willing to write that off as inexperience. So I continued on and tried to implement some simple enforcement policies that I read in the book from the Eclipse Series (trying to support development by buying products and all). It isn't working at all and my frustration level trying to implement even simple enforcement policies is off the scale. Yesterday, I posted the following to the AspectJ newsgroup without a response yet. I continued researching on my own, even using the latest milestone AspectJ release for Eclipse 3.3M5. Still no luck. --------------- Newsgroup post: --------------- I'm new to AspectJ so please no flames. I'm using AJDT for Eclipse 3.2.1 and have been following the details from the "eclipse AspectJ" book. I'm trying to enforce simple errors such as "It is an error to implement any listener interface unless you also implement interface Foo." To do this, I want to try: pointcut listeners() : within(*..*Listener*+); pointcut myCode() : within(com.mycompany..*+); pointcut mySpecialInterface() : within(com.mycompany.Foo+); declare error: listeners() && myCode() && !mySpecialInterface() : "All listeners must implement Foo"; Since this did not work, I tried various experiments. So, I tried the following: declare error: within(*..*Listener*+) : "A"; declare error: within(com.mycompany..*+) : "B"; declare error: within(*..*Listener*+) && within(com.mycompany..*+) : "A intersect B"; declare error: within(*..*Listener*+ && com.mycompany..*+) : "A intersect' B"; declare error: within(*..*Listener*+) || within(com.mycompany..*+) : "A union B"; declare error: within(*..*Listener*+ || com.mycompany..*+) : "A union' B"; A seems to be tagged correctly on all classes that implement any interface with the word Listener in its name. B seems to tag only a fraction of the classes I have written. A intersect B and A intersect' B both result in no tags. A union B and A union' B both seem to result in the union of what A and B tagged above. AOP seems so powerful yet so cryptic. Can anybody help? ________________________________ _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users ________________________________ _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users -- Dean Wampler's Signature Dean Wampler, Ph.D. dean at aspectprogramming.com objectmentor.com <http://www.objectmentor.com> <http://www.objectmentor.com/> aspectprogramming.com <http://www.aspectprogramming.com> <http://www.aspectprogramming.com/> contract4j.org <http://www.contract4j.org> <http://www.contract4j.org/> I want my tombstone to say: Unknown Application Error in Dean Wampler.exe. Application Terminated. Okay Cancel ________________________________ _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Frustrated NewbieFrom: Dean Wampler <dean@...> Organization: Aspect Programming Reply-To: <aspectj-users@...> Date: Sun, 25 Feb 2007 12:10:43 -0600 To: <aspectj-users@...> Subject: Re: [aspectj-users] Frustrated Newbie I suggest picking one of your simpler cross-cutting concerns first to see how it goes. Perhaps time-boxing your experiment will keep you from taking too long, should it not work out! In general, don't forget the important lessons we've learned from pure OOD, especially the value of working with interfaces and annotations, which are another form of abstraction. In particular, when writing aspects and especially pointcuts for these production aspects, try to use only interfaces or annotations that are not likely to change often. A common pitfall in the early days of AOP and AspectJ was to hard-code concrete details of package, class, and method names. As soon as someone refactored one of these names, the aspect broke. Our tools aren't good enough yet to handle these refactorings robustly. (Your example below used interfaces; the point is worth emphasizing, though!) Of course, this means that the classes you want to advise must implement the interfaces and or have the annotations you need for your pointcuts. Exposing such abstractions is a good idea, anyway! Good luck and don't hesitate to ask for help on the list as you proceed. dean Kevin F wrote: Re: [aspectj-users] Frustrated Newbie Thanks. -- Dean Wampler's Signature Dean Wampler, Ph.D. dean at aspectprogramming.com objectmentor.com <http://www.objectmentor.com> aspectprogramming.com <http://www.aspectprogramming.com> contract4j.org <http://www.contract4j.org> I want my tombstone to say: Unknown Application Error in Dean Wampler.exe. Application Terminated. Okay Cancel _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Frustrated Newbie
Kevin F wrote:
Both of those books are too early to cover Java 5 annotation support. The online AspectJ 5 manual has a complete discussion of how to write PCDs that match on annotations, etc. (Note, this manual is also in the Eclipse Help, once you've installed AJDT.) I'm sure a number of people have written aspects that use annotation matching and you might google for them. One of those people happens to be me ;) My contract4j project is based exclusively on annotations (contract4j.org). You could look at the aspects inside to get some examples. dean _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
|
|
Re: Frustrated NewbieFrom: Dean Wampler <dean@...> Organization: Aspect Programming Reply-To: <aspectj-users@...> Date: Sun, 25 Feb 2007 14:56:50 -0600 To: <aspectj-users@...> Subject: Re: [aspectj-users] Frustrated Newbie Kevin F wrote: Re: [aspectj-users] Frustrated Newbie I’m definitely familiar with using interfaces for good measure, and I’m theoretically familiar with annotations; however, I don’t have real world project experience using annotations heavily. Can you point me to a good example that combines AJ w/ annotations? I can’t find any combination examples in Colyer et al.’s book from the Eclipse Series. AspectJ in Action looks pretty good. Does anyone know if it does a better job combining these two features? Or maybe some other source? Both of those books are too early to cover Java 5 annotation support. The online AspectJ 5 manual has a complete discussion of how to write PCDs that match on annotations, etc. (Note, this manual is also in the Eclipse Help, once you've installed AJDT.) I'm sure a number of people have written aspects that use annotation matching and you might google for them. One of those people happens to be me ;) My contract4j project is based exclusively on annotations (contract4j.org). You could look at the aspects inside to get some examples. dean _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list aspectj-users@... https://dev.eclipse.org/mailman/listinfo/aspectj-users |
| Free embeddable forum powered by Nabble | Forum Help |