Hi Andy, Thanks for your quick answer.
I'll have a look at the compiler options, I hope to find something to enable raise error when the type is expressed as exact name, but no method/field matches the pointcut/declare @ definitions. For the bug, I've opened this one: https://bugs.eclipse.org/bugs/show_bug.cgi?id=319783 Cheers, Anwar. ________________________________ De : Andy Clement <[email protected]> À : [email protected] Envoyé le : Mar 13 juillet 2010, 20h 50min 23s Objet : Re: Re : [aspectj-users] Inconsistent behavior for declare @method / declare @field? Hey, On 13 July 2010 11:16, Rizal Anwar <[email protected]> wrote: > Hi Andy, > I'm using aspectJ 1.6.9 and AJDT 2.1.0. The most recent then. > The same compilation is also raised for declare @field: > declare @field : private Y X.a* : @OneToOneAccessor; > Although there was no error when I did this (wildcard on type): > declare @field : private Y X*.a* : @OneToOneAccessor; > I will raise a bug if it is really the specified behavior. Yes, it is the expected behaviour (at the moment). > But honestly, I like the compilation error, and wonder if there is a way to > configure the compiler to raise a compilation error for pointcut definition > too: > // Compilation error would be great for this since getY1 of X returns Y, not >int. > pointcut access() : execution(int X.getY1()); We do not do that level of analysis. That is where the pointcut doctor would be useful to tell you why things are wrong. I wouldn't want to do this level of analysis by default in AspectJ, it will kill performance if we have to check at every joinpoint whether your pointcut could be tweaked to match. > // Compilation error would also be great for this since there is no method > starting with a and has no parameter and returns Y: > pointcut access() : execution(Y X.a*()); When your advice does not apply because the pointcut does not match, you get an 'adviceDidNotMatch' warning. This is an xlint, which means it is configurable. You can make it an error if you wish by tweaking the setting in eclipse or by providing your own xlint properties file. cheers, Andy > Cheers, > Anwar. > > ________________________________ > De : Andy Clement <[email protected]> > À : [email protected] > Envoyé le : Mar 13 juillet 2010, 16h 43min 07s > Objet : Re: [aspectj-users] Inconsistent behavior for declare @method / > declare @field? > > You should only get the declare @method error if you have been very > specific in your target for the annotation and that target does not > exist. You haven't been specific (you used a wild card) so you > shouldn't get the error (which could possibly be demoted to warning to > match the 'advice did not match' warning you would be getting for the > pointcut). Please try a recent AspectJ/AJDT (you didn't mention what > you were using) - if it still fails then please raise a bug. > > Andy > > On 13 July 2010 06:02, Rizal Anwar <[email protected]> wrote: >> Hi, >> I have a class X that has two associations to Y class as follow : >> public class X { >> private Y y1; >> private Y y2; >> public Y getY1() { >> return y1; >> } >> public void setY1(Y y) { >> this.y1 = y; >> } >> public Y getY2() { >> return y2; >> } >> public void setY2(Y y) { >> this.y2 = y; >> } >> } >> Nothing special for class Y. >> I have an aspect like this which is OK, but access() point cut does not >> capture anything. Fine. >> public aspect OneToOneAspect { >> pointcut access() : execution(Y X.a*()); >> after() : access() { >> System.out.println("Access"); >> } >> } >> But, if I add similar method signature like Y X.a*() but for declare >> @method, I had compilation error: >> [error] The method 'public com.arizal.business.Y >> com.arizal.business.X.a*()' >> does not exist >> The aspect after declare addition is the following: >> public aspect OneToOneAspect { >> declare @method : public Y X.a*(): @OneToOneAccessor; >> pointcut access() : execution(Y X.a*()); >> after() : access() { >> System.out.println("Access"); >> } >> } >> Why the pointcut definition does not throw error while the declare method >> does ? Is it expected ? >> I would prefer to have compilation error in both cases. Is it possible ? >> Cheers, >> Anwar . >> >> >> _______________________________________________ >> 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 > > > _______________________________________________ > 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
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
