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;
import org.aspectj.lang.*;
import org.aspectj.lang.reflect.*;
import java.util.Arrays;
/** @testcase PR#764 binding args with indeterminate prefix and suffix */
public class IndeterminateArgsCE {
public static void main (String[] args) {
STarget c;
c = new STarget();
c = new STarget("s1");
c = new STarget("s1", "s2");
c = new STarget("s1", "s2", "s3");
c.f();
c.f("s1");
c.f("s1", "s2");
c.f("s1", "s2", "s3");
OTarget o;
o = new OTarget();
o = new OTarget("o1");
o = new OTarget("o1", "o2");
o = new OTarget("o1", "o2", "o3");
o.f();
o.f("o1");
o.f("o1", "o2");
o.f("o1", "o2", "o3");
}
}
class OTarget {
OTarget() { }
OTarget(String s1) { }
OTarget(String s1, Object s2) { } // CE
OTarget(String s1, Object s2, String s3) { } // CE
void f() { }
void f(String s1) { }
void f(String s1, Object s2) { } // CE
void f(String s1, Object s2, String s3) { } // CE
}
class STarget {
STarget() { }
STarget(String s1) { }
STarget(String s1, String s2) { } // CE
STarget(String s1, String s2, String s3) { }
void f() { }
void f(String s1) { }
void f(String s1, String s2) { } // CE
void f(String s1, String s2, String s3) { }
}
aspect A {
void check(String pc, JoinPoint jp) {
Class[] types = ((CodeSignature) jp.getSignature()).getParameterTypes();
//T.e(pc + ": " + Arrays.asList(types));
}
pointcut safeS() : target(STarget) && (call(new(..)) || call(* *(..)));
pointcut safeO() : target(OTarget) && (call(new(..)) || call(* *(..)));
pointcut o1Anywhere() : args(.., Object, ..);
pointcut s1Anywhere() : args(.., String, ..);
pointcut bo1Anywhere(Object o) : args(.., o, ..);
pointcut bs1Anywhere(String s) : args(.., s, ..);
before() : safeO() && o1Anywhere() { check ("o1Anywhere()", thisJoinPoint); }
before(Object o1) : safeO() && bo1Anywhere(o1) { check ("bo1Anywhere(o1)", thisJoinPoint); }
before() : safeS() && s1Anywhere() { check ("s1Anywhere()", thisJoinPoint); }
before(String s1) : safeS() && bs1Anywhere(s1) { check ("bs1Anywhere(s1)", thisJoinPoint); }
}
|