aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/ConstructorSignatures.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/ConstructorSignatures.java
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/ConstructorSignatures.java')
-rw-r--r--tests/new/ConstructorSignatures.java39
1 files changed, 39 insertions, 0 deletions
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++;
+ }
+}