summaryrefslogtreecommitdiffstats
path: root/ajde/testdata/examples/coverage/ModelCoverage.java
blob: cf14bf080c39cd48b1a29976768ed242aedd8fe8 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
import java.io.*;;

class Point { 

	int x;
	static int sx;

	{ x = 0; }
	static { sx = 1; }
	
	public Point() { }
	
	public int getX() { return x;	}
	
	public void setX(int x) { this.x = x; }
	
	void doIt() { 
		try {
			File f = new File(".");
			f.getCanonicalPath();
		} catch (IOException ioe) {
			System.err.println("!");	
		}	
		setX(10);
	}
} 

aspect PcdCoverage {
    before(): get(int *.*) { }
    before(): set(int *.*) { }
    before(): initialization(Point.new(..)) { }
    before(): staticinitialization(Point) { }
    before(): handler(IOException) { }
    before(): call(String Point.setX(int)) { }
//    before(): call(String Point.new()) { }
//    execution(): call(String Point.setX(int)) { }
}

aspect InterTypeDecCoverage {

    pointcut illegalNewFigElt():  call(FigureElement+.new(..)) &&
	                          !withincode(* Main.main(..));

    declare error: illegalNewFigElt():
	    "Illegal figure element constructor call.";

    declare warning: illegalNewFigElt():
	    "Illegal figure element constructor call.";

    declare parents: Point extends java.io.Serializable;

    declare parents: Point implements java.util.Observable;

    //declare soft: Point: call(* *(..));

    public String Point.getName() { return "xxx"; }

    public int Point.xxx = 0; 
}

aspect AdviceCoverage {

}