aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/RemovingFinals.java
blob: 5a1e14b37bee327ab36eca7db6a01a7fdacb5daa (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
import org.aspectj.testing.Tester;
import java.lang.reflect.*;
public class RemovingFinals {
    public static void main(String[] args) {
        new RemovingFinals().realMain(args);
    }
    public void realMain(String[] args) {
        try {
            Tester.check((C.class.getField("public_i").getModifiers()
                          & Modifier.FINAL) != 0, "public_i is not final");
        } catch (Throwable t) {
            Tester.throwable(t);
        }
    }
}

class C {
    public final int public_i = 1;
    static int x = 2;

    private final int CONST = 0;
    public void m() {
        switch(x) {
        case (CONST): System.out.println("no");
        }
    }
}

// make things a little difficult
aspect A {
    before(): staticinitialization(C) { new StringBuffer().append(thisJoinPoint); }
    before(): execution(C.new(..)) { new StringBuffer().append(thisJoinPoint); }
}