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.

PrivateCall_Instance_Package1.java 929B

12345678910111213141516171819202122232425
  1. package abc;
  2. import def.*;
  3. // This time, the around advice calls the private static method foo but the around advice
  4. // will be inlined into a type in a different package (PrivateCall3). This should work
  5. // as the around advice will call back to the aspect which will call on to foo().
  6. public class PrivateCall_Instance_Package1 {
  7. public void test () {foo("test");}
  8. private void foo (String from) {
  9. System.err.print(":"+from);
  10. }
  11. public static void main(String[] args) {
  12. new PrivateCall_Instance_Package1().test();
  13. }
  14. private static aspect Aspect {
  15. pointcut execTest (PrivateCall_Instance_Package2 o) : execution(* PrivateCall_Instance_Package2.test()) && target(o);
  16. before (PrivateCall_Instance_Package2 o) : execTest (o) { new PrivateCall_Instance_Package1().foo("before"); }
  17. void around (PrivateCall_Instance_Package2 o) : execTest (o) { new PrivateCall_Instance_Package1().foo("around"); }
  18. }
  19. }