aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/AroundAdviceOnMethodsCalledInAroundAdvice.java
blob: 1068d915971962e8b8ff220bf6c6c81daa087e81 (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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
import org.aspectj.testing.Tester; 

public class AroundAdviceOnMethodsCalledInAroundAdvice {
    public static void main(String[] args) {
        new AroundAdviceOnMethodsCalledInAroundAdvice().realMain(args);
    }
    public void realMain(String[] args) {
        Expect.expect();
        new C().g();
        new C().f("AroundMetaJoinpoints.realMain");
        new C("C.package.constructor");
        new C(123);
        new D().g();
        new D("D.package.constructor");
        new D(123);
        Tester.checkAllEvents();
    }
}


 
aspect A {
 
    Object around(): call(public Object f(String)) {
        jp(thisJoinPoint);
        return proceed();
    }
    
    private void jp (Object join) {}
    
    void around(): call(* jp(..)) {
        proceed();
    }
    
}

class D {
    Object o = new C().f("D.o");
    public D() { new C().f("D.public.constructor"); }
    D(String f) { new C().f(f); }
    protected D(int i) { new C().f("D.protected.constructor"); }
    private D(Integer i) { new C().f("D.private.constructor"); }
    { new C().f("D.init"); }
    static {
        new D(new Integer(123));
        new C().f("D.static");
    }
    public void g() {
        Tester.event("D.g");
        new C().f("D.g");
    }
}

class C {
    public C() { f("C.public.constructor"); }
    C(String f) { f(f); }
    protected C(int i) { f("C.protected.constructor"); }
    private C(Integer i) { f("C.private.constructor"); }
    Object o = f("C.o");
    static { new C(new Integer(123)).f("C.static"); }
    { f("C.init"); }
    public void g() {
        Tester.event("C.g");
        f("C.g");
    }
    public Object f(String f) {
        Tester.event("C.f-"+f);
        return null;
    }
}
class Expect {
    static void expect() {
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.private.constructor");
        Tester.expectEvent("C.f-C.static");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.g");
        Tester.expectEvent("C.f-C.g");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-AroundMetaJoinpoints.realMain");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.package.constructor");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.protected.constructor");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.o");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.init");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.private.constructor");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.static");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.o");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.init");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.public.constructor");
        Tester.expectEvent("D.g");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.g");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.o");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.init");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.package.constructor");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.o");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.init");
        Tester.expectEvent("C.f-C.o");
        Tester.expectEvent("C.f-C.init");
        Tester.expectEvent("C.f-C.public.constructor");
        Tester.expectEvent("C.f-D.protected.constructor");
    }
}