From: ehilsdal Date: Mon, 23 Aug 2004 02:51:10 +0000 (+0000) Subject: Fix for bugzilla bug 71393: X-Git-Tag: V1_2_1~96 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=df55b490f7059bda21e2e116f577ee7482dc3618;p=aspectj.git Fix for bugzilla bug 71393: Specify how does args pointcut collect context for pointcuts which are used in cflow --- diff --git a/docs/progGuideDB/semantics.xml b/docs/progGuideDB/semantics.xml index b7dd33445..3c1c8fe32 100644 --- a/docs/progGuideDB/semantics.xml +++ b/docs/progGuideDB/semantics.xml @@ -696,6 +696,7 @@ argument was an int, then the value passed to advice will be of type java.lang.Integer. + @@ -929,6 +930,57 @@ picked out by Pointcut. + + Context exposure from control flows + + + The cflow and + cflowbelow pointcuts may expose context + state through enclosed this, + target, and args + pointcuts. + + + + Anytime such state is accessed, it is accessed through the + most recent control flow that + matched. So the "current arg" that would be printed by + the following program is zero, even though it is in many + control flows. + + + +class Test { + public static void main(String[] args) { + fact(5); + } + static int fact(int x) { + if (x == 0) { + System.err.println("bottoming out"); + return 1; + } + else return x * fact(x - 1); + } +} + +aspect A { + pointcut entry(int i): call(int fact(int)) args(i); + pointcut writing(): call(void println(String)) ! within(A); + + before(int i): writing() cflow(entry(i)) { + System.err.println("Current arg is " + i); + } +} + + + + It is an error to expose such state through + negated control flow pointcuts, such + as within ! + cflowbelow(P). + + +