blob: a57363d521fb684907bc082ebc8b0d12cb13a4bb (
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
|
import org.aspectj.testing.*;
public class DeclareAccess {
public static void main (String[] args) {
Tester.event("main");
Target t = new Target();
Aspect a = Aspect.aspectOf();
a.tryPI(t);
Tester.checkAllEvents();
}
static {
Tester.expectEvent("run");
Tester.expectEvent("main");
Tester.expectEvent("value");
}
}
class Target {
public String value() {
Tester.event("run");
return "value";
}
}
/** @testcase private inner interface accessible in scope when declared on outer class */
aspect Aspect {
private interface PI {
public String value();
}
public void tryPI(Target t) {
PI pi = (PI) t;
Tester.event(pi.value());
}
/** @testcase private interface declared on Target */
declare parents: Target implements PI;
}
|