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/Cricket.java | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/new/Cricket.java')
-rw-r--r-- | tests/new/Cricket.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/new/Cricket.java b/tests/new/Cricket.java new file mode 100644 index 000000000..33c1849e1 --- /dev/null +++ b/tests/new/Cricket.java @@ -0,0 +1,50 @@ +import org.aspectj.testing.Tester; + +public class Cricket { + public static void main(String[] args) { + Lib l = new Lib(); + Tester.event("call stringMethod"); + l.stringMethod(2); + Tester.event("call voidMethod"); + l.voidMethod(2); + Tester.checkEventsFromFile("Cricket.out"); + } +} + + +class Lib { + public void voidMethod(int count) { + if (count == 0) return; + else voidMethod(count - 1); + } + + public String stringMethod(int count) { + if (count == 0) return "0"; + else return count + "-" + stringMethod(count-1); + } +} + + +aspect Trace { + pointcut entry(): target(Lib) && call(* *(..)); + pointcut topEntry(): entry() && !cflowbelow(entry()); + + before(): topEntry() { + Tester.event("->top entry: " + thisJoinPoint); + } + + after(): entry() { + Tester.event("->exit: " + thisJoinPoint); + } + + after() returning (Object o): entry() { + Tester.event("->exit: " + thisJoinPoint + " with " + o); + } + after(): topEntry() { + Tester.event("->top exit: " + thisJoinPoint); + } + + after() returning (Object o): topEntry() { + Tester.event("->top exit: " + thisJoinPoint + " with " + o); + } +} |