diff options
author | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
commit | 144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch) | |
tree | b12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/new/FormalMatching.java | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/new/FormalMatching.java')
-rw-r--r-- | tests/new/FormalMatching.java | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/tests/new/FormalMatching.java b/tests/new/FormalMatching.java new file mode 100644 index 000000000..37c485e71 --- /dev/null +++ b/tests/new/FormalMatching.java @@ -0,0 +1,52 @@ +import org.aspectj.lang.*; +import org.aspectj.testing.*; + +public class FormalMatching { + public static void main(String[] args) { + new FormalMatching().realMain(args); + } + public void realMain(String[] args) { + call_v(); + call_vI(0); + call_vII(0,1); + call_i(); + call_iI(0); + call_iII(0,1); + Tester.checkAllEvents(); + } + + static String[] methods = { + "call_v", "call_vI", "call_vII", + "call_i", "call_iI", "call_iII", + }; + static { + for (int i = 0; i < methods.length; i++) { + Tester.expectEvent(methods[i]); + Tester.expectEvent(methods[i] + "-advice"); + } + } + + void call_v () { Tester.event("call_v"); } + void call_vI (int i0) { Tester.event("call_vI"); } + void call_vII(int i0, int i1) { Tester.event("call_vII"); } + + int call_i () { Tester.event("call_i"); return 0; } + int call_iI (int i0) { Tester.event("call_iI"); return 0; } + int call_iII(int i0, int i1) { Tester.event("call_iII"); return 0; } +} + +aspect Aspect { + pointcut args0(Object o): call(* call*()) && target(o); + pointcut args1(Object o, int i0): call(* call*(int)) && target(o) && args(i0); + pointcut args2(Object o, int i0, int i1): call(* call*(int,int)) && target(o) && args(i0, i1); + + before(Object o): args0(o) { a(thisJoinPoint); } + before(Object o, int i0): args1(o,i0) { a(thisJoinPoint); } + before(Object o, int i0, int i1): args2(o,i0,i1) { a(thisJoinPoint); } + + static void a(JoinPoint jp) { + Tester.event(jp.getSignature().getName() + "-advice"); + } +} + + |