Skip to main content

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

Thank you for your reply andrew.
Are you saying that this only works for assignments occurring outside
of methods? So, in initializers and field declarations?  Doesn't make
sense.  Can you be more specific?

You are right that did not make sense.

> seems to work accepts assignments with in methods. Any suggestions on how to
> do that?
should be
> seems to work accepts in case of assignments to local variables with in methods. I know this is because set pointcut does not trigger on local variable assignment but, is there another way to overcome this?

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) {
 ...
}
I did try this but the pointcut stopped matching some join points i was interested in. I will try it again and report back.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Back to the top