aboutsummaryrefslogtreecommitdiffstats
path: root/testing/figures-coverage/figures/Main.java
blob: 189f05ceee31c2b7c01a4f1861394aacb1430e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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");
	    } 
	}
}