aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/InvalidProceedArgsCE.java
blob: 388d31e9d07e998aeb118a68b8b3a535be0db76c (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
class Target {
    public void resize(int i) {}
}

/** @testcase invalid number and type of proceed arguments */
aspect A {
    void around(Target buffer)  
        : call(void Target.resize(..)) && target(buffer) {
        proceed(); // expect CE here 
    }
    void around(int i, Target buffer)  
        : call(void Target.resize(..)) && args(i) && target(buffer) {
        /** @testcase invalid proceed args - none, 2 expected */
        proceed();      // expect CE here
        /** @testcase invalid proceed args - 1, 2 expected */
        proceed(i);      // expect CE here
        // coercion is passing
        /** @testcase invalid proceed args - wrong type 1, 2 expected */
        proceed(buffer); // expect CE here
        /** @testcase invalid proceed args - wrong type 2, 2 expected */
        proceed(buffer, i); // expect CE here
    }
    void around(int i)  
        : call(void Target.resize(..)) && args(i) {
        /** @testcase invalid proceed args - wrong type */
        proceed(new Integer(0)); // expect CE here
        /** @testcase invalid proceed args - wrong type 2, 1 expected */
        proceed(new Integer(0), 0); // expect CE here
        /** @testcase invalid proceed args - wrong type 2, 1 expected */
        proceed(0, new Integer(0)); // expect CE here
    }

    void around(int i, Target buffer)
        : call(void Target.resize(..)) && args(i) && target(buffer) {
        /** @testcase invalid proceed args - float -> int */
        proceed(3.1, buffer);      // expect CE here
        /** @testcase invalid proceed args - String -> int */
        proceed("1", buffer);      // expect CE here
        proceed('a', buffer);      // char -> int is legal
        // coercion is passing
        /** @testcase invalid proceed args - Object -> Target */
        proceed(i, (Object)null); // expect CE here
        proceed(i, null); //null -> Target is legal
        /** @testcase invalid proceed args - wrong type 3-> Target */
        proceed(i, 3); // expect CE here
    }
}