blob: 464b8e4c8e1a51fbd68a347cf0b51182c919b058 (
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
30
31
32
33
34
35
36
|
import org.aspectj.lang.*;
import org.aspectj.testing.*;
import java.io.*;
public class EmptyStack{
public static void main(String[] args){
try {
EmptyStackAspect.InnerEmptyStackAspect a = EmptyStackAspect.InnerEmptyStackAspect.aspectOf();
} catch (java.util.EmptyStackException ese) {
String msg = "";
class PW extends PrintWriter {
PW() { super((Writer)null); }
String msg = "";
public void write(int c) { msg += c; }
}
PW pw = new PW();
ese.printStackTrace(pw);
Tester.check(false, pw.msg);
} catch (NoAspectBoundException nae) {
Tester.note("caught NoAspectBound");
}
Tester.check("caught NoAspectBound");
}
}
abstract aspect EmptyStackAspect {
pointcut testCut();
public static aspect InnerEmptyStackAspect percflow(testCut()){
}
}
aspect MyEmptyStackAspect extends EmptyStackAspect issingleton() {
pointcut testCut(): call(void EmptyStack.test(..)) ;
}
|