Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

HandleTestingAspect.java 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. package p;
  2. import java.util.ArrayList;
  3. public aspect HandleTestingAspect {
  4. static class InnerClass {
  5. int x;
  6. { }
  7. static aspect InnerInnerAspect {
  8. int x;
  9. static { } // 13
  10. }
  11. public void doNothing() {}
  12. }
  13. before() : call(* *.doNothing()) {
  14. }
  15. before(int x, long y) : execution(* *.foo(int,long)) && args(x,y) {
  16. InnerClass u = new InnerClass() {
  17. public void doNothing() {
  18. doNothing();
  19. }
  20. };
  21. u.doNothing();
  22. }
  23. interface X { }
  24. public void doNothing() {}
  25. // testing ITDs
  26. int X.X = 6;
  27. // int X.itd() { return 1;}
  28. // X.new() { }
  29. // int X.itd(int x) { return 1;}
  30. // X.new(int x) { }
  31. declare parents : HandleTestingClass extends InnerClass;
  32. declare parents : HandleTestingClass implements X;
  33. declare soft : Exception : execution(void HandleTestingClass.foo1(int,long));
  34. declare error : call(void HandleTestingClass.foo1(int,long)) : "";
  35. declare warning : call(void HandleTestingClass.foo2(int,long)) : "";
  36. pointcut ypc(int y) : call(* *.yCall(int)) && args(y);
  37. pointcut zpc(int z) : call(* *.zCall(int)) && args(z);
  38. // should not have a count
  39. before(int y) : ypc(y) { }
  40. after(int y) : ypc(y) { }
  41. after(int y) throwing(Exception e) : ypc(y) { }
  42. after(int y) returning(int z) : ypc(y) { }
  43. int around(int y) : ypc(y) { return 1; }
  44. // should have a count
  45. before(int y) : zpc(y) { }
  46. after(int y) : zpc(y) { }
  47. after(int y) throwing(Exception e) : zpc(y) { }
  48. after(int y) returning(int z) : zpc(y) { }
  49. int around(int y) : ypc(y) { return 1; }
  50. // should have a count of 3
  51. Object around(int y) : ypc(y) { return null; }
  52. after() returning(java.util.List z) : call(* *.zCall(int)) { }
  53. }
  54. class HandleTestingClass {}