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/test108/Driver.java | 40 ++++++++++++++++++++++++++++++++++++++++ tests/base/test108/Readme.txt | 6 ++++++ 2 files changed, 46 insertions(+) create mode 100644 tests/base/test108/Driver.java create mode 100644 tests/base/test108/Readme.txt (limited to 'tests/base/test108') diff --git a/tests/base/test108/Driver.java b/tests/base/test108/Driver.java new file mode 100644 index 000000000..30af86fd7 --- /dev/null +++ b/tests/base/test108/Driver.java @@ -0,0 +1,40 @@ + +import org.aspectj.testing.Tester; +/** + * This does accessibility of class and class variables, both inherited + * and non-inherited, in the body of a weave. + */ + +public class Driver { + public static void main(String[] args) { test(); } + public static void test() { + Tester.checkEqual((new Bar()).m(), 10, "Bar.m"); + } +} + +class Foo { + int fooVar = 1; + public int getFooVar( ) { return fooVar; } +} + +class Bar extends Foo { + int barVar = 2; + int ans = 0; + public int getBarVar() { return barVar; } + public void setAns( int newAns ) { ans = newAns; } + int m() { + return ans; + } +} + +abstract aspect A { + static int aVar = 3; +} + +aspect B extends A { + static int bVar = 4; + + before(Bar b): target(b) && call(* m(..)) { + b.setAns(b.getFooVar() + b.getBarVar() + aVar + bVar); + } +} diff --git a/tests/base/test108/Readme.txt b/tests/base/test108/Readme.txt new file mode 100644 index 000000000..e0665b4bf --- /dev/null +++ b/tests/base/test108/Readme.txt @@ -0,0 +1,6 @@ +Mode: vm run +Title: Inheritance of class and aspect vars in weaves. + +This checks accessibility of class and aspect variables, both inherited +and non-inherited, in the body of a weave. + -- cgit v1.2.3