Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] execution pointcut and subclassing

Thanks Wes and Matthew.

That explains a lot.

I expected the semantics of the execution(* Rectangle.moveBy(int,int)) 
to be matching the moveBy method overriden/declared in Rectangle class.  
If there is no such declaration, I thought it would match nothing no 
matter what were overriden in Rectangle's subclasses.

Is there any way to express this semantics?  Both of the following wouldn't 
work since they only check the runtime type of "this".
  execution(* Shape+.moveBy(int,int))&&this(Rectangle)
  execution(* Shape+.moveBy(..))&&this(r)&&if(r.getClass()==Rectangle.class)

execution(* Shape+.moveBy(..))&&within(Rectangle) or
execution(* Rectangle.moveBy(..))&&within(Rectangle) 
seems an option.

Thanks,
Linton



Back to the top