Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Using an after on a function called within an aspect

I seem to be having difficulty with this attempt to use after advice.
Basically, in one aspect, I am declaring a function on a
class....Actually, code might help this.

class HappyClass {
}

aspect HappyAspect {
 Foo HappyClass.foo = null;

 public void HappyClass.doFoo() {
   foo = new Foo();
 }
}

aspect OtherAspect {
 after(Foo f) : call(Foo.new()) && target(f) && within(HappyClass) {
   // Do something cool here
 }
 after(Foo f) : call(Foo.new()) && target(f) &&
withincode(HappyClass.doFoo()) {
   // Do something cool here
 }
 after(Foo f) : call(Foo.new()) && target(f) && within(HappyAspect) {
   // Do something cool here
 }
 after(Foo f) : call(Foo.new()) && target(f) {
   // Do something cool here
 }
}

Note that this does not apply, it says the advice did not match.  None
of the above advice applies.  Is there some trick I need to use to
aspect on function calls within injected methods?  Is this even
possible?  How would I do it if it is possible?

Thanks in advance,
Kendall


Back to the top