[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Point Cut gambling
|
Frustrating - thanks to Ram and Gregor for the solution...
On the more general question of debugging pointcuts, if
you're having trouble it helps to break them apart to
isolate the problem. There's a long comment on point at
http://www.aspectcookbook.net/moin.cgi/DebugPointcutRecipe
If you follow that process, it should take minutes
and not days to figure out what's wrong with a pointcut.
In most cases, once you find the offending element (e.g.,
using && for ||, or misusing args()), re-reading the
section on point in the programming guide semantics
appendix will give you the "aha!" ("oh, pointcuts are
evaluated at *each* join point" or "args(..) matches
the *entire* parameter list"). All in all, people seem
to run up against about 10 cases where their initial
assumption is not correct, and after that they spend
their time building solutions rather than debugging
pointcuts.
Wes
> ------------Original Message------------
> From: Franz Prilmeier <prilmeie@xxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Thu, Oct-21-2004 1:30 PM
> Subject: [aspectj-users] Point Cut gambling
>
> I am having troubles with pointcuts, yet again. It seems to me it lies
> in the favour of the aspectj gods whether a point cut matches or not.
>
> These are the participating files in my application (Packages and
> irrelevant methods stripped away):
> public interface IRemoteObject extends javax.ejb.EJBObject {
> public boolean changeOperationAllowed ( AbstractDO ado ) throws
> java.rmi.RemoteException;
> }
>
> public interface PersonManagerRemote extends IRemoteObject {
> public PersonDO createPerson ( PersonDO p ) throws
> java.rmi.RemoteException;
> public void changePerson ( PersonDO p ) throws
> java.rmi.RemoteException;
> public void removePerson ( PersonDO p ) throws
> java.rmi.RemoteException;
> }
>
> public interface AddressBookManagerRemote extends IRemoteObject {
> public void addParty ( AddressBookDO ado, PartyDO pdo ) throws
> java.rmi.RemoteException;
> public void removeParty ( AddressBookDO ado, PartyDO pdo ) throws
> java.rmi.RemoteException;
> }
>
> public class AbstractDO { /* ejb value object */ }
> public class PartyDO extends AbstractDO { /* ejb value object */ }
> public class AddressBookDO extends AbstractDO { /* ejb value object */
> }
> public class PersonDO extends PartyDO { /* ejb value object */ }
>
> This point cut matches perfectly:
> public pointcut remoteAuthOperations ( IRemoteObject iro, PersonDO
> ado ) :
> target ( PersonManagerRemote ) && target ( iro ) && args ( ado
> ) &&
> (
> call ( public void PersonManagerRemote.createPerson (
> PersonDO ) ) ||
> call ( public void PersonManagerRemote.changePerson (
> PersonDO ) ) ||
> call ( public void PersonManagerRemote.removePerson (
> PersonDO ) )
> );
>
> This point cut doesn't match, but it isn't very different from the one
> above:
> public pointcut remoteAuthOperations ( AddressBookManagerRemote
> iro,
> AddressBookDO ado ) :
> target ( AddressBookManagerRemote ) && target ( iro ) && args (
>
> ado ) &&
> (
> call ( public void AddressBookManagerRemote.addParty (
> AddressBookDO, PartyDO ) ) ||
> call ( public void AddressBookManagerRemote.removeParty (
> AddressBookDO, PartyDO ) )
> );
>
> Where is the difference? Why doesn't it match?
>
> I am now trying for two days to get this point cut to match. It's kind
> of frustrating.
>
> Franz
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>