Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AJDT » @DeclareParents
@DeclareParents [message #592666] Thu, 23 March 2006 23:42
Scott is currently offline ScottFriend
Messages: 33
Registered: July 2009
I am using @AspectJ annotation style development. Thumbs up to whomever
decided to do it this way. I like it. However I think I might be way to
early in trying to use it. @DeclareParents does not appear to be working.
I found this
( ml) posting
and its related messages. I am wondering if this is still not in? Or am I
missing something?

Here is the code I am running. It was taken from ce/ataspectj.html
and was slightly modified. It assumes an implementation of a Lockable
interface which has three methods: void lock(), void unlock(), boolean
locked(). It also assumes you have a class (HelloAnnotetedAOP - just a
hello world type class) to weave into.

public class AnnotatedAspect {

public static Lockable mixin;

@Pointcut("execution(* *())")
void anyExecution() {}

@Before(value="anyExecution() && this(mixin)")
public void checkNotLocked(Lockable mixin) {
if (mixin.locked()) System.out.println("Locked!...");
else System.out.println("Not locked!...");

public void doBefore() {
System.out.println("Hello before!...");

public void doAfter() {
System.out.println("Hello after!...");


This prints out:
Hello before!...
Hello after!...
Previous Topic:Infinite build loop
Next Topic:@DeclareParents
Goto Forum:

Current Time: Fri Jun 22 09:54:54 GMT 2018

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

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

Back to the top