aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/AdviceOnEmptyConstructor.java
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 18:51:06 +0000
committerwisberg <wisberg>2002-12-16 18:51:06 +0000
commit144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch)
treeb12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/new/AdviceOnEmptyConstructor.java
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/AdviceOnEmptyConstructor.java')
-rw-r--r--tests/new/AdviceOnEmptyConstructor.java33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/new/AdviceOnEmptyConstructor.java b/tests/new/AdviceOnEmptyConstructor.java
new file mode 100644
index 000000000..04b2ed99f
--- /dev/null
+++ b/tests/new/AdviceOnEmptyConstructor.java
@@ -0,0 +1,33 @@
+import org.aspectj.testing.Tester;
+
+public aspect AdviceOnEmptyConstructor {
+ public static void main(String[] args) { test(); }
+
+ public static void test() {
+ // C has an implied empty constructor so should be advised
+ Tester.checkEqual(new C().value, "afterInit:foo", "new C");
+
+ // C1 has no implied empty constructor (make sure we aren't cheating)
+ Tester.checkEqual(new C1(0).value, "foo", "new C1");
+ }
+
+ /*static*/ after() returning (C c):
+ //this(c) &&
+ call(C.new()) {
+ c.value = "afterInit:" + c.value;
+ }
+ /*static*/ after() returning(C1 c1):
+ //this(c1) &&
+ call(C1.new()) {
+ c1.value = "afterInit:" + c1.value;
+ }
+}
+
+class C {
+ public String value = "foo";
+}
+
+class C1 {
+ public String value = "foo";
+ public C1(int dummy) {}
+}