Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Is this a bug or my pointcut problem?

The call signature is the same for overriding methods, so
the pointcut will pick out those methods as well.
Similarly for target: a subtype is an instance of that type.
So I suspect the pointcut is doing what you asked.

To force it to be lexically within classes in that package, use

  {same pointcut}
  && within({package}.*)

(note this won't include nested classes in the package)

However, it's usually more correct to use rather than avoid the
type system, so the original pointcut seems better.
The within(..) alternative might end up violating the Liskov
substitution principle, when you're writing advice that has
any effect on the base system.

Wes

Alan Williamson wrote:
Afternoon one and all,

I successfully downloaded and install the latest ADJT for Eclipse3M9 and its working a whole lot better than the previous version.

Now i have a problem here i am not sure if its a bug in the Aspect compiler or its a problem in my point cut.

Here is my Aspect;
-------------------------
public aspect AspectDebug {

pointcut tagExecute() : call (void com.naryx.tagfusion.cfm.tag.cfTag.render(..)) && target(com.naryx.tagfusion.cfm.tag.cfTag); before() : tagExecute(){
 System.out.println( "tagExecute:" + thisJoinPoint.getThis() );
}
}
-------------------------

As you can see i am wanting to capture all the calls to the method 'render' in the class 'com.naryx.tagfusion.cfm.tag.cfTag'.

Which works; however it also picks up other classes that have the same render() signature, that are *no* where near this package.


So the question is; is this a bug or have i not declared my pointcut properly?

[not sure if this matters, but i am weaving into class files as oppose to raw source files]

Thanks for any help you can give,

alan




Back to the top