Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] declare parents with super/sub classes

You can get the type and its immediate subtypes this way:

interface Marker {}
private interface Marker2 extends Marker {}
...

declare parents: baseType implements Marker;
declare parents: !baseType && baseType+ implements Marker2;

However, I don't think it's possible to pick out the subsubtype of baseType
in this way.

However, I would think what you really want to do is to weave into
components separately, so that you ensure any subtype implements the marker,
regardless of whether the base type is woven. Would it work to break up the
build into multiple steps like this? I.e., why do you actually need each
class to explicitly implement the interface?


-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx
[mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Jennifer Baldwin
Sent: Tuesday, April 11, 2006 1:40 PM
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] declare parents with super/sub classes

Hi Ron,

Unforunately I need the superclass to implement the marker as well.
And if I just write that line in the superclass and try to use this
aspect to do the subtypes, ajc still won't weave into them. I was
hoping there might be a lazy option or something :-) And the subtype
option only seems to work on direct children and not down the tree
which will be an issue as well since I'm trying to do this to ~150
files and so the hierarchy is somewhat complicated.

If you can think of any other ideas, I'd love to hear them.

Thanks again,
Jennifer



On 4/11/06, Ron Bodkin <rbodkin@xxxxxxxxxxxxxx> wrote:
> Hi Jennifer,
>
> What happens if you use this idiom to make subclasses of SomeType
implement
> marker? I've used this before in cases where I didn't control SomeType but
> wanted all subtypes to implement a marker...
>
> declare parents: (SomeType+ && !SomeType) implements Marker;
>
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Jennifer Baldwin
> Sent: Tuesday, April 11, 2006 1:02 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: [aspectj-users] declare parents with super/sub classes
>
> Hi,
>
> I want to use declare parents to implement an empty interface for both
> a subclass AND a super class. AJC will only do it for the superclass
> in everything I've tried. I know that this makes sense since the
> subclass will inherit the implementation. But for the example I'm
> working on, which is implementing of distribution on a JVM, I need it
> to be able to do this. Does anybody have any ideas on how to force it
> to work?
>
> Thanks,
> Jennifer
> _______________________________________________
> 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