blob: 454fdb1f1a529cba979b547b92b0f0c49a28b216 (
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
28
29
|
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
public aspect Four {
public static void main(String[] args) {
new C().m();
try {new C().m2(); } catch (MyException me) {int i=1;}
}
after() returning: execution(synchronized * m(..)) { System.err.println("execution advice running1");}
after() throwing: execution(synchronized * m2(..)) { System.err.println("execution advice running2");}
}
class C {
public synchronized void m() {
System.err.println("hello");
}
public synchronized void m2() {
System.err.println("hello");
throw new MyException();
}
}
class MyException extends RuntimeException { }
aspect FourX { pointcut p(): lock(); }
|