summaryrefslogtreecommitdiffstats
path: root/tests/new/Counting3.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/new/Counting3.java')
-rw-r--r--tests/new/Counting3.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/new/Counting3.java b/tests/new/Counting3.java
new file mode 100644
index 000000000..7c3486fea
--- /dev/null
+++ b/tests/new/Counting3.java
@@ -0,0 +1,51 @@
+import java.util.Vector;
+import org.aspectj.testing.*;
+
+public class Counting3 {
+ public static void main(String[] args) {
+ Testing.start();
+ new Counting3().f();
+ Testing.finish();
+ }
+ int j;
+ void f() {
+ j = 13;
+ int i = j;
+ }
+}
+
+class Testing {
+ static void start() {
+ // - e main - - ca f() - - ex f() - - set j --------- - get j ---------
+ Tester.expectEventsInString("e,egs,cegs,c,cgs,cegs,e,egs,cegs,s,gs,cgs,egs,cegs,g,gs,cgs,egs,cegs");
+ // Tester.expectEventsInString("g,s,gs,c,e,cgs,egs,cegs"); // old, incorrect (matching dups)
+ }
+ static void finish() {
+ Tester.checkAllEvents();
+ }
+}
+
+aspect JoinPointCounting {
+
+ pointcut g(): get(* *.*) && within(Counting3);
+ before(): g() { a("g"); }
+
+ pointcut s(): set(* *.*) && within(Counting3);
+ before(): s() { a("s"); }
+
+ pointcut gs(): g() || s();
+ before(): gs() { a("gs"); }
+
+ pointcut c(): call(* *.*(..)) && within(Counting3) && ! call(* Testing.*());
+ before(): c() { a("c"); }
+ pointcut e(): execution(* *.*(..)) && within(Counting3);
+ before(): e() { a("e"); }
+
+ pointcut cgs(): c() || gs(); before(): cgs() { a("cgs"); }
+ pointcut egs(): e() || gs(); before(): egs() { a("egs"); }
+
+ pointcut cegs(): c() || e() || gs(); before(): cegs() { a("cegs"); }
+
+ static void a(String s) { Tester.event(s); }
+
+}