aboutsummaryrefslogtreecommitdiffstats
path: root/tests/symbols/A.java
blob: d838835e843fa77e7afaf098738a318b4ab6b58e (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
package symbols;

strictfp aspect A issingleton() {

    /** objects */
    pointcut instanceof_C(): this(C);
    pointcut hasaspect_A(): if(A.hasAspect());

    /** lexical extents */
    pointcut within_C(): within(C);
    pointcut withinall_C(): within(C+);
    pointcut withincode_C(): withincode(void C.*(..));

    /** control flow */
    pointcut cflow_C(): cflow(withincode_C());
    pointcut cflowtop_C(): cflow(withincode_C() && !cflowbelow(withincode_C()));

    /** methods and constructors */
    pointcut calls_C(): call(int C.*(..));
    pointcut receptions_C(): call(int C.*(..));
    pointcut executions_C(): execution(* C.*(..,float,..));
    //pointcut callsto_C(): callsto(call(void C.*()));

    /** exception handlers */
    pointcut handlers_Thr(): handler(java.lang.Throwable);
    pointcut handlers_Err(): handler(java.lang.Error);
    pointcut handlers_Exc(): handler(java.lang.Exception);
    pointcut handlers_Rt(): handler(java.lang.RuntimeException);

    /** fields */
    pointcut gets_f(): get(float C.*);
    pointcut sets_f(): set(float C.*);

    /** Advices */
    //before(): call(void C.*()) { }
    before(): this(C) && call(String Object.toString()) { }
    before(): execution(C.new()) { }
    after(): call(void C.*()) { }
    after() returning (int x): call(int C.*(..)) { }
    after() throwing (RuntimeException e): call(void C.MethV()) {
        throw new RuntimeException("test");
    }
    void around() : call(void C.MethV()) { proceed(); }

    /** Introductions */
    public double symbols.C.intrD;
    private void C.intrMethV() { intrD += 1; }

}