[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Object Graph using aspectj

You need to bind these arguments.  So, you want to do something like this:

pointcut constructor(Object caller, Object created) : (call(*.new(..))
|| call(*.new())) &&
   !within(edu.testing.lib.*)  && target(created) && this(caller);

after (Object caller) returning (Object created) : constructor(caller,
created) {

This gives me the error: bad parameter to pointcut reference.
I don't know what that means probably some thing to do with timing of returning and the constructor execution (just guessing). 
I tried in this instead

   pointcut constructor( Object caller) : (call(*.new(..))
            || call(*.new())) && !within(edu.testing.lib.*) && this(caller+);

    after (Object caller) returning (Object created) : constructor(caller){
        System.out.println( caller.toString());
        System.out.println( created.toString());
and it seems to work except in case of static context like Andrew said.