Oh, absolutely. For some reason I thought that execution() cannot be used
for statically scoped pointcuts (please correct me if I am using a wrong
term here), but I was wrong, obviously.

BTW, is it possible to make the warning display the name of the offending
method?

Thanks.

2011/12/9 Andy Clement [via AspectJ] <
[email protected]>

> A typical good pointcut has 2 or 3 pieces:
> 1) a kind (a what)
> 2) a scope (a where)
> 3) optionally, some context binding
>
> Your pointcut only has (2), this means without (1) you are getting
> lots of messages (it is matching on all the joinpoints within the code
> of the method you are matching with withincode).  I think you want to
> change from withincode to execution.  That will give you a (1) since
> execution is a kinded pointcut.
>
> pointcut unauthorizedMethods() :
>     within(!@Authorize HttpHandlerType+) &&
>     execution(@(GET || PUT || POST || DELETE) !@Authorize public *
> *.*(..));
>
> Andy
>
> On 8 December 2011 13:28, Mark <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=4174637&i=0>>
> wrote:
>
> > Here is the pointcut:
> > =========================
> >  pointcut unauthorizedMethods() :
> >    within(!@Authorize HttpHandlerType+) &&
> >    withincode(@(GET || PUT || POST || DELETE) !@Authorize public *
> > *.*(..));
> >
> >
> >  declare warning : unauthorizedMethods() : "Unauthorized HTTP resource
> > method";
> > =========================
> >
> > It correctly identifies all the methods which are not annotated with the
> > @Authorize annotations. But it generates the warning for each and ever
> > statement found in the respective method body! So, for three methods I
> have
> > 18 warning!
> >
> > I suspect that the problem is with the withincode join point, but I have
> no
> > idea how to fix it.
> >
> > Thanks.
> >
> > --
> > View this message in context:
> http://aspectj.2085585.n4.nabble.com/My-declare-warning-pointcut-generates-too-many-duplicate-warnings-how-to-fix-it-tp4174448p4174448.html
> > Sent from the AspectJ - users mailing list archive at Nabble.com.
> > _______________________________________________
> > aspectj-users mailing list
> > [hidden email] <http://user/SendEmail.jtp?type=node&node=4174637&i=1>
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> _______________________________________________
> aspectj-users mailing list
> [hidden email] <http://user/SendEmail.jtp?type=node&node=4174637&i=2>
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://aspectj.2085585.n4.nabble.com/My-declare-warning-pointcut-generates-too-many-duplicate-warnings-how-to-fix-it-tp4174448p4174637.html
>  To unsubscribe from My declare warning pointcut generates too many
> duplicate warnings, how to fix it?, click 
> here<http://aspectj.2085585.n4.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4174448&code=bWFyay5raGFyaXRvbm92QGdtYWlsLmNvbXw0MTc0NDQ4fDExNDk0NDg2MTk=>
> .
> NAML<http://aspectj.2085585.n4.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.InstantMailNamespace&breadcrumbs=instant+emails%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>



-- 
Be well and prosper.
==============================
"There are two kinds of people.Those whose guns are loaded and those who
dig."
   ("The good, the bad and the ugly")
So let us drink for our guns always be loaded.


--
View this message in context: 
http://aspectj.2085585.n4.nabble.com/My-declare-warning-pointcut-generates-too-many-duplicate-warnings-how-to-fix-it-tp4174448p4174662.html
Sent from the AspectJ - users mailing list archive at Nabble.com.
_______________________________________________
aspectj-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/aspectj-users

Reply via email to