aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/AdviceFormalsCf.java
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 18:51:06 +0000
committerwisberg <wisberg>2002-12-16 18:51:06 +0000
commit144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch)
treeb12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/new/AdviceFormalsCf.java
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/AdviceFormalsCf.java')
-rw-r--r--tests/new/AdviceFormalsCf.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/new/AdviceFormalsCf.java b/tests/new/AdviceFormalsCf.java
new file mode 100644
index 000000000..f68540582
--- /dev/null
+++ b/tests/new/AdviceFormalsCf.java
@@ -0,0 +1,44 @@
+import org.aspectj.testing.Tester;
+
+/**
+ * PR#544 the formals passed to advice should behave just like
+ * any other method formal
+ */
+
+public class AdviceFormalsCf {
+ public static void main(String[] args) {
+ Tester.checkEqual(new C().m("bye"), "foo");
+ Tester.checkEqual(new C().mi(2.), 1);
+ }
+}
+
+class C {
+ public String m(Object p) {
+ return "foo";
+ }
+
+ public int mi(double p) {
+ return 1;
+ }
+}
+
+
+aspect A {
+ after(final Object p) returning(final Object o): call(* C.m*(*)) && args(p) {
+ p = Boolean.TRUE; //ERR: p is final
+ o = Boolean.TRUE; //ERR: o is final
+ Tester.checkEqual(p, Boolean.TRUE);
+ Tester.checkEqual(o, Boolean.TRUE);
+ }
+
+ Object around(final Object p, final Object o): call(* C.m*(*)) && args(p) && target(o) {
+ Object ret = proceed(p, o);
+ p = Boolean.TRUE; //ERR: p is final
+ o = Boolean.TRUE; //ERR: o is final
+ Tester.checkEqual(p, Boolean.TRUE);
+ Tester.checkEqual(o, Boolean.TRUE);
+ return ret;
+ }
+
+
+}