[xwiki-devs] [Proposal] Standardize on Commons Lang3 HashCodeBuilder and EqualsBuilder for hashcode/equals implementation
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. Thanks -Vincent
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/
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/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?
Definitely not the reflection one, since it imposes limitations with security managers and has some other potential issues. Thanks -Vincent
On 11/04/2011 05:14 AM, Vincent Massol wrote:
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/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?
Definitely not the reflection one, since it imposes limitations with security managers and has some other potential issues.
Then +1 for this. -- Sergiu Dumitriu http://purl.org/net/sergiu/
participants (2)
-
Sergiu Dumitriu -
Vincent Massol