You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Samisa Abeysinghe (JIRA)" <ji...@apache.org> on 2010/12/19 06:55:01 UTC

[jira] Commented: (AXIS2-3386) i ran findbugs over the cobra's source code and its suggest that Class defines equals() and uses Object.hashCode()

    [ https://issues.apache.org/jira/browse/AXIS2-3386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12972920#action_12972920 ] 

Samisa Abeysinghe commented on AXIS2-3386:
------------------------------------------

But that is a hack isn't it?

> i ran findbugs over the cobra's source code and its suggest that Class defines equals() and uses Object.hashCode()
> ------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-3386
>                 URL: https://issues.apache.org/jira/browse/AXIS2-3386
>             Project: Axis2
>          Issue Type: Bug
>    Affects Versions: nightly
>         Environment: WindowsXP, eclispe
>            Reporter: Jihad Abdul-Latif
>         Attachments: screenshot-1.jpg
>
>
> i ran findbugs over the cobra's source code and 
> here is the bug message
> Class defines equals() and uses Object.hashCode()</b><br/><p> This class overrides <code>equals(Object)</code>, but does not  override <code>hashCode()</code>, and inherits the implementation of
>   <code>hashCode()</code> from <code>java.lang.Object</code> (which returns
>   the identity hash code, an arbitrary value assigned to the object
>   by the VM).&nbsp; Therefore, the class is very likely to violate the
>   invariant that equal objects must have equal hashcodes.
> and here is the fix
> public int hashCode() {
>       assert false : "hashCode not designed";
>       return 42; // any arbitrary constant will do 
>       }

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


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