summaryrefslogtreecommitdiffstats
path: root/tests/new/PointcutFormals.java
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 18:51:06 +0000
committerwisberg <wisberg>2002-12-16 18:51:06 +0000
commit144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch)
treeb12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/new/PointcutFormals.java
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/PointcutFormals.java')
-rw-r--r--tests/new/PointcutFormals.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/tests/new/PointcutFormals.java b/tests/new/PointcutFormals.java
new file mode 100644
index 000000000..d50de023c
--- /dev/null
+++ b/tests/new/PointcutFormals.java
@@ -0,0 +1,41 @@
+import org.aspectj.testing.*;
+
+public class PointcutFormals {
+ public static void main(String[] args) {
+ new PointcutFormals().call(0);
+ Tester.checkAllEvents();
+ }
+ void call(int i) {}
+
+ static {
+ String[] cuts = { "calls_pc", "receptions_pc", "executions_pc" };
+ String[] kinds = { "before", "after", "around" };
+ for (int i = 0; i < cuts.length; i++) {
+ for (int j = 0; j < kinds.length; j++) {
+ Tester.expectEvent(kinds[j] + "." + cuts[i]);
+ }
+ }
+ }
+}
+
+aspect Aspect {
+ pointcut calls_pc (): call(void *.call(int)) && within(PointcutFormals);
+ pointcut receptions_pc(): call(void PointcutFormals.call(int));
+ pointcut executions_pc(): execution(void *(int));
+
+ before(): calls_pc () { a("before.calls_pc"); }
+ before(): receptions_pc() { a("before.receptions_pc"); }
+ before(): executions_pc() { a("before.executions_pc"); }
+
+ after(): calls_pc () { a("after.calls_pc"); }
+ after(): receptions_pc() { a("after.receptions_pc"); }
+ after(): executions_pc() { a("after.executions_pc"); }
+
+ around() returns void: calls_pc () { a("around.calls_pc"); proceed(); }
+ around() returns void: receptions_pc() { a("around.receptions_pc"); proceed(); }
+ around() returns void: executions_pc() { a("around.executions_pc"); proceed(); }
+
+ void a(Object msg) {
+ Tester.event(msg);
+ }
+}