diff options
Diffstat (limited to 'tests/new/pr456')
-rw-r--r-- | tests/new/pr456/AroundVarBug.java | 38 | ||||
-rw-r--r-- | tests/new/pr456/Test_AroundVarBug.java | 16 |
2 files changed, 54 insertions, 0 deletions
diff --git a/tests/new/pr456/AroundVarBug.java b/tests/new/pr456/AroundVarBug.java new file mode 100644 index 000000000..e0ef18ed9 --- /dev/null +++ b/tests/new/pr456/AroundVarBug.java @@ -0,0 +1,38 @@ +import java.util.*; +import org.aspectj.testing.Tester; + +/** @testcase PR#456 advice on advice in usejavac mode */ +public aspect AroundVarBug { + static { + Tester.expectEvent("Meta-advice reached"); + Tester.expectEvent("advice reached"); + } + + protected pointcut iterator () : + call (public Iterator Collection.iterator ()); + + Iterator around () : iterator () { + return handleIterator (thisJoinPoint, proceed ()); + } + + private Iterator handleIterator (Object join, Iterator iter) { + Tester.event("advice reached"); + return iter; + } + + // ------------- + // Meta-advice + // ------------- + + private pointcut adviceHandlers (): + call (private * AroundVarBug.handle*(..)); + + // Advice on this aspect! + Object around () : adviceHandlers () { + Tester.event("Meta-advice reached"); + return proceed(); + } + +} // end of aspect AroundVarBug + + diff --git a/tests/new/pr456/Test_AroundVarBug.java b/tests/new/pr456/Test_AroundVarBug.java new file mode 100644 index 000000000..ed394fbca --- /dev/null +++ b/tests/new/pr456/Test_AroundVarBug.java @@ -0,0 +1,16 @@ +import java.util.ArrayList; + +import org.aspectj.testing.Tester; + +/** @testcase PR#456 advice on advice in usejavac mode */ +public class Test_AroundVarBug { + { + new ArrayList ().iterator (); + } + public static void main (String[] args) { + new Test_AroundVarBug(); + Tester.checkAllEvents(); + } + +} + |