blob: 96952e1db3763ee4f3e3e063bc917625762d2d03 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
// Similar to PrivateCall but now foo() is a private non-static method.
public class PrivateCallInstance {
public void test () {foo("test");}
private void foo (String from) {
System.err.print(":"+from);
}
public static void main(String[] args) {
new PrivateCallInstance().test();
}
private static aspect Aspect {
pointcut execTest (PrivateCallInstance s) :
execution(* PrivateCallInstance.test()) && target(s);
before (PrivateCallInstance s) : execTest (s) {
s.foo("before");
}
void around (PrivateCallInstance s) : execTest (s) {
s.foo("around");
}
}
}
|