blob: c24ab86deaf7fe480773892f6554c7070869db55 (
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
|
import org.aspectj.testing.Tester;
interface I {}
/** @testcase PR#757 Incrementing interface-introduced field */
public class IntroducedFieldInc implements I{
public static void main (String args[]) {
IntroducedFieldInc i = new IntroducedFieldInc();
// no bug
Tester.check(1 == (((I)i).count = 1), "((I)i).count = 1");
Tester.check(2 == (++(i).count), "++((I)i).count");
// bug
Tester.check(3 == (++((I)i).count), "++((I)i).count");
Tester.check(3 == (((I)i).count++), "((I)i).count++");
Tester.check(5 == (((I)i).count += 1), "((I)i).count += 1");
Tester.checkEqual((getI().count += 1), 3, "getI().count += 1");
Tester.checkEqual(getICount, 1, "getI() called");
}
static int getICount = 0;
public static I getI() {
getICount++;
return new IntroducedFieldInc();
}
}
aspect A {
public int I.count = 2;
}
|