You need a return type from around advice because it must return a value if the underlying join point does: the advice takes control at the join point and returns whatever it likes. In the case of a method with a void return this is less clear but consider if you want to use around advice for a cache: you need to be able to return a cached value without proceeding with the original join point.
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tobias Demuth Sent: Friday, September 14, 2007 3:43 AM To: [email protected] Subject: Re: [aspectj-users] Weird syntax-error Thanks for your help, your advice works fine. But why do I need a return-type here? In the book I'm reading about AspectJ I guess this is never mentioned ("Aspektorientierte Programmierung mit AspectJ 5" by Oliver Böhm, Amazon-users say it's the best German book about AspectJ available). kind regards, Tobias > -----Ursprüngliche Nachricht----- > Von: [email protected] > Gesendet: 14.09.07 12:24:57 > An: [email protected] > Betreff: Re: [aspectj-users] Weird syntax-error > > That's a pain when you get that error. The problem is simply that you > have no return type for the around advice. > > void around() : executeStringSetter { > System.out.println(thisJointPoint.toLongString()); > } > > On 14/09/2007, Tobias Demuth <[EMAIL PROTECTED]> wrote: > > Hello, > > > > my name is Tobias and I'm new to AspectJ and (of course) to this mailing list. I'm trying to get AspectJ to work together with my current project, but I have got an syntax error, which I don't understand and which I cannot reproduce in an easier (aka smaller) project. > > > > Here is my Aspect (the simplest version, that causes the error): > > > > public aspect ScriptingAspect { > > > > pointcut executeStringSetter() : > > execution(public void Cell.setRow(Row)); // Here comes the error. > > > > around() : executeStringSetter { > > System.out.println(thisJointPoint.toLongString()); > > } > > > > } > > > > The Classes Cell and Row are in the same Package as this Aspect. The error, the compiler shows to me, is: > > > > Syntax error on token ";", Type expected after this token > > > > I don't understand, what the compiler is arguing about. As I already said, I wasn't able to reproduce this error with an less complex project, which I can show to you anyway if requested. > > > > Thanks for any help or suggestions about the error, > > kind regards, > > Tobias > > _______________________________________________________________________ > > Jetzt neu! Schützen Sie Ihren PC mit McAfee und WEB.DE. 3 Monate > > kostenlos testen. http://www.pc-sicherheit.web.de/startseite/?mc=022220 > > > > _______________________________________________ > > aspectj-users mailing list > > [email protected] > > https://dev.eclipse.org/mailman/listinfo/aspectj-users > > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > __________________________________________________________________________ Erweitern Sie FreeMail zu einem noch leistungsstärkeren E-Mail-Postfach! Mehr Infos unter http://produkte.web.de/club/?mc=021131 _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users _______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
