aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs153/pr121805/Complex.java
blob: aa6d025c11331da1c1a85307e96cac8771c7c439 (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
class CommonEntity {

  public void add(CommonEntity ce) {}
  public void remove(CommonEntity ce) {}

}

class ManageEntity {

  ManageEntity(CommonEntity ce) {
  }
}


abstract aspect Y {
  abstract pointcut entityAccessor(CommonEntity entity);
  before(CommonEntity entity): entityAccessor(entity) {}
}


aspect X extends Y {

    public pointcut entityAccessor1(CommonEntity entity)
        : (execution(* CommonEntity+.add*(CommonEntity+))
           || (execution(* CommonEntity+.remove*(CommonEntity+))))
          && within(CommonEntity+)
          && args(entity) && if(entity != null);

    public pointcut entityAccessor2(CommonEntity entity)
        : execution(ManageEntity.new(CommonEntity+, ..)) 
          && within(ManageEntity)
          && args(entity, ..) 
          && if(entity != null);

    public pointcut entityAccessor(CommonEntity entity)
        : entityAccessor1(entity) || entityAccessor2(entity);


}