Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Advice on Constructors With Subclasses

On Thu, Sep 4, 2008 at 8:37 AM, Simone Gianni <simoneg@xxxxxxxxxx> wrote:
> Hi all,
> I also stumbled upon this problem. In fact, I think AspectJ is missing
> something here. There should be a way to say after "the object has been
> completely initialized".

This is what after() : ( does.

> That is because I might want to advice the
> constructor of an abstract class and call abstract methods, which will
> probably fail if the advice is executed after the abstract class
> constructor instead of after the concrete class constructor. Using the
> call instead of execution is a solution,


> but limited to the situation
> where the aspects are consistently applied, which could not be the case
> if I'm programming my own jar using AOP but then using it in a
> non-aspectj system. In fact, using "execution", AspectJ will add the
> code to my own classes, while using call requires the client code of my
> library to be weaved.

Another possibility might be initialization joinpoints.  It's not
exactly the same, but might be what you want in this situation.

> Simone
> Andrew Eisenberg wrote:
>> Actually, it is the "call", not the "returning" that made it work.
>> Should probably work with or without the "returning" clause.
>> In AspectJ, super calls are not considered "calls" and so are not
>> matched by the call designator, but the method bodies are executed,
>> hence they *are* matched by the execution designator.
>> On Tue, Sep 2, 2008 at 8:25 PM, James Elliott <jvelliott@xxxxxxxxx> wrote:
>>> Thanks a lot. Guess I never tried the "returning" keyword.
>>> Much appreciated.
>>> _______________________________________________
>>> aspectj-users mailing list
>>> aspectj-users@xxxxxxxxxxx
>> _______________________________________________
>> aspectj-users mailing list
>> aspectj-users@xxxxxxxxxxx
> --
> Simone Gianni
> CEO Semeru s.r.l.
> Apache Committer
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx

Back to the top