summaryrefslogtreecommitdiffstats
path: root/tests/bugs152/pr135865/Aoriginal.java
blob: 0d79d584fcb07d65755921c6fa2dbfc3cae4dc6d (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
import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME) @interface Ann {}


aspect Aspect {

  // Call to an annotated method
  pointcut annotated(Ann b) : call(@Ann * *(..)) && @annotation(b);

  // Top level call to an annotated method
  pointcut annotatedTop(Ann b) : annotated(b) && !cflowbelow(annotated(Ann));

  // Non top level call
  pointcut annotatedNotTop(Ann b, Ann bTopo) : 
    annotated(b) && cflowbelow(annotatedTop(bTopo));

  //before(Ann b, Ann bTopo) : annotatedNotTop(b, bTopo) {
  before() : call(@Ann * *(..)) { //(b, bTopo) {
    System.out.println("\tJoin point: " + thisJoinPointStaticPart);
  }

  // Methods with out the Ann annotation but in an Ann annotated type get Ann
  declare @method: !@Ann * (@Ann *).*(..) : @Ann;
}

public class A {
   void foo() { new B().foo(); /*new B().goo();*/}
  public static void main(String[] args) { new A().foo(); }
}