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

Thanks Mathew. Please can the quick reference tell me explicitly that I have to have a static pointcut for declare, than do it wrong, get the error and then search on the error!

-----Original Message-----
From: Matthew Webster [mailto:matthew_webster@xxxxxxxxxx]
Sent: October 25, 2004 11:03 AM
To: aspectj-users@xxxxxxxxxxx
Subject: RE: [aspectj-users] Point Cut gambling

Please see "Static Crosscutting" in the Programming Guide
(http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/progguide/semantics-declare.html#d0e6417).
 Under the heading "Statically Determinable Pointcuts" it explains the
restrictions for declare warning/error.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx
http://w3.hursley.ibm.com/~websterm/

"Echlin Harmer, Elizabeth" <echline@xxxxxxx>@eclipse.org on 22/10/2004
17:02:02

Please respond to aspectj-users@xxxxxxxxxxx

Sent by:    aspectj-users-admin@xxxxxxxxxxx


To:    "'aspectj-users@xxxxxxxxxxx'" <aspectj-users@xxxxxxxxxxx>
cc:
Subject:    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

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top