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
77
78
79
80
81
82
|
import org.aspectj.testing.*;
public class StrictFpReceptions {
// reception counter
static int r_counter = 0;
// call counter
static int c_counter = 0;
public static void main(String[] args) {
StrictClass s = new StrictClass();
StrictClassAbstract sa = s;
cleanup();
s.test1();
Tester.check
(r_counter==1 && c_counter==1,
"test1 method call, " +
"counters="+r_counter+","+c_counter);
cleanup();
sa.test2();
Tester.check
(r_counter==0 && c_counter==0,
"test2 method call, " +
"counters="+r_counter+","+c_counter);
cleanup();
sa.test3();
Tester.check
(r_counter==1 && c_counter==1,
"test3 method call, " +
"counters="+r_counter+","+c_counter);
cleanup();
sa.test4();
Tester.check
(r_counter==1 && c_counter==1,
"test4 static method call, " +
"counters="+r_counter+","+c_counter);
cleanup();
sa.test5();
Tester.check
(r_counter==0 && c_counter==0,
"test5 static method call, " +
"counters="+r_counter+","+c_counter);
}
private static void cleanup() {
r_counter = c_counter = 0;
}
}
aspect StrictFpWatcher {
pointcut r_strict() : execution(strictfp * *(..));
pointcut c_strict() : call(strictfp * *.*(..));
before() : r_strict() { StrictFpReceptions.r_counter++; }
before() : c_strict() { StrictFpReceptions.c_counter++; }
}
abstract class StrictClassAbstract {
float f;
double d;
StrictClassAbstract() {}
StrictClassAbstract(double _d) { d = _d; }
public abstract float test1();
public float test2() { return 0.f; }
public strictfp float test3() { return 0.f; }
public static strictfp float test4() { return 0.f; }
public static float test5() { return 0.f; }
};
strictfp class StrictClass extends StrictClassAbstract {
public float test1() { return 0.f; }
}
|