]> source.dussan.org Git - aspectj.git/commitdiff
Fix and tests for Bugzilla Bug 71372
authoraclement <aclement>
Fri, 13 Aug 2004 15:15:00 +0000 (15:15 +0000)
committeraclement <aclement>
Fri, 13 Aug 2004 15:15:00 +0000 (15:15 +0000)
   NoSuchMethodError calling private method from around advice in inner aspect

tests/bugs/doYouHaveVisiblePrivates/PrivateCall.java [new file with mode: 0644]
tests/bugs/doYouHaveVisiblePrivates/PrivateCall2.java [new file with mode: 0644]
tests/bugs/doYouHaveVisiblePrivates/PrivateCall3.java [new file with mode: 0644]
tests/bugs/doYouHaveVisiblePrivates/PrivateCallInstance.java [new file with mode: 0644]
tests/bugs/doYouHaveVisiblePrivates/PrivateCall_Instance_Package1.java [new file with mode: 0644]
tests/bugs/doYouHaveVisiblePrivates/PrivateCall_Instance_Package2.java [new file with mode: 0644]

diff --git a/tests/bugs/doYouHaveVisiblePrivates/PrivateCall.java b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall.java
new file mode 100644 (file)
index 0000000..f1a847d
--- /dev/null
@@ -0,0 +1,30 @@
+
+// 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
diff --git a/tests/bugs/doYouHaveVisiblePrivates/PrivateCall2.java b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall2.java
new file mode 100644 (file)
index 0000000..348c8cd
--- /dev/null
@@ -0,0 +1,24 @@
+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
diff --git a/tests/bugs/doYouHaveVisiblePrivates/PrivateCall3.java b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall3.java
new file mode 100644 (file)
index 0000000..e5da04b
--- /dev/null
@@ -0,0 +1,11 @@
+package def;
+
+public class PrivateCall3 {
+       public void test() {
+               
+       }
+       
+       public static void main(String []argv) {
+               new PrivateCall3().test();
+       }
+}
\ No newline at end of file
diff --git a/tests/bugs/doYouHaveVisiblePrivates/PrivateCallInstance.java b/tests/bugs/doYouHaveVisiblePrivates/PrivateCallInstance.java
new file mode 100644 (file)
index 0000000..96952e1
--- /dev/null
@@ -0,0 +1,27 @@
+// 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
diff --git a/tests/bugs/doYouHaveVisiblePrivates/PrivateCall_Instance_Package1.java b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall_Instance_Package1.java
new file mode 100644 (file)
index 0000000..9fd1d6a
--- /dev/null
@@ -0,0 +1,25 @@
+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
diff --git a/tests/bugs/doYouHaveVisiblePrivates/PrivateCall_Instance_Package2.java b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall_Instance_Package2.java
new file mode 100644 (file)
index 0000000..38e20fc
--- /dev/null
@@ -0,0 +1,11 @@
+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