blob: 00fc340dc60a1c542863983a51f8a3a897901955 (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
import org.aspectj.testing.Tester;
// PR#259 "throws Exception" clause is unnecessarily added to Driver.main method
public class Driver {
/*private*/ static String s = "";
public static void main(String[] args) { test(); }
public static void test() {
Driver ts = new Driver();
Tester.checkEqual(s, "-bound-around", "bound");
}
void bind() throws Exception { s += "-bound"; }
public Driver() { bind(); }
}
aspect Aspect {
pointcut bind(): within(Driver) && call(void Driver.bind());
declare soft: Exception: bind();
void around(): bind() {
try {
proceed();
} catch (Exception e) { }
Driver.s += "-around";
}
}
/* HERE IS THE FIXED VERSION OF MARK'S TEST (the one in the bug
database was broken):
public class Driver
{
Driver() throws Exception { }
public static void main(String[] args) {
Driver ts = new Driver();
Driver.bind("foo",ts);
}
static void bind(String s, Object o)
{}
static around() returns Driver: within(Driver) &&
calls(Driver, new() ){
Driver result = null;
try {
result = proceed();
} catch (Exception e){ }
return result;
}
static around(String name) returns void:
within(Driver) &&
calls(Driver, * bind(name,..)) {
try {
proceed(name + "0");
} catch (Exception e) { }
}
static before(String[] args):
within(Driver) && executions(void main(args)){
System.out.println("...");
}
}
*/
|