summaryrefslogtreecommitdiffstats
path: root/tests/new/NonexistentInitializers.java
blob: 2ba43c7840af1fae6b646208e004637999a71772 (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
// join points in static/dynamic initializers aren't showing up.
import org.aspectj.testing.Tester;

public class NonexistentInitializers {


    public static void main(String[] args) {
	new NonexistentInitializers();
	org.aspectj.testing.Tester.checkEqual
            (A.i, 4, "Not finding some join points in initializers");
        org.aspectj.testing.Tester.checkEqual(A.foo, 2, "foo");
        org.aspectj.testing.Tester.checkEqual(A.get, 2, "get");
    }

    static void foo() {}
    static void bar(Object o) {}
    {
	bar(System.in);
	NonexistentInitializers.foo();
    }
    static {
	bar(System.in);
	NonexistentInitializers.foo();
    }
    

}

aspect A {
    static int i = 0;
    static int foo = 0;
    static int get = 0;

    before(): call(void NonexistentInitializers.foo())  {
	i++;
        foo++;
    }
    before(): get(* System.in)  {
	i++;
        get++;
    }
}