From 144143c2970a1e874d74cdbd0f8c622d4282a3c3 Mon Sep 17 00:00:00 2001 From: wisberg Date: Mon, 16 Dec 2002 18:51:06 +0000 Subject: initial version --- tests/new/ConstructorSignatures.java | 39 ++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 tests/new/ConstructorSignatures.java (limited to 'tests/new/ConstructorSignatures.java') diff --git a/tests/new/ConstructorSignatures.java b/tests/new/ConstructorSignatures.java new file mode 100644 index 000000000..cfb2a575a --- /dev/null +++ b/tests/new/ConstructorSignatures.java @@ -0,0 +1,39 @@ +// Does annotating 'new' with a type work as desired? + +import org.aspectj.testing.Tester; + +public class ConstructorSignatures { + public static void main(String[] args) { + new A1(); + Tester.checkEqual(A.a0, 2, "A0 advice overcalled"); + Tester.checkEqual(A.a1, 1, "A1 advice overcalled"); + Tester.checkEqual(A.b, 0, "B advice overcalled"); + A.a0 = A.a1 = A.b = 0; + + new B(); + Tester.checkEqual(A.a0, 0, "-A0 advice overcalled"); + Tester.checkEqual(A.a1, 0, "-A1 advice overcalled"); + Tester.checkEqual(A.b, 1, "-B advice overcalled"); + } +} + +class A0 { } + +class A1 extends A0 { } + +class B {} + +aspect A { + static int a0, a1, b; + /*static*/ before(): execution(A0+.new()) { //added + + a0++; + } + + /*static*/ before(): execution(A1.new()) { + a1++; + } + + /*static*/ before(): execution(B.new()) { + b++; + } +} -- cgit v1.2.3