commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christoph Kutzinski (JIRA)" <j...@apache.org>
Subject [jira] Commented: (LANG-353) Javadoc Example for EqualsBuilder is questionable
Date Thu, 11 Oct 2007 07:44:50 GMT

    [ https://issues.apache.org/jira/browse/LANG-353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12533977
] 

Christoph Kutzinski commented on LANG-353:
------------------------------------------

Without knowing the details again (I don't know which kind of applications you are thinking
of): I think if you trying to compare enums from different classloader, that's already the
problem you have. I.e. you shouldn't try this as it usually indicates that you have mixed
up your classloader hierarchy. So it's better for the enum's equal to fail fast instead of
allowing something which shouldn't be done.

But this discussion doesn't really belong here. If you would like to continue it, you can
contact me via e-mail: kutzi@gmx.de

> Javadoc Example for EqualsBuilder is questionable
> -------------------------------------------------
>
>                 Key: LANG-353
>                 URL: https://issues.apache.org/jira/browse/LANG-353
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Christoph Kutzinski
>            Priority: Minor
>             Fix For: 2.4
>
>
> The Javadoc example for the class EqualsBuilder ist questionable:
>  public boolean equals(Object obj) {
>    if (obj instanceof MyClass == false) {
>      return false;
>    }
>   ...
> The implementation with instanceof lacks guarantees like equals-symmetry  (see e.g. http://www.agiledeveloper.com/articles/equals062002.htm
 for a discussion of the issue)
> The example should be changed to use getClass(). Attention: the solution in the link
above is incomplete as it doesn't check for null

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message