summaryrefslogtreecommitdiffstats
path: root/tests/base/test102
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/base/test102
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/base/test102')
-rw-r--r--tests/base/test102/Driver.java34
-rw-r--r--tests/base/test102/Readme.txt4
2 files changed, 38 insertions, 0 deletions
diff --git a/tests/base/test102/Driver.java b/tests/base/test102/Driver.java
new file mode 100644
index 000000000..6d5cf27cd
--- /dev/null
+++ b/tests/base/test102/Driver.java
@@ -0,0 +1,34 @@
+import org.aspectj.testing.Tester;
+
+public class Driver {
+ static Object objectFromClass;
+ static Object objectFromAspect;
+
+ static String stringFromClass;
+ static String stringFromAspect;
+
+ public static void main(String[] args) { test(); }
+
+ static public void test() {
+ Driver obj = new Driver();
+
+ obj.doit();
+
+ Tester.check(objectFromClass == objectFromAspect,
+ "this matches this");
+ Tester.check(stringFromClass.equals(stringFromAspect),
+ "this.toString() matches this.toString()");
+ }
+
+ void doit() {
+ objectFromClass = this;
+ stringFromClass = this.toString();
+ }
+}
+
+aspect DriverAspect pertarget(target(Driver)) {
+ before (Driver d): target(d) && call(* doit(..)) {
+ d.objectFromAspect = d;
+ d.stringFromAspect = d.toString();
+ }
+}
diff --git a/tests/base/test102/Readme.txt b/tests/base/test102/Readme.txt
new file mode 100644
index 000000000..14bcca6a9
--- /dev/null
+++ b/tests/base/test102/Readme.txt
@@ -0,0 +1,4 @@
+Mode: vm run
+Title: this redirection in non-static before methods
+
+A simple test of whether this redirection works in before methods.