您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

CflowInitInAspectVariantsAfter.java 982B

123456789101112131415161718192021222324252627282930313233343536
  1. import org.aspectj.testing.Tester;
  2. public class CflowInitInAspectVariantsAfter {
  3. public static void main(String[] args) {
  4. new C().a();
  5. Tester.checkAllEventsIgnoreDups();
  6. }
  7. static {
  8. Tester.expectEvent("cflow after pc()");
  9. Tester.expectEvent("cflow after execution(void C.a())");
  10. Tester.expectEvent("cflowbelow after pc()");
  11. Tester.expectEvent("cflowbelow after execution(void C.a())");
  12. }
  13. }
  14. class C {
  15. void a() {b();}
  16. private void b() {int i = 1;} // avoid later optimizations
  17. }
  18. aspect A {
  19. pointcut safety() : !within(A);
  20. pointcut pc() : execution(void C.a());
  21. after() : safety() && cflow(pc()) {
  22. Tester.event("cflow after pc()");
  23. }
  24. after() : safety() && cflow(execution(void C.a())) {
  25. Tester.event("cflow after execution(void C.a())");
  26. }
  27. after() : safety() && cflowbelow(pc()) {
  28. Tester.event("cflowbelow after pc()");
  29. }
  30. after() : safety() && cflowbelow(execution(void C.a())) {
  31. Tester.event("cflowbelow after execution(void C.a())");
  32. }
  33. }