summaryrefslogtreecommitdiffstats
path: root/tests/new/NotCharInPointcut.java
blob: c44b56fd874565d5c78189636a56b491a28bf48e (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
// PR#208 ! modifier in pointcut

public class NotCharInPointcut {
    public static void main(String[] args) throws Exception {
        for (int i = 0; i < methods.length; i++) {
            org.aspectj.testing.Tester.expectEvent(methods[i]);
            C.class.getMethod(methods[i], new Class[]{}).
                invoke(new C(), new Object[]{});
        }
    }
    
    final static String[] methods = {
        "_void",
        "_boolean",
        "_byte",
        "_char",
        "_short",
        "_int",
        "_long",
        "_float",
        "_double",
        "_Object",
    };
}

class C {
    private void s(String s) { org.aspectj.testing.Tester.event(s); }
    public void _void() { s("_void"); }
    public boolean _boolean() { s("_boolean"); return (boolean)false;}
    public byte _byte() { s("_byte"); return (byte)0;}
    public char _char() { s("_char"); return (char)0;}
    public short _short() { s("_short"); return (short)0;}
    public int _int() { s("_int"); return (int)0;}
    public long _long() { s("_long"); return (long)0;}
    public float _float() { s("_float"); return (float)0;}
    public double _double() { s("_double"); return (double)0;}
    public Object _Object() { s("_Object"); return this; }
}

aspect A {

    pointcut pcut1(NotCharInPointcut t):
        this(t) && execution(!* _*());
    
    pointcut pcut2(NotCharInPointcut t):
        this(t) && !this(NotCharInPointcut) && execution(!* _*());

    pointcut pcut3(NotCharInPointcut t):
        pcut1(t) || pcut2(t);

    before(NotCharInPointcut t): pcut1(t) { s("1:"+thisJoinPoint); }
    before(): pcut2(*) { s("2:"+thisJoinPoint); }
    before(NotCharInPointcut t): pcut3(t) { s("3:"+thisJoinPoint); }

    private final static void s(Object s) {
        org.aspectj.testing.Tester.check(false, "should be in "+s);
    }
        
}