Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Bug? - Privileged aspect cannot access pointcutsoutside visible scope

I want to test which join points are captured by the pointcut by introducing  
some stub classes in a separate test package which contain join points that 
should be captured by the join point (and some join points that explicitly 
shouldn't), along with some custom advice that operates on the pointcut under 
test, and checks whether it executes on the expected join points. I can work 
around the restrictions so documenting the current semantics would be fine 
with me, but being into software testing I just like for things to work as 
documented.

cheers,
 - Gijs

On Wednesday 26 September 2007 18:42:23 Ron Bodkin wrote:
> It seems logically consistent that privileged aspects should be able to see
> pointcuts that aren't otherwise visible to them. I suspect allowing for
> that would be a nontrivial effort, so to me it would be better to document
> the current semantics rather than spending effort revising this. What's
> your use case for wanting this capability?
>
>
>
>   _____
>
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Gijs Peek
> Sent: Wednesday, September 26, 2007 8:52 AM
> To: aspectj-users@xxxxxxxxxxx
> Subject: [aspectj-users] Bug? - Privileged aspect cannot access
> pointcutsoutside visible scope
>
>
>
> Hi,
>
> I noticed that privileged aspects do not seem to be able to access
> pointcuts that lie outside of their visible scope, e.g. writing the
> following aspects:
>
> public aspect A {
>
> private pointcut p():call (* *(..));
>
> }
>
> public privileged aspect B {
>
> after():A.p() {
>
> doStuff();
>
> }
>
> }
>
> generates a compile error (using ajc 1.5.3):
>
> B.aj:2 [error] pointcut declaration pointcut A.p() is not accessible
>
> The semantics section in the AspectJ programming guide state that
>
> "A named pointcut may be defined in either a class or aspect, and is
> treated as a member of the class or aspect where it is found."
>
> and
>
> "Code in priviliged aspects has access to all members, even private ones."
> (The spelling error also occurs in the original)
>
> Which would lead to the conclusion that privileged aspects should also be
> able to access all pointcuts. Is this a bug?
>
> regards,
>
> - Gijs Peek


-- 
Play Rogue, visit exotic locations, meet strange creatures and kill them.

Attachment: signature.asc
Description: This is a digitally signed message part.


Back to the top