This is an example of looping in the case of "extends":
joinpointtype JP allows after {}
class Main {
public static void main(String args[]) {
new A().foo();
}
}
class B extends A {
public void foo() {
//some other code here
super.foo();
}
}
class A exhibits JP {
pointcut JP: call(* print*(..));
public void foo() {
System.out.println("foo");
}
}
aspect Asp advises JP {
after(JP jp) {
new B().foo();
}
}
The looping case for the "use" relationship:
joinpointtype JP allows after {}
class A {
public static void main(String args[]) {
Util.print("Hello");;
}
}
class Util exhibits JP {
pointcut JP: call(* print*(..));
public static void print(String s) {
System.out.println(s);
}
}
aspect Asp advises JP {
after(JP jp) {
Util.print(" World");
}
}