aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/VoidAround.java
blob: 2883c5df02d7e8192577a6befd7e84d341f9e9bb (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
import org.aspectj.testing.Tester;
import java.util.*;

/** @testcase PR#836 void around advice without proceed */
public class VoidAround {

    public static void main(String[] args) {
        C c = new C();
        c.run();
        Object o = c.result();
        Tester.check(o == C.EXPECTED, "o: " + o);
        Tester.checkAllEvents();
    }
}

class C {
    static Object EXPECTED = new Object();
    public void run() { }
    public Object result() { return EXPECTED; }
}

aspect A {
    static {
        Tester.expectEvent("void C.run()");
        Tester.expectEvent("Object C.result()");
    }
    // no compile error expected (also note: message jp signatures are wrong?)
    void around() : target(C) && call(* r*(..)) {  // CE can't apply to methods returning Object
        Tester.event(thisJoinPoint.getSignature().toString());
    }
}