~ubuntu-branches/ubuntu/utopic/aspectj/utopic

« back to all changes in this revision

Viewing changes to org.aspectj/modules/ajde.core/testdata/figures-coverage/figures/Figure.java

  • Committer: Bazaar Package Importer
  • Author(s): Michael Koch, Michael Koch, Thomas Girard, Mark Howard
  • Date: 2008-01-05 23:31:47 UTC
  • mfrom: (1.1.2 upstream) (3.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080105233147-r425rd8nymruj6fk
Tags: 1.5.4-1
[ Michael Koch ]
* New upstream version. Closes: #459363
* Updated Standards-Version to 3.7.3.
* Added myself to Uploaders.

[ Thomas Girard ]
* Add Homepage: control field, and convert XS-Vcs-* to Vcs-*.

[ Mark Howard ]
* debian/watch: added.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
package figures;
 
3
 
 
4
import figures.primitives.planar.Point;
 
5
 
 
6
import java.awt.Canvas;
 
7
 
 
8
aspect Figure {
 
9
    //pointcut sendSuccess(): cflow(setX()) && !handler(Exception);
 
10
 
 
11
    public String Point.getName() {
 
12
        return Point.name;
 
13
    } 
 
14
 
 
15
    public int figures.primitives.planar.Point.DEFAULT_X = 0; 
 
16
 
 
17
    public pointcut constructions(): call(Point.new(int, int)) || call(SolidPoint.new(int, int, int));
 
18
 
 
19
    public pointcut moves(FigureElement fe): target(fe) &&
 
20
        (call(String Point.getName()) ||
 
21
         call(void FigureElement.incrXY(int, int)) ||
 
22
         call(void Point.setX(int)) ||
 
23
         call(void Point.setY(int)) ||
 
24
         call(void SolidPoint.setZ(int)));
 
25
    
 
26
    pointcut mainExecution(): 
 
27
        execution(int main(*));
 
28
 
 
29
    pointcut runtimeHandlers(): mainExecution() 
 
30
        || handler(RuntimeException);
 
31
 
 
32
    public pointcut mumble(): runtimeHandlers();
 
33
 
 
34
    before(int newValue): set(int *.*) && args(newValue) {   }
 
35
 
 
36
    before(): get(int *.*) { }
 
37
 
 
38
    before(): constructions() {
 
39
            System.out.println("> before construction, jp: " + thisJoinPoint.getSignature());
 
40
    } 
 
41
 
 
42
    before(FigureElement fe): moves(fe) {
 
43
            System.out.println("> about to move FigureElement at X-coord: ");
 
44
        }
 
45
 
 
46
    after(): initialization(Point.new(..)) || staticinitialization(Point) {
 
47
        System.out.println("> Point initialized");
 
48
    }
 
49
 
 
50
    // should be around
 
51
    after(): mumble() {
 
52
        System.err.println(">> in after advice...");
 
53
        //proceed();
 
54
    }
 
55
 
 
56
    after(FigureElement fe): target(fe) &&
 
57
        (call(void FigureElement.incrXY(int, int)) ||
 
58
         call(void Point.setX(int)) ||
 
59
         call(void Point.setY(int)) ||
 
60
         call(void SolidPoint.setZ(int))) {
 
61
        System.out.println("> yo.");
 
62
    }
 
63
 
 
64
    after(FigureElement fe):
 
65
        target(fe) &&
 
66
        (call(void FigureElement.incrXY(int, int)) ||
 
67
         call(void Line.setP1(Point))              ||
 
68
         call(void Line.setP2(Point))              ||
 
69
         call(void Point.setX(int))                ||
 
70
         call(void Point.setY(int))) { }
 
71
 
 
72
    declare parents: Point extends java.io.Serializable;
 
73
 
 
74
    declare parents: Point implements java.util.Observable;
 
75
 
 
76
        // AMC - this next line doesn't make sense!! Can these tests ever
 
77
        // have been run???
 
78
    //declare soft: Point: call(* *(..));
 
79
}
 
80
 
 
81
aspect Checks {
 
82
    pointcut illegalNewFigElt():  call(FigureElement+.new(..))  &&
 
83
                                  !withincode(* Main.main(..));
 
84
 
 
85
//      pointcut illegalNewFigElt(): execution(FigureElement+.new(..));
 
86
 
 
87
    declare error: illegalNewFigElt():
 
88
            "Illegal figure element constructor call.";
 
89
 
 
90
    declare warning: illegalNewFigElt():
 
91
            "Illegal figure element constructor call.";
 
92
}