You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pivot.apache.org by "Alejandro Vilar (JIRA)" <ji...@apache.org> on 2010/04/21 11:48:50 UTC

[jira] Created: (PIVOT-476) Bug in equals method in ArrayList and LinkedList

Bug in equals method in ArrayList and LinkedList
------------------------------------------------

                 Key: PIVOT-476
                 URL: https://issues.apache.org/jira/browse/PIVOT-476
             Project: Pivot
          Issue Type: Bug
          Components: core-collections
    Affects Versions: 1.4
            Reporter: Alejandro Vilar
            Priority: Minor
             Fix For: 1.5


equals method in ArrayList and LinkedList always returns true when are compared with different class objects:

ArrayList list=new ArrayList();
list.equals("foo");   //returns true

Also when are compared with different List implementations (ignoring list's content)

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


[jira] Updated: (PIVOT-476) Bug in equals method in ArrayList and LinkedList

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

Alejandro Vilar updated PIVOT-476:
----------------------------------

    Attachment: ArrayList_equals.patch
                LinkedList_equals.patch

Attaching respective patches.

> Bug in equals method in ArrayList and LinkedList
> ------------------------------------------------
>
>                 Key: PIVOT-476
>                 URL: https://issues.apache.org/jira/browse/PIVOT-476
>             Project: Pivot
>          Issue Type: Bug
>          Components: core-collections
>    Affects Versions: 1.4
>            Reporter: Alejandro Vilar
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: ArrayList_equals.patch, LinkedList_equals.patch
>
>
> equals method in ArrayList and LinkedList always returns true when are compared with different class objects:
> ArrayList list=new ArrayList();
> list.equals("foo");   //returns true
> Also when are compared with different List implementations (ignoring list's content)

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


[jira] Resolved: (PIVOT-476) Bug in equals method in ArrayList and LinkedList

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

Greg Brown resolved PIVOT-476.
------------------------------

    Resolution: Fixed

Good catch. At first, I wasn't sure that changing the comparison to be type-agnostic was the right approach, but it seems like that's how the JDK List.equals() method works, so there's no reason not to be consistent.

Thanks.


> Bug in equals method in ArrayList and LinkedList
> ------------------------------------------------
>
>                 Key: PIVOT-476
>                 URL: https://issues.apache.org/jira/browse/PIVOT-476
>             Project: Pivot
>          Issue Type: Bug
>          Components: core-collections
>    Affects Versions: 1.4
>            Reporter: Alejandro Vilar
>            Priority: Minor
>             Fix For: 1.5
>
>         Attachments: ArrayList_equals.patch, LinkedList_equals.patch
>
>
> equals method in ArrayList and LinkedList always returns true when are compared with different class objects:
> ArrayList list=new ArrayList();
> list.equals("foo");   //returns true
> Also when are compared with different List implementations (ignoring list's content)

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