From 144143c2970a1e874d74cdbd0f8c622d4282a3c3 Mon Sep 17 00:00:00 2001 From: wisberg Date: Mon, 16 Dec 2002 18:51:06 +0000 Subject: initial version --- tests/base/test119/Driver.java | 34 ++++++++++++++++++++++++++++++++++ tests/base/test119/Readme.txt | 12 ++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/base/test119/Driver.java create mode 100644 tests/base/test119/Readme.txt (limited to 'tests/base/test119') 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. + -- cgit v1.2.3