From: Chris H. <han...@gm...> - 2009-07-29 06:15:49
|
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 |