harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sean Qiu (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-4750) [classlib][luni] HashMap.HashMapEntrySet.contains(Object) cannot find custmized entry without override the equal method
Date Thu, 06 Sep 2007 04:55:33 GMT

     [ https://issues.apache.org/jira/browse/HARMONY-4750?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Sean Qiu updated HARMONY-4750:
------------------------------

    Attachment: Harmony-4750.pl

Could somebody try this patch? Thanks

> [classlib][luni] HashMap.HashMapEntrySet.contains(Object) cannot find custmized entry
without override the equal method
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4750
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4750
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Sean Qiu
>         Attachments: Harmony-4750.pl
>
>
> Description:
> HashMap.HashMapEntrySet.contains(Object) cannot find custmized entry if the entry hasn't
 override the equal method.
> Testcase:
>     @SuppressWarnings("unchecked")
>     public void test_EntrySet(){
>         HashMap map = new HashMap();
>         map.put(new Integer(1), "ONE");
>         
>         Set entrySet = map.entrySet();
>         Iterator e = entrySet.iterator();
>         Object a = e.next();
>         assertFalse(e.hasNext());
>         
>         Map.Entry entry = new MockEntry();
>         assertTrue(entrySet.contains(entry));
>         entrySet.remove(entry);
>         assertFalse(entrySet.contains(entry));
>     }
>     
>     private static class MockEntry implements Map.Entry{
>         public Object getKey() {
>             return new Integer(1);
>         }
>         public Object getValue() {
>             return "ONE";
>         }
>         public Object setValue(Object object) {
>             return null;
>         }
>     }
> Result:
> RI can pass this test while harmony will fail.

-- 
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