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.

PointcutQualification.java 880B

123456789101112131415161718192021222324252627282930313233343536
  1. import org.aspectj.testing.Tester;
  2. public class PointcutQualification {
  3. public static void main(String[] args) {
  4. Tester.expectEvent("before pc_reference");
  5. new TargetClass().doit();
  6. Tester.checkAllEvents();
  7. }
  8. }
  9. class I {
  10. public static final void got(String s) {
  11. Tester.event(s);
  12. }
  13. }
  14. class TargetClass{ void doit(){}}
  15. aspect DebugAspect { // incorrect compiler error here
  16. before() : Aspect.pc_reference() { I.got("before pc_reference");}
  17. }
  18. aspect Aspect {
  19. pointcut pc_notfound()
  20. : execution(void TargetClass.doit()) ;
  21. pointcut someCallCflow()
  22. : !within(Aspect) && !within(DebugAspect) && !within(I)
  23. //&& cflow(Aspect.pc_notfound()) ; // workaround
  24. && cflow(pc_notfound()) ; // bug: unqualified reference in DebugAspect context
  25. pointcut pc_reference() : someCallCflow();
  26. }