aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs150/PR94086.aj
blob: 6991c734e31131041c6ee5c94bbf1b8920336493 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
public aspect PR94086 {
    private static final SimpleLogger sl
        = new SimpleLogger();

    pointcut PC() :
        (execution(* Test.a(..)) && if (sl.isEnabled()))
        || (execution(* Test.b(..)) && if (sl.isEnabled()))
        || (execution(* Test.c(..)) && if (sl.isEnabled()))
        || (execution(* Test.d(..)) && if (sl.isEnabled()))
        || (execution(* Test.e(..)) && if (sl.isEnabled()))
        || (execution(* Test.f(..)) && if (sl.isEnabled()))
        || (execution(* Test.g(..)) && if (sl.isEnabled()))
        || (execution(* Test.h(..)) && if (sl.isEnabled()))
        || (execution(* Test.i(..)) && if (sl.isEnabled()))
        || (execution(* Test.j(..)) && if (sl.isEnabled()))
        ;

    before() : PC() {
        sl.log("Before");
    }

    after() : PC() {
        sl.log("After");
    }
}

class Test {
        public void a() {}
        public void b() {}
        public void c() {}
        public void d() {}
        public void e() {}
        public void f() {}
        public void g() {}
        public void h() {}
        public void i() {}
        public void j() {}
        public void k() {}
        public void l() {}
        public void m() {}
        public void n() {}
        public void o() {}
        public void p() {}
}


class SimpleLogger {
    private boolean enabled;

    public SimpleLogger() {
        enabled = false;
    }

    public void disable() {
        enabled = false;
    }

    public void enable() {
        enabled = true;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void log(String str) {
        if (enabled) {
            System.out.println("> Log: " + str);
        }

    }

}