aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs152/pr138219/PerThisWithReference.aj
blob: e7c448fa0af27a56c21433c1d015361e97cd8ae0 (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
public aspect PerThisWithReference perthis(mypc()) {

  private static int id = 0;
  
  public PerThisWithReference() {
    id++;
  }
  
  public String toString() {
    return "PerThisWithReference:" + id;
  }

  public static void main(String[] args) {
    new C().foo();
    new C().foo();
  }

  pointcut mypc() : SomeOtherType.pc() && within(C);

  before() : mypc() {
    System.out.println("before " + this);
  }

}

class C {

 public void foo() {}

}