diff options
author | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2002-12-16 18:51:06 +0000 |
commit | 144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch) | |
tree | b12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/new/FieldPatterns.java | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/new/FieldPatterns.java')
-rw-r--r-- | tests/new/FieldPatterns.java | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/new/FieldPatterns.java b/tests/new/FieldPatterns.java new file mode 100644 index 000000000..e64f24c57 --- /dev/null +++ b/tests/new/FieldPatterns.java @@ -0,0 +1,50 @@ +import org.aspectj.testing.Tester; + +public class FieldPatterns { + public static void main(String[] args) { + SuperC sc = new SuperC(); + C c = new C(); + SubC subc = new SubC(); + + Tester.checkEqual(sc.name, "SuperC"); + Tester.checkEqual(sc.count, 1, "SuperC"); + + Tester.checkEqual(c.name, "C"); + Tester.checkEqual(c.count, 1, "C"); + + Tester.checkEqual(subc.name, "C"); + Tester.checkEqual(subc.count, 1, "SubC"); + + Tester.checkEqual(((SuperC)c).name, "SuperC"); + Tester.checkEqual(c.count, 2, "C as SuperC"); + + c.name = null; + } +} + + +class SuperC { + int count = 0; + String name = "SuperC"; +} + +class C extends SuperC { + String name = "C"; +} + +class SubC extends C { +} + +aspect A { + before(SuperC sc): get(String SuperC.name) && target(sc){ + sc.count++; + } + before(C c): get(String C.name) && target(c) { + c.count++; + } + + before(): set(String C.name) { + } +} + + |