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. 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()); // 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*()); 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
