summaryrefslogtreecommitdiffstats
path: root/tests/debugger/TestClass.java
blob: 712244e6caac6906d96f18de7b6ac5b21de43906 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
//package debugger;

public class TestClass {
  public static void main(String[] args) {
    new TestClass().go();
  }

  void go() {
    String s = "s";
    String ss = "ss";
    String sss = "sss";
    a();
  }
  
  void a() {
    int i3 = 3;    
    b();
  }

  void b() {
    int i1 = 1;
    int i2 = 2;
    c();
  }

  void c() {
    String c = "c";
    System.out.println(c);
  }
  
}

aspect TestClassAspect of eachobject(instanceof(TestClass)) {
  pointcut a(): receptions(* a(..)) && instanceof(TestClass);
  pointcut b(): receptions(* b(..)) && instanceof(TestClass);
  pointcut c(): receptions(* c(..)) && instanceof(TestClass);
  before(): a() {
    System.out.println("before a");
  }
  before(): b() {
    System.out.println("before b");
  }
  before(): c() {
    System.out.println("before c");
  }
  after(): a() {
    long l = 123;
    System.out.println("after a");
  }
  after(): b() {
    System.out.println("after b");
  }
  after(): c() {
    System.out.println("after c");
  }  
}