Skip to main content

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

Title: RE: [aspectj-users] Point Cut gambling

Franz
When I tried your pointcut within eclipse, I got
"target() pointcut designator cannot be used in declare statement" and
"args() pointcut designator cannot be used in declare statement".
I couldn't find this in a very quick search of the online docs, but in Ramnivas wonderful AspectJ in Action, 3.3.3 on p97 "Since these declarations (declare warning and declare error) affect compile-time behaviour, you must use only statically determinable pointcuts in the declarations. In other words, the pointcuts that use dynamic context to select the matching join points - this, target, args, if, cflow, and cflowbelow - cannot be used."

Maybe you could raise a bug report to get this added to the documentation, especially the quick reference guide - it would be so easy to change the current description under declare from "pointcut designator" to "statically determinable pointcut designator - target, args, etc not allowed"

Hope this helps
Elizabeth

-----Original Message-----
From: Franz Prilmeier [mailto:prilmeie@xxxxxxx]
Sent: October 22, 2004 9:58 AM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Point Cut gambling


Wes Isberg schrieb:

>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
>
I did what they say, but it's now much more confusing:

package de.prilmeier.mysabom.aspects.authorization;

import de.prilmeier.mysabom.addressbook.AddressBookDO;
import de.prilmeier.mysabom.addressbook.AddressBookManagerRemote;
import de.prilmeier.mysabom.party.PartyDO;

public abstract class AddressBookAuthorizationAspect
{
    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 ) )
        );

    declare warning: remoteAuthOperations ( AddressBookManagerRemote,
AddressBookDO ) : "remoteAuthOperations matches";
}

Now I have a compiler error:

$ ant compile
Buildfile: build.xml

compile:
     [iajc]
F:\Inetpub\cvsroot\da-aop\source\mysabom\src\de\prilmeier\mysabom\aspects\authorization\AddressBookAuthorizationAspect.aj:14

[error] Syntax error on token ";", invalid PseudoToken
     [iajc] );
     [iajc]
     [iajc] MessageHolder:  (1 error)
     [iajc] [error   0]: error at );
     [iajc]
     [iajc]
F:\Inetpub\cvsroot\da-aop\source\mysabom\src\de\prilmeier\mysabom\aspects\authorization\AddressBookAuthorizationAspect.aj:14:0

Syntax error on token ";", invalid PseudoToken

BUILD FAILED
F:\Inetpub\cvsroot\da-aop\source\mysabom\build.xml:133: 1 errors

What's going on here? Is it not allowed to use "declare warning" in an
abstract aspect? If I move the "declare warning" statement to an
extending aspect, the compiler error vanishes (But there is no output
"remoteAuthOperations matches").
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top