summaryrefslogtreecommitdiffstats
path: root/tests/new/TryFinallyInAround.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/new/TryFinallyInAround.java')
-rw-r--r--tests/new/TryFinallyInAround.java39
1 files changed, 39 insertions, 0 deletions
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");
+ }
+ }
+}