[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] My declare warning pointcut generates too many duplicate warnings, how to fix it?
|
- From: Andy Clement <andrew.clement@xxxxxxxxx>
- Date: Thu, 8 Dec 2011 14:38:15 -0800
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=fSEYcrQk8hkQ00UkG1IrAVswuRVk3embLukAdlJxmrc=; b=RsZi+k0Z4Uz12q+yIzdW2Q9+qs6w8ePeFLUnDpnzW2jJvpde9vvZZ28y0IkBSFq0XW jXDVE4K1OOF3UvQA+s9GPDKaMhLPdPzwVukS24BT1+KkiLZDYrlFA9nDqtTnSS6HFouq bhezjzVF21yTCf+SuylVipCS3C94uHubg+viI=
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 <mark.kharitonov@xxxxxxxxx> 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
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users