I have the following classes
class A {
public void someone() {
helpMe();
}
private void helpMe() {
// do something here
}
}
class B extends A {
public void help() {
super.someone();
}
}
class C extends A {
public void me() {
super.someone();
}
}
So I want to do something everytime helpMe
method is called. A.helpMe()
is never called explicitly. All of the method calls for A.helpMe()
is through A.someone()
which is further called through either B.help()
or C.me()
.
helpMe
contains a common implementation that every other class needs.
pointcuts I have tried
execution(* A.helpMe(..)) // does not work
execution(* A+.helpMe(..)) // does not work
execution(* *.helpMe(..)) // does not work
execution(* A.*(..)) // does not work
execution(* B.someone(..)) // does not work
execution(* A+.*(..)) // forms a point cut for B.help() and C.me() only
execution(* *.*(..)) // forms a point cut for B.help() and C.me() only
execution(* B.*(..)) // forms a point cut for B.help() only
I read somewhere that pointcuts
for super
is not allowed. If thats the case, what are some valid work arounds?
I've tried getting pointcut
with annotations
but it does not work either.