diff options
author | wisberg <wisberg> | 2003-04-23 00:32:49 +0000 |
---|---|---|
committer | wisberg <wisberg> | 2003-04-23 00:32:49 +0000 |
commit | 90b260074423dc1fbafc3a33764606a58cb78f90 (patch) | |
tree | 07c4f38a8c3338c4f5073e419afc9813e66dcb6c | |
parent | a1a51eef8d3b8d38457a7be7c06208d62c88664e (diff) | |
download | aspectj-90b260074423dc1fbafc3a33764606a58cb78f90.tar.gz aspectj-90b260074423dc1fbafc3a33764606a58cb78f90.zip |
@testcase try/finally in around advice (same as ...messy arounds?)
Works in current tree, but not in 1.1rc1
-rw-r--r-- | tests/ajcTests.xml | 6 | ||||
-rw-r--r-- | tests/new/TryFinallyInAround.java | 39 |
2 files changed, 45 insertions, 0 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml index 8785b0b8a..7bc3af750 100644 --- a/tests/ajcTests.xml +++ b/tests/ajcTests.xml @@ -5850,5 +5850,11 @@ </compile> <run class="cap.OptionList"/> </ajc-test> + + <ajc-test dir="new" + title="try/finally in around advice (same as ...messy arounds?)"> + <compile files="TryFinallyInAround.java"/> + <run class="TryFinallyInAround"/> + </ajc-test> </suite> diff --git a/tests/new/TryFinallyInAround.java b/tests/new/TryFinallyInAround.java new file mode 100644 index 000000000..b963eab0d --- /dev/null +++ b/tests/new/TryFinallyInAround.java @@ -0,0 +1,39 @@ + +import org.aspectj.testing.Tester; + +// XXX broken in 1.1rc1, fixed in tree as of 4/22 +/** @testcase try/finally in around advice (same as ...messy arounds?) */ +public class TryFinallyInAround { + public static void main(String[] args) { + int i = new C().go(); + Tester.check(2 == i, "expected 2 got " + i); + } +} + +class C { + int i = 1; + int go() { + dowork(); + return i; + } + void dowork() { + i++; + } +} + +aspect A { + Object around() : + within(C) + && !cflow(within(A)) + && !handler(*) + && !preinitialization(new(..)) // 1.1 + && !initialization(new(..)) + { + // no bug if reduced to proceed(); + try { + return proceed(); + } finally { + if (false) System.out.println("ok"); + } + } +} |