aboutsummaryrefslogtreecommitdiffstats
path: root/tests/base/test104
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 18:51:06 +0000
committerwisberg <wisberg>2002-12-16 18:51:06 +0000
commit144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch)
treeb12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/base/test104
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/base/test104')
-rw-r--r--tests/base/test104/Driver.java88
-rw-r--r--tests/base/test104/Readme.txt5
2 files changed, 93 insertions, 0 deletions
diff --git a/tests/base/test104/Driver.java b/tests/base/test104/Driver.java
new file mode 100644
index 000000000..5cc2f9079
--- /dev/null
+++ b/tests/base/test104/Driver.java
@@ -0,0 +1,88 @@
+import org.aspectj.testing.Tester;
+
+public aspect Driver {
+
+ static boolean point, line, circle;
+
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+ Point p = new Point();
+ Line l = new Line();
+ Circle c = new Circle();
+
+ Tester.check(point, "point");
+ Tester.check(line, "line");
+ Tester.check(circle, "circle");
+ }
+
+ before (): target(Point) && execution(new(..)) {
+ point = true;
+ }
+
+ before (): target(Line) && execution(new(..)) {
+ line = true;
+ }
+
+ // the * thrown in just for fun
+ before (): target(*) && target(Circle) && execution(new()) {
+ circle = true;
+ }
+}
+
+class Point {
+ int _x = 0;
+ int _y = 0;
+
+ Point() {}
+
+ void set (int x, int y) {
+ _x = x; _y = y;
+ }
+
+ void setX (int x) { _x = x; }
+ void setY (int y) { _y = y; }
+
+ int getX() { return _x; }
+ int getY() { return _y; }
+}
+
+class Line {
+ int _x1, _y1, _x2, _y2;
+
+ Line() {}
+
+ void set (int x1, int y1, int x2, int y2) {
+ _x1 = x1; _y1 = y1; _x2 = x2; _y2 = y2;
+ }
+
+ void setX1 (int x1) { _x1 = x1; }
+ void setY1 (int y1) { _y1 = y1; }
+ void setX2 (int x2) { _x2 = x2; }
+ void setY2 (int y2) { _y2 = y2; }
+
+ int getX1() { return _x1; }
+ int getY1() { return _y1; }
+ int getX2() { return _x2; }
+ int getY2() { return _y2; }
+}
+
+class Circle {
+ int _x = 0;
+ int _y = 0;
+ int _r = 0;
+
+ Circle() {}
+
+ void set (int x, int y, int r) {
+ _x = x; _y = y; _r = r;
+ }
+
+ void setX (int x) { _x = x; }
+ void setY (int y) { _y = y; }
+ void setR (int r) { _r = r; }
+
+ int getX() { return _x; }
+ int getY() { return _y; }
+ int getR() { return _r; }
+}
diff --git a/tests/base/test104/Readme.txt b/tests/base/test104/Readme.txt
new file mode 100644
index 000000000..411a8a957
--- /dev/null
+++ b/tests/base/test104/Readme.txt
@@ -0,0 +1,5 @@
+Mode: vm run
+Title: before constructors
+
+A simple test of before methods on constructors. In this test, all
+the classes and aspects are in the same file.