You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RemovingFinals.java 897B

123456789101112131415161718192021222324252627282930313233
  1. import org.aspectj.testing.Tester;
  2. import java.lang.reflect.*;
  3. public class RemovingFinals {
  4. public static void main(String[] args) {
  5. new RemovingFinals().realMain(args);
  6. }
  7. public void realMain(String[] args) {
  8. try {
  9. Tester.check((C.class.getField("public_i").getModifiers()
  10. & Modifier.FINAL) != 0, "public_i is not final");
  11. } catch (Throwable t) {
  12. Tester.throwable(t);
  13. }
  14. }
  15. }
  16. class C {
  17. public final int public_i = 1;
  18. static int x = 2;
  19. private final int CONST = 0;
  20. public void m() {
  21. switch(x) {
  22. case (CONST): System.out.println("no");
  23. }
  24. }
  25. }
  26. // make things a little difficult
  27. aspect A {
  28. before(): staticinitialization(C) { new StringBuffer().append(thisJoinPoint); }
  29. before(): execution(C.new(..)) { new StringBuffer().append(thisJoinPoint); }
  30. }