On Nov 4, 2011, at 4:58 AM, Sergiu Dumitriu wrote:
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/HashCod…
http://commons.apache.org/lang/api/org/apache/commons/lang3/builder/EqualsB…
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?
Definitely not the reflection one, since it imposes limitations with security managers
and has some other potential issues.