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/test119 | |
parent | fafae443719b26159ab2d7dac1c9b46b5e00b671 (diff) | |
download | aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip |
initial version
Diffstat (limited to 'tests/base/test119')
-rw-r--r-- | tests/base/test119/Driver.java | 34 | ||||
-rw-r--r-- | tests/base/test119/Readme.txt | 12 |
2 files changed, 46 insertions, 0 deletions
diff --git a/tests/base/test119/Driver.java b/tests/base/test119/Driver.java new file mode 100644 index 000000000..b2e971845 --- /dev/null +++ b/tests/base/test119/Driver.java @@ -0,0 +1,34 @@ +import org.aspectj.testing.Tester; + +public class Driver { + public static void main(String[] args) { test(); } + + public static void test() { + Foo foo = new Foo(); + foo.m(); + } +} + +aspect A { + //static advice(): Foo && (void m(..) || new(..)) { + //!!!no around advice allowed on constructors right now + void around(): target(Foo) && call(void m(..)) { + class Internal { + int val() { return 1; } + } + int i = 1; + Internal j = new Internal(); + proceed(); + Tester.checkEqual(i, 1, "i"); + Tester.checkEqual(j.val(), 1, "j.val()"); + } +} + +class Foo { + Foo() { + // System.out.println("constructor Foo()"); + } + void m() { + // System.out.println("method m()"); + } +} diff --git a/tests/base/test119/Readme.txt b/tests/base/test119/Readme.txt new file mode 100644 index 000000000..77f93fa4c --- /dev/null +++ b/tests/base/test119/Readme.txt @@ -0,0 +1,12 @@ +Mode: VM run +Title: Local declarations in advise bodies + +This tests local declarations in the body of advises. Local +declarations help the weaves inside advises to share variables between +them. These variables should be resolved in the context of the +methods being advised. + +The syntax supports local variable as well as class declrations. But +the weaver can't handle inner classes yet, so only the local variable +declaration case is tested. + |