aboutsummaryrefslogtreecommitdiffstats
path: root/tests/base/test137
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/test137
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/base/test137')
-rw-r--r--tests/base/test137/Driver.java87
1 files changed, 87 insertions, 0 deletions
diff --git a/tests/base/test137/Driver.java b/tests/base/test137/Driver.java
new file mode 100644
index 000000000..1358e2ac6
--- /dev/null
+++ b/tests/base/test137/Driver.java
@@ -0,0 +1,87 @@
+// operations on private && protected aspect members (++, -- in partciular)
+
+import org.aspectj.testing.Tester;
+
+public class Driver {
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+ Foo foo = new Foo();
+
+ foo.foo();
+
+ Tester.checkEqual(Aspect.getPrivateAspectVar(), 23);
+ Tester.checkEqual(Aspect.aspectOf().getPrivateAspectInstanceVar(), 23);
+ }
+}
+
+class Foo {
+ public void foo() {
+ }
+}
+
+//XXX need to put some of eachobject back into this some day
+
+aspect Aspect {
+ private static final int PRIVATEASPECTCONST = 10;
+ private static int privateAspectVar = 20;
+
+ protected static int protectedAspectVar = 40;
+
+ public static int getPrivateAspectVar() {
+ return privateAspectVar;
+ }
+
+ private int privateAspectInstanceVar = 30;
+ protected int protectedAspectInstanceVar = 50;
+
+ public int getPrivateAspectInstanceVar() {
+ return privateAspectInstanceVar;
+ }
+
+
+
+ pointcut onFoo(): target(Foo) && call(void foo());
+
+ before(): onFoo() {
+ privateAspectVar = 21;
+ privateAspectVar = 1 + privateAspectVar;
+ Tester.checkEqual(privateAspectVar, 22);
+ Tester.checkEqual(privateAspectVar += 1, 23);
+ Tester.checkEqual(privateAspectVar++, 23);
+ Tester.checkEqual(privateAspectVar, 24);
+ Tester.checkEqual(privateAspectVar--, 24);
+ Tester.checkEqual(privateAspectVar, 23);
+ Tester.checkEqual(++privateAspectVar, 24);
+ Tester.checkEqual(privateAspectVar, 24);
+ Tester.checkEqual(--privateAspectVar, 23);
+ }
+
+ before(): onFoo() {
+ privateAspectVar = 21;
+ privateAspectVar = 1 + privateAspectVar;
+ Tester.checkEqual(privateAspectVar, 22);
+ Tester.checkEqual(privateAspectVar += 1, 23);
+ Tester.checkEqual(privateAspectVar++, 23);
+ Tester.checkEqual(privateAspectVar, 24);
+ Tester.checkEqual(privateAspectVar--, 24);
+ Tester.checkEqual(privateAspectVar, 23);
+ Tester.checkEqual(++privateAspectVar, 24);
+ Tester.checkEqual(privateAspectVar, 24);
+ Tester.checkEqual(--privateAspectVar, 23);
+ Tester.checkEqual(privateAspectVar, 23);
+
+ privateAspectInstanceVar = 21;
+ privateAspectInstanceVar = 1 + privateAspectInstanceVar;
+ Tester.checkEqual(privateAspectInstanceVar, 22);
+ Tester.checkEqual(privateAspectInstanceVar += 1, 23);
+ Tester.checkEqual(privateAspectInstanceVar++, 23);
+ Tester.checkEqual(privateAspectInstanceVar, 24);
+ Tester.checkEqual(privateAspectInstanceVar--, 24);
+ Tester.checkEqual(privateAspectInstanceVar, 23);
+ Tester.checkEqual(++privateAspectInstanceVar, 24);
+ Tester.checkEqual(privateAspectInstanceVar, 24);
+ Tester.checkEqual(--privateAspectInstanceVar, 23);
+ Tester.checkEqual(privateAspectInstanceVar, 23);
+ }
+}