]> source.dussan.org Git - aspectj.git/commitdiff
updated for new sematics of issingleton aspects advising their own
authorjhugunin <jhugunin>
Mon, 23 Dec 2002 19:39:49 +0000 (19:39 +0000)
committerjhugunin <jhugunin>
Mon, 23 Dec 2002 19:39:49 +0000 (19:39 +0000)
initializers

tests/new/ConstructorExecInit.java
tests/new/ConstructorExecInitFails.java [new file with mode: 0644]

index 337fbbda3fa301214a09df3d65fde51a89bcecd0..02b9bf2935b691a5e22d6f13b93db57444ef42f5 100644 (file)
@@ -17,10 +17,10 @@ public class ConstructorExecInit {
 
 /** @testcase after returning from initialization and after executing constructor */
 aspect A {
-    after (Object target) : execution(*.new(..)) && target(target) { 
+    after (Object target) : execution(*.new(..)) && target(target) && !within(A) 
         Tester.event("execution");
     }
-    after () returning (Object target) : initialization(new(..)) { 
+    after () returning (Object target) : initialization(new(..)) && !this(A) 
         Tester.event("initialization");
     }
 }
diff --git a/tests/new/ConstructorExecInitFails.java b/tests/new/ConstructorExecInitFails.java
new file mode 100644 (file)
index 0000000..4b5e775
--- /dev/null
@@ -0,0 +1,26 @@
+import org.aspectj.testing.*;
+
+/**
+ * -usejavac mode: no error
+ * not -usejavac mode: VerifyError
+ */
+public class ConstructorExecInitFails {
+    public static void main(String[] args) {
+       try {
+               new ConstructorExecInitFails();
+       } catch (ExceptionInInitializerError e) {
+               return;
+       }
+        Tester.checkFailed("shouldn't be able to run");
+    }
+}
+
+/** @testcase after returning from initialization and after executing constructor */
+aspect A {
+    after (Object target) : execution(*.new(..)) && target(target) { 
+        Tester.checkFailed("shouldn't be able to run");
+    }
+    after () returning (Object target) : initialization(new(..)) { 
+        Tester.checkFailed("shouldn't be able to run");
+    }
+}