On 11/03/2011 09:42 AM, Vincent Massol wrote:
Hi devs,
WDYT about standardizing on Commons Lang3 HashCodeBuilder and EqualsBuilder for hashcode/equals implementation?
http://commons.apache.org/lang/api/org/apache/commons/lang3/builder/HashCode... http://commons.apache.org/lang/api/org/apache/commons/lang3/builder/EqualsBu...
So far I've used manual code from http://www.technofundo.com/tech/java/equalhash.html but I think standardizing on Commons Lang is better for the following reasons: * a lot of less code to write * less prone to exploding cyclomatic complexity and thus checkstyle erros
There might be some extreme cases where we don't want to add a new dependency (like for some libraries potentially) but these should be exceptions.
If we agree I'll document it on dev.xwiki.org in the best practice section.
What exactly will you propose, chaining addX calls or reflectionHashCode/reflectionEquals? -- Sergiu Dumitriu http://purl.org/net/sergiu/