blob: cdb42e80978eb9f1d13e5a69a54b48f651f67579 (
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
|
// -*- Mode: java; -*-
import org.aspectj.testing.Tester;
public class Driver {
public static void main(String[] args) { test(); }
public static void test() {
MagicKey key = new MagicKey();
Pos p1 = new Pos(key);
Tester.checkEqual(p1.getOther(), 1, "introduced value");
}
}
class Pos {
int _x = 0;
int _y = 0;
public int getX() {
return(_x);
}
public int getY() {
return(_y);
}
public void move(int x, int y) {
_x = x;
_y = y;
}
}
aspect Foo {
// this has been declared illegal syntax as of 4/19/99, see below for fix
// introduce public int Pos.id = 1, Pos.other;
//introduction Pos {
//XXX might want to test for this in the future
//public int Pos.id=1, Pos.other;
public int Pos.id=1;
public int Pos.other;
int Pos.getOther() {
return other;
}
Pos.new(MagicKey key) {
this();
other = id;
id = getOther();
}
//}
}
class MagicKey {}
|