--- /dev/null
+
+// In this program, the around advice calls foo() and foo is a private static field in
+// class PrivateCall. When compiled the around() advice will be inlined and should call
+// foo() through an inline accessor method.
+public class PrivateCall {
+
+ public void test () {foo("test");}
+
+ private static void foo (String from) {
+ System.err.print(":"+from);
+ }
+
+ public static void main(String[] args) {
+ new PrivateCall().test();
+ }
+
+ private static aspect Aspect {
+
+ pointcut execTest () :
+ execution(* PrivateCall.test());
+
+ before () : execTest () {
+ foo("before");
+ }
+
+ void around () : execTest () {
+ foo("around");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+package abc;
+
+// This time, the around advice calls the private static method foo but the around advice
+// will be inlined into a type in a different package (PrivateCall3). This should work
+// as the around advice will call back to the aspect which will call on to foo().
+
+public class PrivateCall2 {
+
+ public void test () {foo("test");}
+
+ private static void foo (String from) {
+ System.err.print(":"+from);
+ }
+
+ public static void main(String[] args) {
+ new PrivateCall2().test();
+ }
+
+ private static aspect Aspect {
+ pointcut execTest () : execution(* test());
+ before () : execTest () { foo("before"); }
+ void around () : execTest () { foo("around"); }
+ }
+}
\ No newline at end of file
--- /dev/null
+package def;
+
+public class PrivateCall3 {
+ public void test() {
+
+ }
+
+ public static void main(String []argv) {
+ new PrivateCall3().test();
+ }
+}
\ No newline at end of file
--- /dev/null
+// Similar to PrivateCall but now foo() is a private non-static method.
+public class PrivateCallInstance {
+
+ public void test () {foo("test");}
+
+ private void foo (String from) {
+ System.err.print(":"+from);
+ }
+
+ public static void main(String[] args) {
+ new PrivateCallInstance().test();
+ }
+
+ private static aspect Aspect {
+
+ pointcut execTest (PrivateCallInstance s) :
+ execution(* PrivateCallInstance.test()) && target(s);
+
+ before (PrivateCallInstance s) : execTest (s) {
+ s.foo("before");
+ }
+
+ void around (PrivateCallInstance s) : execTest (s) {
+ s.foo("around");
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+package abc;
+import def.*;
+
+// This time, the around advice calls the private static method foo but the around advice
+// will be inlined into a type in a different package (PrivateCall3). This should work
+// as the around advice will call back to the aspect which will call on to foo().
+
+public class PrivateCall_Instance_Package1 {
+
+ public void test () {foo("test");}
+
+ private void foo (String from) {
+ System.err.print(":"+from);
+ }
+
+ public static void main(String[] args) {
+ new PrivateCall_Instance_Package1().test();
+ }
+
+ private static aspect Aspect {
+ pointcut execTest (PrivateCall_Instance_Package2 o) : execution(* PrivateCall_Instance_Package2.test()) && target(o);
+ before (PrivateCall_Instance_Package2 o) : execTest (o) { new PrivateCall_Instance_Package1().foo("before"); }
+ void around (PrivateCall_Instance_Package2 o) : execTest (o) { new PrivateCall_Instance_Package1().foo("around"); }
+ }
+}
\ No newline at end of file
--- /dev/null
+package def;
+
+public class PrivateCall_Instance_Package2 {
+ public void test() {
+
+ }
+
+ public static void main(String []argv) {
+ new PrivateCall_Instance_Package2().test();
+ }
+}
\ No newline at end of file