Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Point Cut gambling

Ramnivas Laddad wrote:

Ah... You args() pointcut usage isn't right for the nonmatching case. Here is something that should work:

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 ) )
      );


Note the "*" in args() part of the pointcut. You have two arguments to add/removeParty() and the original pointcut was trying to match the one with only one argument of AddressBookDO type. Of course, using args ( ado, * ) is only one of the possibilities, you could use args(ado, PartyDO) or args(ado, ..) and it should still work. The right choice depends on what you are trying to express.

In my opinion my initial version should result in a compiler error: "Unmatchable Pointcut" or something like that. When it is obvious that the pointcut cannot match, then the compiler should tell me about that.

Regards,
Franz


Back to the top