From bcf40bc8dde11336c4579851f094e1fecb7aef2d Mon Sep 17 00:00:00 2001 From: ehilsdal Date: Tue, 18 Nov 2003 03:49:06 +0000 Subject: Fix for Bugzilla 43891: Example aspect A in pointcut composition section in prog guide causes recursion * manually applied excellent doc patch contributed by Nick Brett --- docs/progGuideDB/language.xml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'docs/progGuideDB') diff --git a/docs/progGuideDB/language.xml b/docs/progGuideDB/language.xml index 77c09a58d..e337d79ec 100644 --- a/docs/progGuideDB/language.xml +++ b/docs/progGuideDB/language.xml @@ -701,16 +701,25 @@ aspect A { pointcut gooPC(): execution(void Test.goo()); pointcut printPC(): call(void java.io.PrintStream.println(String)); - before(): cflow(fooPC()) && cflow(gooPC()) && printPC() { + before(): cflow(fooPC()) && cflow(gooPC()) && printPC() && !within(A) { System.out.println("should occur"); } - before(): cflow(fooPC() && gooPC()) && printPC() { + before(): cflow(fooPC() && gooPC()) && printPC() && !within(A) { System.out.println("should not occur"); } } ]]> + + The !within(A) + pointcut above is required to avoid the printPC + pointcut applying to the System.out.println + call in the advice body. If this was not present a recursive call + would result as the pointcut would apply to it's own advice. + (See for more details.) + + -- cgit v1.2.3