diff options
Diffstat (limited to 'tests/new/ArgsAlone.java')
-rw-r--r-- | tests/new/ArgsAlone.java | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/new/ArgsAlone.java b/tests/new/ArgsAlone.java new file mode 100644 index 000000000..89b3736d6 --- /dev/null +++ b/tests/new/ArgsAlone.java @@ -0,0 +1,31 @@ +import org.aspectj.testing.Tester; + +public class ArgsAlone { + public static void main(String[] args) { + Tester.expectEvent("within 2 method-call"); + Tester.expectEvent("within 2 method-execution"); + new TargetClass().callInt(2); + Tester.checkAllEvents(); + } +} + +class TargetClass { + void callInt(int i) { + while (i > 0) { --i; } + } + +} + +aspect Aspect { + pointcut pc () + : (call(void TargetClass.callInt(int)) + || execution(void TargetClass.callInt(int))); + + before(int i) + : !target(Aspect) && args(i) + //&& pc() // uncomment to avoid InternalCompilerError + { + Tester.event("within " + i + + " " + thisJoinPointStaticPart.getKind()); + } +} |