On Wed, Nov 03, 2010 at 08:44:41AM +0100, Jeremias Maerki wrote: > On 01.11.2010 21:29:14 Vincent Hennebert wrote: > > > More importantly, I keep thinking that there’s a design flaw in > > ColorWithAlternatives. Its equals method breaks the contract defined on > > Object.equals since it’s not symmetric. This is bound to cause > > hard-to-track issues in client code. Also, the way equals is implemented > > will make it systematically return false if an instance of > > ColorWithAlternatives is being compared with an instance of a sub-class, > > which may not be the desirable result. > > > > Either ColorWithAlternatives is not a Color and therefore should not > > extend the Color class; or its equals method should be changed to follow > > the contract and the comparison of ColorWithAlternatives instances > > should be implemented differently. > > Haven't I already brought this up and documented on the Wiki? > http://wiki.apache.org/xmlgraphics/ColorHandling > > I guess I'll have to revisit the decisions from back then if two people > are not happy with the current approach.
Indeed, you did. Sorry for missing that. Partly inspired by the recent discussion about findbugs, I would prefer avoiding violations of OO contracts. Simon --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
