aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/ataspectj/SimpleAfter.java
blob: fc84d3022972fca935b2bad649f5faa5bfd7a058 (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
import org.aspectj.lang.annotation.*;

public class SimpleAfter {

  public static void main(String []argv) {
    SimpleAfter instance = new SimpleAfter();
    X.s.append("1");
    instance.m();
    if (!X.s.toString().equals("12a")) 
      throw new RuntimeException("Either advice not run or ordering wrong, expected 12a: "+X.s);
  }

  public void m() {
  	X.s.append("2");
  }


    @Aspect()
    public static class X {

        public static StringBuffer s = new StringBuffer("");

        @After("execution(* SimpleAfter.m())")
        public void before() {
          s.append("a");
        }
    }

}