diff options
author | jhugunin <jhugunin> | 2002-12-23 19:39:49 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2002-12-23 19:39:49 +0000 |
commit | 517b6c0ec2c76af89a6e78b75f292d67e71e8339 (patch) | |
tree | 297d6aebef335caf7507b9292e9785c0bc3a8e4c | |
parent | edbf43c6841313ebe0e7747407cfed9b11082065 (diff) | |
download | aspectj-517b6c0ec2c76af89a6e78b75f292d67e71e8339.tar.gz aspectj-517b6c0ec2c76af89a6e78b75f292d67e71e8339.zip |
updated for new sematics of issingleton aspects advising their own
initializers
-rw-r--r-- | tests/new/ConstructorExecInit.java | 4 | ||||
-rw-r--r-- | tests/new/ConstructorExecInitFails.java | 26 |
2 files changed, 28 insertions, 2 deletions
diff --git a/tests/new/ConstructorExecInit.java b/tests/new/ConstructorExecInit.java index 337fbbda3..02b9bf293 100644 --- a/tests/new/ConstructorExecInit.java +++ b/tests/new/ConstructorExecInit.java @@ -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 index 000000000..4b5e775e4 --- /dev/null +++ b/tests/new/ConstructorExecInitFails.java @@ -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"); + } +} |