You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2010/07/01 11:53:49 UTC

[jira] Created: (LANG-630) mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
-----------------------------------------------------------------------------------------

                 Key: LANG-630
                 URL: https://issues.apache.org/jira/browse/LANG-630
             Project: Commons Lang
          Issue Type: Bug
            Reporter: Sebb
             Fix For: 3.0


FIndbugs:

mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

This class defines a covariant version of the equals() method, but inherits the normal equals(Object) method defined in the base java.lang.Object class.  The class should probably define a boolean equals(Object) method. 


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


[jira] Commented: (LANG-630) mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

Posted by "Sean Mickey (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LANG-630?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884945#action_12884945 ] 

Sean Mickey commented on LANG-630:
----------------------------------

It seems like the best option is replacing the equals(MutableObject) with equals(Object). It simplifies the code, refactors  to what most developers expect, and the minor overhead associated calling intanceof is worth the improvement in the code.

The equality check is very simple and the hashCode operation will not have to change. Just making sure I'm not missing something before I give this a go.

> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> -----------------------------------------------------------------------------------------
>
>                 Key: LANG-630
>                 URL: https://issues.apache.org/jira/browse/LANG-630
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 3.0
>
>
> FIndbugs:
> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> This class defines a covariant version of the equals() method, but inherits the normal equals(Object) method defined in the base java.lang.Object class.  The class should probably define a boolean equals(Object) method. 

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


[jira] Updated: (LANG-630) mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

Posted by "Sean Mickey (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sean Mickey updated LANG-630:
-----------------------------

    Attachment: MutableObject-equals.txt

The attached patch file addresses this bug. MutableObject.equals(MutableObject) has been refactored to MutableObject.equals(Object). There are also some minor javadoc cleanups and a little more javadoc information has been added.

No changes to MutableObject.hashCode were necessary.

MutableObjectTest.java verifies that equals continues to work correctly and also that hashCode continues to work correctly. All unit tests ran successfully.

> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> -----------------------------------------------------------------------------------------
>
>                 Key: LANG-630
>                 URL: https://issues.apache.org/jira/browse/LANG-630
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 3.0
>
>         Attachments: MutableObject-equals.txt
>
>
> FIndbugs:
> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> This class defines a covariant version of the equals() method, but inherits the normal equals(Object) method defined in the base java.lang.Object class.  The class should probably define a boolean equals(Object) method. 

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


[jira] Closed: (LANG-630) mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LANG-630?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell closed LANG-630.
------------------------------

    Resolution: Fixed

Thanks Sean.

svn ci -m "Applying Sean Mickey's patch to LANG-630 such that MutableObject.equals is as would be expected. Now it directly overrides the equals(Object) method. " src/main/java/org/apache/commons/lang3/mutable/
Sending        src/main/java/org/apache/commons/lang3/mutable/MutableObject.java
Transmitting file data .
Committed revision 965162.


> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> -----------------------------------------------------------------------------------------
>
>                 Key: LANG-630
>                 URL: https://issues.apache.org/jira/browse/LANG-630
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>             Fix For: 3.0
>
>         Attachments: MutableObject-equals.txt
>
>
> FIndbugs:
> mutable.MutableObject defines equals(MutableObject) method and uses Object.equals(Object)
> This class defines a covariant version of the equals() method, but inherits the normal equals(Object) method defined in the base java.lang.Object class.  The class should probably define a boolean equals(Object) method. 

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