blob: 61c868efec7e553d94fd0b6d8f1f50f07cb6c0a8 (
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
|
import org.aspectj.testing.Tester;
public class ArgsAlone {
public static void main(String[] args) {
Tester.expectEvent("within 2 method-call");
Tester.expectEvent("within 2 method-execution");
new TargetClass().callInt(2);
Tester.checkAllEvents();
}
}
class TargetClass {
void callInt(int i) {
while (i > 0) { --i; }
}
}
aspect Aspect {
pointcut pc ()
: (call(void TargetClass.callInt(int))
|| execution(void TargetClass.callInt(int)));
before(int i)
: !target(Aspect) && args(i) && !target(StringBuffer)
//&& pc() // uncomment to avoid InternalCompilerError
{
Tester.event("within " + i
+ " " + thisJoinPointStaticPart.getKind());
}
}
|