summaryrefslogtreecommitdiffstats
path: root/tests/new/PR584.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/new/PR584.java')
-rw-r--r--tests/new/PR584.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/new/PR584.java b/tests/new/PR584.java
new file mode 100644
index 000000000..2c4ecc03b
--- /dev/null
+++ b/tests/new/PR584.java
@@ -0,0 +1,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"); }
+ }
+}