Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] Intertype declarations and precedence

> Tha programming guide is not very thorough on this topic,

If there's any semantic rule or behavior not in the programming guide, 
please let us know.

Access modifiers on inter-type declarations apply relative to the aspect, so

  aspect A {
    private void Foo.bar() {}
  }

is private in (and only visible to) aspect A, not Foo.  Two declarations
not visible to each other do not conflict.

Basically, the answer is that precedence can resolve conflicts, but
the private-private case does not present a conflict.

Wes

> ------------Original Message------------
> From: "Jon S. Baekken" <jbaekken@xxxxxxxxxxxx>
> To: "'Wes Isberg'" <wes@xxxxxxxxxxxxxx>, aspectj-users@xxxxxxxxxxx
> Date: Mon, Mar-20-2006 12:17 PM
> Subject: RE: [aspectj-users] Intertype declarations and precedence
>
> Tha programming guide is not very thorough on this topic, but after my 
> own
> experimentation (with AspectJ 1.5)it seems like:
> 
> - if two aspects introduce the same member, and both are private, each
> aspect will use its declared member, regardeless of the declared 
> precedence
> 
> - if two aspects introduce the same member, one of which is private and 
> one
> of which is public, the aspect with the public declaration must have
> precedence for the progrma to compile
> 
> - if two aspects introduce the same member, both of which are public, 
> the
> one with precedence will be used in all contexts
> 
> But as I understand Laddad's example, precedence will have an effect 
> even
> when both aspects introduce private members. I.e. we get the same 
> result as
> if both members were public.
> 
> Jon
> 
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Wes Isberg
> Sent: Sunday, March 19, 2006 8:09 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] Intertype declarations and precedence
> 
> 
> Conflicts are discussed in the AspectJ Programming Guide, semantics
> appendix:
> 
>  
> file:///c:/home/wes/dev/tools/aspectj-1.5/doc/progguide/printable.html#confl
> icts
> 
> As you suggest, it says members not visible don't conflict.
> 
> Does that help?  Is the current compiler behaving otherwise?
> 
> Thanks - 
> Wes
> 
> > ------------Original Message------------
> > From: "Jon S. Baekken" <jbaekken@xxxxxxxxxxxx>
> > To: aspectj-users@xxxxxxxxxxx
> > Date: Sun, Mar-19-2006 7:50 PM
> > Subject: [aspectj-users] Intertype declarations and precedence
> >
> > Everyone,
> > 
> > In "AspectJ in Action", p. 120-122, Laddad discusses aspect 
> precedence
> > and
> > member introductions, saying that if two aspects introduce the same 
> > member,
> > only the one from the dominating aspect will survive. However, I 
> can't 
> > see
> > how this is right, because as far as I know,
> > 
> > - unless the member is declared private in all places, the program
> > won't
> > compile, 
> > - when a member is declared private, it's only visible from inside 
> that
> > aspect, and
> > - each aspect will just use its own private declaration.
> > 
> > In the example in the book, SecurityAspect has precedence over 
> > TrackingAspect, but changing the precedence to the opposite has no 
> > effect. SecurityAspect is still just using its own declarations.
> > 
> > So, is Laddad incorrect here, has this changed from the AspectJ 
> > version
> > he
> > used, or am I just not getting the point?
> > 
> > Jon
> > 
> > http://www.eecs.wsu.edu/~jbaekken/
> > 
> > 
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx 
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> > 
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 
> 
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
> 



Back to the top