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.

Pr103157.aj 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. public aspect Pr103157 {
  2. // verify after returning behaviour with join points that have no "return" value
  3. // these are:
  4. // ConstructorExecution
  5. // FieldSet
  6. // StaticInitialization
  7. // Initialization
  8. // PreInitialization
  9. // ExceptionHandler -- but handler can't have after returning advice anyway
  10. // arguably all adviceexecution join points except for around, but allow this for now
  11. after() returning(Object obj) : execution(C.new(..)) {
  12. System.out.println("returning obj on cons exe " + obj);
  13. }
  14. after() returning : execution(C.new(..)) {
  15. System.out.println("returning from cons exe");
  16. }
  17. after() returning(Object obj) : set(* C.*) {
  18. System.out.println("returning obj on set " + obj);
  19. }
  20. after() returning : set(* C.*) {
  21. System.out.println("returning from set");
  22. }
  23. after() returning(Object obj) : staticinitialization(C) {
  24. System.out.println("returning obj on staticinit " + obj);
  25. }
  26. after() returning : staticinitialization(C) {
  27. System.out.println("returning from staticinit");
  28. }
  29. after() returning(Object obj) : initialization(C.new(..)) {
  30. System.out.println("returning obj on init " + obj);
  31. }
  32. after() returning : initialization(C.new(..)) {
  33. System.out.println("returning from init");
  34. }
  35. after() returning(Object obj) : preinitialization(C.new(..)) {
  36. System.out.println("returning obj on preinit " + obj);
  37. }
  38. after() returning : preinitialization(C.new(..)) {
  39. System.out.println("returning from preinit");
  40. }
  41. public static void main(String[] args) {
  42. new C();
  43. }
  44. }
  45. class C {
  46. String s;
  47. public C() { this.s = "xxx"; }
  48. }