commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 30855] - [lang] Additional constructor for EqualsBuilder and isEquals member access.
Date Wed, 20 Oct 2004 23:27:54 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=30855>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=30855

[lang] Additional constructor for EqualsBuilder and isEquals member access.





------- Additional Comments From ari1meyer@yahoo.com  2004-10-20 23:27 -------
I agree with Gary.  Again, this is a simple addition.  Also, the client 
currently does not only have to write:

 if (this == other) {
   return true;
 }
 return new EqualsBuilder().append(.......


in fact, they have to write:

if (comparisonObject == thisObject)
{
	return true;
}
else if ((comparisonObject == null) ||
	(comparisonObject.getClass() != thisObject.getClass())
{
	return false;
}

return new EqualsBuilder().append(.......

This leaves a lot of room for error, and it's definitely required code for 
properly implementing equals().  As mentioned earlier, doing the previously 
recommended "instanceof" comparison is incorrect, but unfortunately, most 
developers continue to use this technique.  By providing this alternative 
implementation, you would eliminate such errors.

Regards,
Ari

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message