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/PR415.java | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/new/PR415.java')
-rw-r--r-- | tests/new/PR415.java | 69 |
1 files changed, 69 insertions, 0 deletions
diff --git a/tests/new/PR415.java b/tests/new/PR415.java new file mode 100644 index 000000000..2d9f22737 --- /dev/null +++ b/tests/new/PR415.java @@ -0,0 +1,69 @@ +import org.aspectj.testing.*; + +public class PR415 { + public static void main(String[] args) { + ASTObject ast = new ASTObject(); + ast.f1(); + ast.f2(); + ast.f3(); + ast.g1(); + ast.g2(); + ast.g3(); + Tester.checkAllEvents(); + } + static { + Tester.expectEventsInString("V(V),V(S),V(SS),f1,f2,f3"); + Tester.expectEventsInString("I(V),I(S),I(SS),g1,g2,g3"); + Tester.expectEventsInString("Vc,VcS,VcSS,Ic,IcS,IcSS"); + } +} + +aspect Loses { + void around(ASTObject ast): + call(void ASTObject.voidMethod()) && target(ast) { + Tester.event("Vc"); + proceed(ast); + } + void around(ASTObject ast, String msg): + call(void ASTObject.voidMethod(String)) && target(ast) && args(msg) { + Tester.event("VcS"); + proceed(ast,msg); + } + void around(ASTObject ast, String msg1, String msg2): + call(void ASTObject.voidMethod(String, String)) && target(ast) && args(msg1, msg2) { + Tester.event("VcSS"); + proceed(ast,msg1,msg2); + } + + int around(ASTObject ast): + call(int ASTObject.intMethod()) && target(ast) { + Tester.event("Ic"); + return proceed(ast); + } + int around(ASTObject ast, String msg): + call(int ASTObject.intMethod(String)) && target(ast) && args(msg) { + Tester.event("IcS"); + return proceed(ast,msg); + } + int around(ASTObject ast, String msg1, String msg2): + call(int ASTObject.intMethod(String, String)) && target(ast) && args(msg1, msg2) { + Tester.event("IcSS"); + return proceed(ast,msg1,msg2); + } +} + +class ASTObject { + void voidMethod() { Tester.event("V(V)"); } + void voidMethod(String msg) { Tester.event("V(S)"); } + void voidMethod(String msg1, String msg2) { Tester.event("V(SS)"); } + void f1() { voidMethod(); Tester.event("f1"); } + void f2() { voidMethod(null); Tester.event("f2"); } + void f3() { voidMethod(null, null); Tester.event("f3"); } + + int intMethod() { Tester.event("I(V)"); return -1; } + int intMethod(String msg) { Tester.event("I(S)"); return -1; } + int intMethod(String msg1, String msg2) { Tester.event("I(SS)"); return -1; } + void g1() { intMethod(); Tester.event("g1"); } + void g2() { intMethod(null); Tester.event("g2"); } + void g3() { intMethod(null, null); Tester.event("g3"); } +} |