summaryrefslogtreecommitdiffstats
path: root/tests/new/unqualifiedPointcutName/Driver.java
blob: 1989cbcdb2a625acd341f0cf0d0dbde4d87007e1 (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
import org.aspectj.testing.Tester;

import java.util.*;

// PR#304 lookup rules for unqualified pointcut names


public class Driver {

    public static String s = "";
    
    public static void main(String[] args){
        new MyObject().go();
        Tester.checkEqual(s, "-before-new", "");
    }
   
}

aspect MyPointCuts {
    pointcut excludes():
        (call(* equals(..)))    ||
        (call(* toString(..)))  ||
        (call(* hashCode(..)))  ||
        (call(* clone(..)))
        ;  
    pointcut allCalls(): call(* *(..)) && !excludes();
}

aspect MyAspect /*of eachobject(instanceof(MyObject))*/ {
    before(): MyPointCuts.allCalls() && target(MyObject) {
        Driver.s += "-before";
    }   
}

class MyObject {
    public void go() {
        Driver.s += "-new";
    }
}