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

public aspect DeclareCoverage2 {

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

    declare parents: Point extends java.io.Serializable;
	declare parents: Line implements java.util.Observable;
    declare soft: SizeException : call(* Point.getX());
	declare precedence: DeclareCoverage2, InterTypeDecCoverage, *;
}

aspect InterTypeDecCoverage {}

class Point { 
	
	int x = 2;
	public void setX(int x) {
		this.x = x;
	}
	
	public int getX() {
		return x;
	}
}

class Line {
}

class SizeException extends Throwable { }

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