aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/ArrayCasts.java
blob: b92dd5dbf95e25b28bbb16867552fc9f25957c94 (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;

public class ArrayCasts {
    public static void main(String[] args) {
        new ArrayCasts().realMain(args);
    }

    int[]     ints   = new int[1];
    int[][]   intss  = new int[2][];
    int[][][] intsss = new int[3][][];

    Integer[]     integers   = new Integer[4];
    Integer[][]   integerss  = new Integer[5][];
    Integer[][][] integersss = new Integer[6][][];
    
    public void realMain(String[] args) {

        ints   = (int[])    new ArrayCasts().ints.clone();
        intss  = (int[][])  new ArrayCasts().intss.clone();
        intsss = (int[][][])new ArrayCasts().intsss.clone();

        integers   = (Integer[])    new ArrayCasts().integers.clone();
        integerss  = (Integer[][])  new ArrayCasts().integerss.clone();
        integersss = (Integer[][][])new ArrayCasts().integersss.clone();

        Tester.checkEqual(ints.length,   1);
        Tester.checkEqual(intss.length,  2);
        Tester.checkEqual(intsss.length, 3);

        Tester.checkEqual(integers.length,   4);
        Tester.checkEqual(integerss.length,  5);
        Tester.checkEqual(integersss.length, 6);
    }
}

aspect A {
    //pointcut callstoSets(): callsto(receptions(void set*(..)) && instanceof(ArrayCasts));
    pointcut callstoSets(): call(void set*(..)) && target(ArrayCasts);
    before()             : callstoSets() {}
}