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

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import org.aspectj.testing.*;
  2. public class PR415 {
  3. public static void main(String[] args) {
  4. ASTObject ast = new ASTObject();
  5. ast.f1();
  6. ast.f2();
  7. ast.f3();
  8. ast.g1();
  9. ast.g2();
  10. ast.g3();
  11. Tester.checkAllEvents();
  12. }
  13. static {
  14. Tester.expectEventsInString("V(V),V(S),V(SS),f1,f2,f3");
  15. Tester.expectEventsInString("I(V),I(S),I(SS),g1,g2,g3");
  16. Tester.expectEventsInString("Vc,VcS,VcSS,Ic,IcS,IcSS");
  17. }
  18. }
  19. aspect Loses {
  20. void around(ASTObject ast):
  21. call(void ASTObject.voidMethod()) && target(ast) {
  22. Tester.event("Vc");
  23. proceed(ast);
  24. }
  25. void around(ASTObject ast, String msg):
  26. call(void ASTObject.voidMethod(String)) && target(ast) && args(msg) {
  27. Tester.event("VcS");
  28. proceed(ast,msg);
  29. }
  30. void around(ASTObject ast, String msg1, String msg2):
  31. call(void ASTObject.voidMethod(String, String)) && target(ast) && args(msg1, msg2) {
  32. Tester.event("VcSS");
  33. proceed(ast,msg1,msg2);
  34. }
  35. int around(ASTObject ast):
  36. call(int ASTObject.intMethod()) && target(ast) {
  37. Tester.event("Ic");
  38. return proceed(ast);
  39. }
  40. int around(ASTObject ast, String msg):
  41. call(int ASTObject.intMethod(String)) && target(ast) && args(msg) {
  42. Tester.event("IcS");
  43. return proceed(ast,msg);
  44. }
  45. int around(ASTObject ast, String msg1, String msg2):
  46. call(int ASTObject.intMethod(String, String)) && target(ast) && args(msg1, msg2) {
  47. Tester.event("IcSS");
  48. return proceed(ast,msg1,msg2);
  49. }
  50. }
  51. class ASTObject {
  52. void voidMethod() { Tester.event("V(V)"); }
  53. void voidMethod(String msg) { Tester.event("V(S)"); }
  54. void voidMethod(String msg1, String msg2) { Tester.event("V(SS)"); }
  55. void f1() { voidMethod(); Tester.event("f1"); }
  56. void f2() { voidMethod(null); Tester.event("f2"); }
  57. void f3() { voidMethod(null, null); Tester.event("f3"); }
  58. int intMethod() { Tester.event("I(V)"); return -1; }
  59. int intMethod(String msg) { Tester.event("I(S)"); return -1; }
  60. int intMethod(String msg1, String msg2) { Tester.event("I(SS)"); return -1; }
  61. void g1() { intMethod(); Tester.event("g1"); }
  62. void g2() { intMethod(null); Tester.event("g2"); }
  63. void g3() { intMethod(null, null); Tester.event("g3"); }
  64. }