Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » New to AspectJ
New to AspectJ [message #69564] Sat, 24 February 2007 20:05
Eclipse UserFriend
Originally posted by: aj.tomorrowenterprises.com

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?
Previous Topic:Keep getting NoClassDefFoundError when AspectJ Capability is active
Next Topic:New to AspectJ
Goto Forum:
  


Current Time: Thu Apr 25 13:53:25 GMT 2024

Powered by FUDForum. Page generated in 0.02864 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top