aboutsummaryrefslogtreecommitdiffstats
path: root/ajdoc/testdata/declareForms/DeclareCoverage2.aj
blob: 1ea6b6322501a68f5abf7001ea583092359d3215 (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
package foo;

public aspect DeclareCoverage2 {

    pointcut illegalNewFigElt(): call(Point2.new(..)) && !withincode(* *.doIt(..));
    
    declare error: illegalNewFigElt(): "Illegal constructor call.";
    declare warning: call(* Point2.setX(..)): "Illegal call.";
    declare warning : execution(* Point2.setX(..)) : "blah";

    declare parents: Point2 implements java.io.Serializable;
    declare soft: SizeException2 : call(* Point2.getX());
	declare precedence: DeclareCoverage2, InterTypeDecCoverage2, *;
}

aspect InterTypeDecCoverage2 {}

/**
 * comment about class Point2
 */
class Point2 { 
	
	int x = 2;
	public void setX(int x) {
		this.x = x;
	}
	
	public int getX() {
		return x;
	}
}

class Line2 {
}

class SizeException2 extends Throwable { }

class Main2 {
	
	public static void main(String[] args) {
	}
	
	public void doIt() {
		Point2 p = new Point2();
		p.setX(3);
		p.getX();
	}
	
}