Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Beware abstract classes of declare parents

There are no stupid questions! ;)

This issue of qualifying types came up recently in another context (http://dev.eclipse.org/mhonarc/lists/aspectj-users/msg04561.html). I could use it myself. Currently, AJ doesn't support it although there is an enhancement request for it.

As discussed in Adrian's message in the link above, the best you can do is some sort of runtime test.

However, if you follow a naming convention for your abstract classes, e.g., something like "FooHelper" or "AbstractFoo", then you could write

public aspect A {
       declare parents:
       (foo.x.y..Abstract*) implements Finalize;
}

dean


Bjoern Seebeck wrote:
Hi!

I´m relatively new to AOP and AspectJ, so please excuse me, if question
is too stupid...

Following Problem:
I want to do static crosscutting for all classes in a package.
More specific, I want all the classes to implement an interface
named Finalize which declares the finalize method to do something
at the end of object livetime.

For this I coded following aspect:

public aspect A {
       declare parents:
       (foo.x.y..*) implements Finalize;
}

Now, I don´t want to introduce this implementation to abstract classes.
Is there a way to make this declaring? I thought of something
like this, but (of course) it does not work:

public aspect A {
       declare parents:
       (foo.x.y..*) &&
       (!abstract foo.x.y..*) implements Finalize;
}

Regardz,
Bjoern
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

--
Dean Wampler, Ph.D.
dean at aspectprogramming.com
http://www.aspectprogramming.com
http://www.contract4j.org
I want my tombstone to say:
   Unknown Application Error in Dean Wampler.exe.
   Application Terminated.
   [Okay]    [Cancel]


Back to the top