blob: 2c4ecc03bd5891c0b24cc78144b0a7eac79b9280 (
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
|
import org.aspectj.testing.Tester;
import org.aspectj.testing.Tester;
public class PR584 {
public static void main(String[] args) {
Tester.expectEvent("foo ok");
Tester.expectEvent("foo test2");
Foo foo = new Foo("foo");
/** @testcase PR#584 constructing inner classes using qualified new expression */
Foo.Test test1 = foo.new Test();
Foo.Test test2 = foo.new Test() {
public void foo() {
Tester.event(getFoo().baz + " test2");
}
};
test1.foo();
test2.foo();
/** @testcase PR#584 constructing static inner classes using new expression */
Foo.StaticTest test3 = new Foo.StaticTest();
Tester.expectEvent("static foo");
test3.staticBaz = "static foo";
test3.staticFoo();
Tester.checkAllEvents();
}
}
class Foo {
public String baz;
public Foo(String baz) { this.baz = baz; }
public static class StaticTest {
static String staticBaz;
public void staticFoo() { Tester.event(staticBaz); }
}
public class Test {
public Foo getFoo() { return Foo.this; }
public void foo() { Tester.event(baz + " ok"); }
}
}
|