Spoke with Ian offline and we came to the conclusion that the only
problem with how inheritance works right now is the one case
mentioned: when @Property accessors are
overridden. So the easy answer is to prevent duplicates in that case
instead of introducing a bunch of extra complexity. ;)
-Chris
On Wed, Jul 29, 2009 at 12:15 AM, Chris Hansen<han...@gm...> wrote:
> I've always thought the way properties are handled with regard to
> inheritance is a bit clunky. Right now, a class has no choice but to
> inherit all properties from all superclasses, leading to duplicate
> properties in some cases (e.g. when @Property accessors are
> overridden). The following ideas are inspired by {@inheritDoc}.
>
> One possible alternative would be that properties are never inherited
> unless explicitly requested via a class-level @InheritProperties
> annotation. That would give the author of any given class full control
> over the properties, but it would mean that inherited hashCode(),
> equals(Object), and toString() methods would behave
> counter-intuitively by default (i.e. without this annotation).
>
> Another alternative, which seems more promising, would be that
> properties are inherited by default (as now), but there would be some
> way to "switch off" property inheritance (e.g.
> @AutoProperty(inheritance=None) or @DoNotInheritProperties on the
> class). Subclasses would still have a reasonable default behavior with
> the extra control.
>
> Thoughts?
>
> -Chris
>
|