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/base/test109 | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/base/test109')
-rw-r--r-- | tests/base/test109/Aspect.java | 28 | ||||
-rw-r--r-- | tests/base/test109/Driver.java | 9 | ||||
-rw-r--r-- | tests/base/test109/Foo.java | 56 | ||||
-rw-r--r-- | tests/base/test109/Readme.txt | 13 |
4 files changed, 106 insertions, 0 deletions
diff --git a/tests/base/test109/Aspect.java b/tests/base/test109/Aspect.java new file mode 100644 index 000000000..4e77df375 --- /dev/null +++ b/tests/base/test109/Aspect.java @@ -0,0 +1,28 @@ +aspect Aspect pertarget(target(Foo)) { + + public String toString() {return "The Aspect";} + + before (Foo f): target(f) && call(* foo(..)) { + // do some incrementing and reading of f's variables: + // f.PRIVATECONST; + // f.privateClassVar++; + // f.privateInstanceVar++; + f.protectedClassVar++; + f.protectedInstanceVar++; + f.publicClassVar++; + f.publicInstanceVar++; + f.ClassVar++; + f.InstanceVar++; + + // do some calling of f's methods + + //f.privateClassMethod(); + //f.privateInstanceMethod(); + f.protectedClassMethod(); + f.protectedInstanceMethod(); + f.publicClassMethod(); + f.publicInstanceMethod(); + f.ClassMethod(); + f.InstanceMethod(); + } +} diff --git a/tests/base/test109/Driver.java b/tests/base/test109/Driver.java new file mode 100644 index 000000000..c68725a19 --- /dev/null +++ b/tests/base/test109/Driver.java @@ -0,0 +1,9 @@ + +public class Driver { + public static void main(String[] args) { test(); } + + public static void test() { + Foo f = new Foo(); + f.foo(); + } +} diff --git a/tests/base/test109/Foo.java b/tests/base/test109/Foo.java new file mode 100644 index 000000000..8a2a3de38 --- /dev/null +++ b/tests/base/test109/Foo.java @@ -0,0 +1,56 @@ + +public class Foo { + private String _name; + private static final int PRIVATECONST = 1; + private static int privateClassVar = 2; + private int privateInstanceVar = 3; + + protected static int protectedClassVar = 4; + protected int protectedInstanceVar = 5; + + public static int publicClassVar = 6; + public int publicInstanceVar = 7; + + public static int ClassVar = 8; + public int InstanceVar = 9; + + public void foo() { + // System.out.println("running " + this + ".foo()"); + } + + private static void privateClassMethod() { + // System.out.println("in " + "Foo.privateClassMethod()"); + } + + private void privateInstanceMethod() { + // System.out.println("in " + this + ".privateInstanceMethod()"); + } + + protected static void protectedClassMethod() { + // System.out.println("in " + "Foo.protectedClassMethod()"); + } + + protected void protectedInstanceMethod() { + // System.out.println("in " + this + ".protectedInstanceMethod()"); + } + + public static void publicClassMethod() { + // System.out.println("in " + "Foo.publicClassMethod()"); + } + + public void publicInstanceMethod() { + // System.out.println("in " + this + ".publicInstanceMethod()"); + } + + static void ClassMethod() { + // System.out.println("in " + "Foo.ClassMethod()"); + } + + void InstanceMethod() { + // System.out.println("in " + this + ".InstanceMethod()"); + } + + +} + + diff --git a/tests/base/test109/Readme.txt b/tests/base/test109/Readme.txt new file mode 100644 index 000000000..a524b5485 --- /dev/null +++ b/tests/base/test109/Readme.txt @@ -0,0 +1,13 @@ +Mode: VM run +Title: Accessibility of class and aspect members from inside weaves + + Code inside a weave does the full cross-product of the + following things: + + read a var of the class private static + set a var X X protected X non-static + call a method public + default + + +Both the aspect and the class are in the default (unnamed) package. |