aboutsummaryrefslogtreecommitdiffstats
path: root/ajde/testdata/figures-coverage/figures
diff options
context:
space:
mode:
authoraclement <aclement>2007-01-15 09:37:56 +0000
committeraclement <aclement>2007-01-15 09:37:56 +0000
commitbaa2728b4aaf49ac680e0e19aab9db5b26516dbc (patch)
tree0afbfd41ea4558a99a4335012884ac1ec8263326 /ajde/testdata/figures-coverage/figures
parent0684161295e935428bb584d67197b49151219cc5 (diff)
downloadaspectj-baa2728b4aaf49ac680e0e19aab9db5b26516dbc.tar.gz
aspectj-baa2728b4aaf49ac680e0e19aab9db5b26516dbc.zip
148190#35
Diffstat (limited to 'ajde/testdata/figures-coverage/figures')
-rw-r--r--ajde/testdata/figures-coverage/figures/.cvsignore8
-rw-r--r--ajde/testdata/figures-coverage/figures/Debug.java7
-rw-r--r--ajde/testdata/figures-coverage/figures/Figure.java92
-rw-r--r--ajde/testdata/figures-coverage/figures/FigureElement.java9
-rw-r--r--ajde/testdata/figures-coverage/figures/Main.java56
-rw-r--r--ajde/testdata/figures-coverage/figures/composites/.cvsignore3
-rw-r--r--ajde/testdata/figures-coverage/figures/composites/Line.java6
-rw-r--r--ajde/testdata/figures-coverage/figures/composites/Square.java6
-rw-r--r--ajde/testdata/figures-coverage/figures/primitives/planar/.cvsignore4
-rw-r--r--ajde/testdata/figures-coverage/figures/primitives/planar/Point.java73
-rw-r--r--ajde/testdata/figures-coverage/figures/primitives/solid/.cvsignore1
-rw-r--r--ajde/testdata/figures-coverage/figures/primitives/solid/SolidPoint.java24
12 files changed, 289 insertions, 0 deletions
diff --git a/ajde/testdata/figures-coverage/figures/.cvsignore b/ajde/testdata/figures-coverage/figures/.cvsignore
new file mode 100644
index 000000000..9a2b438e3
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/.cvsignore
@@ -0,0 +1,8 @@
+Checks.class
+Debug.class
+Element.class
+Figure.class
+FigureElement.class
+Main.class
+Main$TestGUI.class
+Test.class
diff --git a/ajde/testdata/figures-coverage/figures/Debug.java b/ajde/testdata/figures-coverage/figures/Debug.java
new file mode 100644
index 000000000..01e895abc
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/Debug.java
@@ -0,0 +1,7 @@
+
+package figures;
+
+aspect Debug {
+
+}
+
diff --git a/ajde/testdata/figures-coverage/figures/Figure.java b/ajde/testdata/figures-coverage/figures/Figure.java
new file mode 100644
index 000000000..b5e0e246a
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/Figure.java
@@ -0,0 +1,92 @@
+
+package figures;
+
+import figures.primitives.planar.Point;
+
+import java.awt.Canvas;
+
+aspect Figure {
+ //pointcut sendSuccess(): cflow(setX()) && !handler(Exception);
+
+ public String Point.getName() {
+ return Point.name;
+ }
+
+ public int figures.primitives.planar.Point.DEFAULT_X = 0;
+
+ public pointcut constructions(): call(Point.new(int, int)) || call(SolidPoint.new(int, int, int));
+
+ public pointcut moves(FigureElement fe): target(fe) &&
+ (call(String Point.getName()) ||
+ call(void FigureElement.incrXY(int, int)) ||
+ call(void Point.setX(int)) ||
+ call(void Point.setY(int)) ||
+ call(void SolidPoint.setZ(int)));
+
+ pointcut mainExecution():
+ execution(int main(*));
+
+ pointcut runtimeHandlers(): mainExecution()
+ || handler(RuntimeException);
+
+ public pointcut mumble(): runtimeHandlers();
+
+ before(int newValue): set(int *.*) && args(newValue) { }
+
+ before(): get(int *.*) { }
+
+ before(): constructions() {
+ System.out.println("> before construction, jp: " + thisJoinPoint.getSignature());
+ }
+
+ before(FigureElement fe): moves(fe) {
+ System.out.println("> about to move FigureElement at X-coord: ");
+ }
+
+ after(): initialization(Point.new(..)) || staticinitialization(Point) {
+ System.out.println("> Point initialized");
+ }
+
+ // should be around
+ after(): mumble() {
+ System.err.println(">> in after advice...");
+ //proceed();
+ }
+
+ after(FigureElement fe): target(fe) &&
+ (call(void FigureElement.incrXY(int, int)) ||
+ call(void Point.setX(int)) ||
+ call(void Point.setY(int)) ||
+ call(void SolidPoint.setZ(int))) {
+ System.out.println("> yo.");
+ }
+
+ after(FigureElement fe):
+ target(fe) &&
+ (call(void FigureElement.incrXY(int, int)) ||
+ call(void Line.setP1(Point)) ||
+ call(void Line.setP2(Point)) ||
+ call(void Point.setX(int)) ||
+ call(void Point.setY(int))) { }
+
+ declare parents: Point extends java.io.Serializable;
+
+ declare parents: Point implements java.util.Observable;
+
+ // AMC - this next line doesn't make sense!! Can these tests ever
+ // have been run???
+ //declare soft: Point: call(* *(..));
+}
+
+aspect Checks {
+ pointcut illegalNewFigElt(): call(FigureElement+.new(..)) &&
+ !withincode(* Main.main(..));
+
+// pointcut illegalNewFigElt(): execution(FigureElement+.new(..));
+
+ declare error: illegalNewFigElt():
+ "Illegal figure element constructor call.";
+
+ declare warning: illegalNewFigElt():
+ "Illegal figure element constructor call.";
+}
diff --git a/ajde/testdata/figures-coverage/figures/FigureElement.java b/ajde/testdata/figures-coverage/figures/FigureElement.java
new file mode 100644
index 000000000..d2ce9eb82
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/FigureElement.java
@@ -0,0 +1,9 @@
+
+package figures;
+
+public interface FigureElement extends Element {
+
+ public void incrXY(int dx, int dy);
+}
+
+interface Element { }
diff --git a/ajde/testdata/figures-coverage/figures/Main.java b/ajde/testdata/figures-coverage/figures/Main.java
new file mode 100644
index 000000000..189f05cee
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/Main.java
@@ -0,0 +1,56 @@
+
+package figures;
+
+import figures.primitives.planar.Point;
+import figures.primitives.solid.SolidPoint;
+
+class Main {
+
+ private static Point startPoint;
+
+ public static void main(String[] args) {
+ try {
+ System.out.println("> starting...");
+
+ startPoint = makeStartPoint();
+ //startPoint.setX(3); new Point(0, 0);
+// SolidPoint sp1 = new SolidPoint(1, 3, 3);
+
+// sp1.setZ(1);
+// p1.incrXY(3, 3);
+ } catch (RuntimeException re) {
+ re.printStackTrace();
+ }
+ System.out.println("> finished.");
+ }
+
+ /** @deprecated use something else */
+ public static Point makeStartPoint() {
+ //return new Point(1, 2);
+ return null;
+ }
+
+ /** This should produce a deprecation warning with JDK > 1.2 */
+ static class TestGUI extends javax.swing.JFrame {
+ TestGUI() {
+ this.disable();
+ }
+ }
+
+ /** This should produce a porting-deprecation warning. */
+ //static pointcut mainExecution(): execution(void main(*));
+}
+
+privileged aspect Test {
+ pointcut testptct(): call(* *.*(..));
+
+ before(Point p, int newval): target(p) && set(int Point.xx) && args(newval) {
+ System.err.println("> new value of x is: " + p.x + ", setting to: " + newval);
+ }
+
+ before(int newValue): set(int Point.*) && args(newValue) {
+ if (newValue < 0) {
+ throw new IllegalArgumentException("too small");
+ }
+ }
+}
diff --git a/ajde/testdata/figures-coverage/figures/composites/.cvsignore b/ajde/testdata/figures-coverage/figures/composites/.cvsignore
new file mode 100644
index 000000000..d9011a888
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/composites/.cvsignore
@@ -0,0 +1,3 @@
+BoundedLine.class
+Line.class
+Square.class
diff --git a/ajde/testdata/figures-coverage/figures/composites/Line.java b/ajde/testdata/figures-coverage/figures/composites/Line.java
new file mode 100644
index 000000000..1f7ee5dc8
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/composites/Line.java
@@ -0,0 +1,6 @@
+
+package figures.composites;
+
+class Line { }
+
+class BoundedLine extends Line { }
diff --git a/ajde/testdata/figures-coverage/figures/composites/Square.java b/ajde/testdata/figures-coverage/figures/composites/Square.java
new file mode 100644
index 000000000..8ba3825d6
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/composites/Square.java
@@ -0,0 +1,6 @@
+
+package figures.composites;
+
+class Square {
+ private String name = "Square";
+}
diff --git a/ajde/testdata/figures-coverage/figures/primitives/planar/.cvsignore b/ajde/testdata/figures-coverage/figures/primitives/planar/.cvsignore
new file mode 100644
index 000000000..1dd78c3c0
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/primitives/planar/.cvsignore
@@ -0,0 +1,4 @@
+StrictlyBoundedPoint.class
+PointBoundsException.class
+Point.class
+BoundedPoint.class
diff --git a/ajde/testdata/figures-coverage/figures/primitives/planar/Point.java b/ajde/testdata/figures-coverage/figures/primitives/planar/Point.java
new file mode 100644
index 000000000..d389be386
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/primitives/planar/Point.java
@@ -0,0 +1,73 @@
+
+package figures.primitives.planar;
+
+import figures.*;
+import java.util.Collection;
+
+public class Point implements FigureElement {
+
+ static int xx = -1;
+ private int x;
+ private int y;
+ transient int currVal = 0;
+ public static String name;
+
+ {
+ y = -1;
+ }
+
+ static {
+ xx = -10;
+ }
+
+ int c; int b; int a;
+ {
+ x = 0;
+ y = 0;
+ }
+
+ static {
+ Point.name = "2-Dimensional Point";
+ }
+
+ public Point(int x, int y) {
+ this.x = x;
+ this.y = y;
+ }
+
+ int getCurrVal() {
+ return currVal;
+ }
+
+ /**
+ * @see Figure#moves
+ */
+ public int getX() { return x; }
+
+ public int getY() { return y; }
+
+ public void setX(int x) { this.x = x; }
+
+ public void setY(int x) { this.y = x; }
+
+ public void incrXY(int dx, int dy) {
+ setX(getX() + dx);
+ setY(getY() + dy);
+ }
+ public void check(int dx, int dy)
+ throws ArithmeticException, PointBoundsException {
+ if (dx < 0 || dy < 0) throw new PointBoundsException();
+ }
+}
+
+class PointBoundsException extends Exception { }
+
+class BoundedPoint extends Point {
+ public BoundedPoint(int x, int y) { super(x, y); }
+}
+
+class StrictlyBoundedPoint extends BoundedPoint {
+ public StrictlyBoundedPoint(int x, int y) { super(x, y); }
+}
+
+
diff --git a/ajde/testdata/figures-coverage/figures/primitives/solid/.cvsignore b/ajde/testdata/figures-coverage/figures/primitives/solid/.cvsignore
new file mode 100644
index 000000000..fd0572c5e
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/primitives/solid/.cvsignore
@@ -0,0 +1 @@
+SolidPoint.class
diff --git a/ajde/testdata/figures-coverage/figures/primitives/solid/SolidPoint.java b/ajde/testdata/figures-coverage/figures/primitives/solid/SolidPoint.java
new file mode 100644
index 000000000..80c1fc1ca
--- /dev/null
+++ b/ajde/testdata/figures-coverage/figures/primitives/solid/SolidPoint.java
@@ -0,0 +1,24 @@
+
+package figures.primitives.solid;
+
+import java.util.Collection;
+import java.lang.String;
+import figures.primitives.planar.*;
+
+public class SolidPoint extends Point {
+ private int z;
+
+ public SolidPoint(int x, int y, int z) {
+ super(x, y);
+ this.z = z;
+ }
+
+ public int getZ() { return z; }
+
+ public void setZ(int z) { this.z = z; }
+
+ public void incrXY(int dx, int dy) {
+ super.incrXY(dx, dy);
+ setZ(getZ() + dx + dy);
+ }
+}