Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Adding a field to a direct subclass only...

>     I want to add the field only on direct subclasses of java.lang.Object to
> avoid the problem of having instance field in subclasses that 'hiddes' the
> value defined in the super class...   This can be problematic if a variable
> refers to different subclasses, and therefore update the wrong counter...  ,
> i.e. my counter is not dependent of the type, but simply per object...
>
>   I had such a problem if the field is added in all direct and indirect
> subclasses..

Oh, I think I misunderstood your problem in the first mail.

However, did you actually check that ajc creates multiple fields, i.e.
one per subclass? If so, I think that this should be a bug. Form the
semantics you say that all these subclasses implement *one* interface
and that *this single* interface has *one* field "aField". So my
impression was always that ajc would weave the field into the topmost
matched class only and that all subclass would then "see" this field
automatically through inheritance. Maybe I am mistaken but I don't see
why another semantics would make sense.

Eric
-- 
Eric Bodden
Sable Research Group
McGill University, Montréal, Canada


Back to the top