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.

ObjectForInt.java 631B

12345678910111213141516171819202122232425262728293031323334
  1. import org.aspectj.testing.Tester;
  2. public class ObjectForInt {
  3. public static void main(String[] args){
  4. new Test().go();
  5. Tester.checkEqual(Test.a, 10, "Test.a");
  6. Tester.checkEqual(A.beforeA.intValue(), 4, "beforeA");
  7. }
  8. }
  9. class Test {
  10. public static int a = -1;
  11. void go(){
  12. foo(4);
  13. }
  14. void foo(int a){
  15. Test.a = a;
  16. }
  17. }
  18. aspect A {
  19. public static Integer beforeA = null;
  20. pointcut fooCut(Object i):
  21. target(Test) && args(i) && call(void f*(*));
  22. before(Object o): fooCut(o){
  23. beforeA = (Integer)o;
  24. }
  25. void around(Object o): fooCut(o){
  26. proceed(new Integer(10));
  27. }
  28. }