summaryrefslogtreecommitdiffstats
path: root/tests/base/test111
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/test111
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/base/test111')
-rw-r--r--tests/base/test111/Driver.java11
-rw-r--r--tests/base/test111/Readme.txt6
-rw-r--r--tests/base/test111/SubClass.java5
-rw-r--r--tests/base/test111/SuperAspect.java12
-rw-r--r--tests/base/test111/SuperClass.java8
5 files changed, 42 insertions, 0 deletions
diff --git a/tests/base/test111/Driver.java b/tests/base/test111/Driver.java
new file mode 100644
index 000000000..00ec6c33c
--- /dev/null
+++ b/tests/base/test111/Driver.java
@@ -0,0 +1,11 @@
+import org.aspectj.testing.Tester;
+
+public class Driver {
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+ SubClass sub = new SubClass(3);
+ //System.out.println("Invoking SubClass's getX method");
+ Tester.checkEqual(sub.getX(), 3+42, "x value");
+ }
+}
diff --git a/tests/base/test111/Readme.txt b/tests/base/test111/Readme.txt
new file mode 100644
index 000000000..3995ae7bf
--- /dev/null
+++ b/tests/base/test111/Readme.txt
@@ -0,0 +1,6 @@
+Mode: VM Run
+Title: Inheritance of methods advised by aspects
+
+A subclass SubClass inherits a super-class SuperClass's method getX
+which is affected by the aspect SuperAspect.
+
diff --git a/tests/base/test111/SubClass.java b/tests/base/test111/SubClass.java
new file mode 100644
index 000000000..2aadb8d3f
--- /dev/null
+++ b/tests/base/test111/SubClass.java
@@ -0,0 +1,5 @@
+public class SubClass extends SuperClass {
+ public SubClass(int _x) {
+ super(_x);
+ }
+}
diff --git a/tests/base/test111/SuperAspect.java b/tests/base/test111/SuperAspect.java
new file mode 100644
index 000000000..df97973b8
--- /dev/null
+++ b/tests/base/test111/SuperAspect.java
@@ -0,0 +1,12 @@
+import org.aspectj.testing.Tester;
+
+public aspect SuperAspect {
+ before(SuperClass s): target(s) && call(* getX(..)) {
+ Tester.checkEqual(thisJoinPoint.getSignature().getName(), "getX", "method name");
+ //!!! It's unclear what they value of this really should be
+ //Tester.checkEqual(thisJoinPoint.className, "SubClass", "class name");
+ // make a change to prove this is run
+ //x = x+42;
+ s.setX( s.checkX()+42 );
+ }
+}
diff --git a/tests/base/test111/SuperClass.java b/tests/base/test111/SuperClass.java
new file mode 100644
index 000000000..3e57e0473
--- /dev/null
+++ b/tests/base/test111/SuperClass.java
@@ -0,0 +1,8 @@
+public class SuperClass {
+ int x;
+
+ public SuperClass(int _x) { x = _x; }
+ public int getX() { return x; }
+ public int checkX() { return x; }
+ public void setX( int newX ) { x = newX; }
+}