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.

VoidAround.java 851B

1234567891011121314151617181920212223242526272829303132
  1. import org.aspectj.testing.Tester;
  2. import java.util.*;
  3. /** @testcase PR#836 void around advice without proceed */
  4. public class VoidAround {
  5. public static void main(String[] args) {
  6. C c = new C();
  7. c.run();
  8. Object o = c.result();
  9. Tester.check(o == C.EXPECTED, "o: " + o);
  10. Tester.checkAllEvents();
  11. }
  12. }
  13. class C {
  14. static Object EXPECTED = new Object();
  15. public void run() { }
  16. public Object result() { return EXPECTED; }
  17. }
  18. aspect A {
  19. static {
  20. Tester.expectEvent("void C.run()");
  21. Tester.expectEvent("Object C.result()");
  22. }
  23. // no compile error expected (also note: message jp signatures are wrong?)
  24. void around() : target(C) && call(* r*(..)) { // CE can't apply to methods returning Object
  25. Tester.event(thisJoinPoint.getSignature().toString());
  26. }
  27. }