Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
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 <anrizal05@xxxxxxxx> 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
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top