aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs/doYouHaveVisiblePrivates
diff options
context:
space:
mode:
authoraclement <aclement>2004-08-13 15:15:00 +0000
committeraclement <aclement>2004-08-13 15:15:00 +0000
commitfcdafdbddb66f4ce4046016132addd763353881c (patch)
tree20c65fbb9514cc5f3a0d002cfc9e9e23f7969f73 /tests/bugs/doYouHaveVisiblePrivates
parent2dfc73855a1d7ab7652476729e6575f9116e12b8 (diff)
downloadaspectj-fcdafdbddb66f4ce4046016132addd763353881c.tar.gz
aspectj-fcdafdbddb66f4ce4046016132addd763353881c.zip
Fix and tests for Bugzilla Bug 71372
NoSuchMethodError calling private method from around advice in inner aspect
Diffstat (limited to 'tests/bugs/doYouHaveVisiblePrivates')
-rw-r--r--tests/bugs/doYouHaveVisiblePrivates/PrivateCall.java30
-rw-r--r--tests/bugs/doYouHaveVisiblePrivates/PrivateCall2.java24
-rw-r--r--tests/bugs/doYouHaveVisiblePrivates/PrivateCall3.java11
-rw-r--r--tests/bugs/doYouHaveVisiblePrivates/PrivateCallInstance.java27
-rw-r--r--tests/bugs/doYouHaveVisiblePrivates/PrivateCall_Instance_Package1.java25
-rw-r--r--tests/bugs/doYouHaveVisiblePrivates/PrivateCall_Instance_Package2.java11
6 files changed, 128 insertions, 0 deletions
diff --git a/tests/bugs/doYouHaveVisiblePrivates/PrivateCall.java b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall.java
new file mode 100644
index 000000000..f1a847d68
--- /dev/null
+++ b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall.java
@@ -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
index 000000000..348c8cd0c
--- /dev/null
+++ b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall2.java
@@ -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
index 000000000..e5da04bf0
--- /dev/null
+++ b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall3.java
@@ -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
index 000000000..96952e1db
--- /dev/null
+++ b/tests/bugs/doYouHaveVisiblePrivates/PrivateCallInstance.java
@@ -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
index 000000000..9fd1d6ac7
--- /dev/null
+++ b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall_Instance_Package1.java
@@ -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
index 000000000..38e20fc98
--- /dev/null
+++ b/tests/bugs/doYouHaveVisiblePrivates/PrivateCall_Instance_Package2.java
@@ -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