Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Is there any particular order in ITD?

Hello there,

I was wondering if there is any particular order when different aspects inject annotations in particular constructors and methods or if there are possible conflicts when more than one aspect perform injection of annotations, when that injection depends on the existence or absence of another annotation. Something like "declare foo() as @AccessControlled if foo() is not already @AccessControlled nor @NotAccessControlled".

I am facing a strange behaviour which, unfortunately, I wasn't able to replicate in a small example... Anyway, I will try to explain the idea:

I have two projects: one project base, where I have a few generic aspects deployed in a jar file which is used in another concrete project.

In "base", I have an abstract aspect with the following declaration:

public abstract aspect AccessController<CurrentPrincipal> implements IAccessController<CurrentPrincipal>, IAccessControllerForQuerying, IAccessControllerForModifying {

  ...

    declare @constructor :
!@AccessControlled !@NotAccessControlled !private (@AccessControlled *..*.*+).new(..) :
        @AccessControlled(inherited = true);

  ...

}

In "concrete", we have the aspect that extends and thus enables the aspect AccessController:

public aspect Concrete extends AccessController<User> {

  ...

}

Then, I create an aspect that injects annotations on my code, such as:

public aspect AccessControlRequirementsDeclarator {

    declare @type :
        pt.iscte.ciiscte.heliopolis.business.manager.AnnouncementManager :
            @AccessControlled("manage_news");

    declare @type :
        pt.iscte.ciiscte.heliopolis.business.manager.PersonManager :
            @AccessControlled("manage_people");

}

The previous works fine. However, if I try to add @NotAccessControlled annotations before those definitions, such as,

...

declare @constructor :
    public pt.iscte.ciiscte.heliopolis.business.manager.*.new(..) :
        @NotAccessControlled;

...

the result gets different each time I compile the application. E.g., I created a custom message handler that counts all distinct affected join points by AccessController, and the number of advised join points gets different with each compilation (in my case, I had 41 and 35 different advised join points). Moreover, using reflection, I have realized that sometimes, my methods have both annotations. Does this means that the aspect Concrete was processed before? Still, I tried another definition for the not access controlled points, like:

declare @constructor :
!@NotAccessControlled !@AccessControlled public pt.iscte.ciiscte.heliopolis.business.manager.*.new(..) :
        @NotAccessControlled;

but I had the same strange problems. Finally, something that also sounds really strange is that the number or declare @xxxx seems to have effect on the weaving result. Any ideas about what this might be? (I have the latest stable version of the AspectJ compiler - AspectJ 1.5.3, November 23, 2006, in http://www.eclipse.org/ajdt/downloads/).

Thank you all for your interest.

By the way, happy new year to you all.

Paulo Zenida

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




Back to the top