harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jimmy, Jing Lv (JIRA)" <j...@apache.org>
Subject [jira] Updated: (HARMONY-4603) [classlib][util] LinkedHashMap.clone() has problem when override the removeEldestEntry method
Date Thu, 09 Aug 2007 09:57:43 GMT

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

Jimmy, Jing Lv updated HARMONY-4603:
------------------------------------

    Attachment: Harmony4603.diff

> [classlib][util] LinkedHashMap.clone() has problem when override the removeEldestEntry
method
> ---------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-4603
>                 URL: https://issues.apache.org/jira/browse/HARMONY-4603
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Sean Qiu
>            Assignee: Leo Li
>         Attachments: Harmony4603.diff
>
>
>  LinkedHashMap.clone() has problem when override the removeEldestEntry method
> ===== Test =====
> public class LinkedHashMapTest extends TestCase {
>     public void test_clone() {
>         LinkedHashMap hashMap = new MockMap();
>         String value = "value a";
>         hashMap.put("key", value);
>         MockMap cloneMap = (MockMap) hashMap.clone();
>         assertEquals(value, cloneMap.get("key"));
>         assertEquals(hashMap, cloneMap);
>         assertEquals(1, cloneMap.num);
>         hashMap.put("key", "value b");
>         assertFalse(hashMap.equals(cloneMap));
>     }
>     class MockMap extends LinkedHashMap {
>         int num;
>         public Object put(Object k, Object v) {
>             num++;
>             return super.put(k, v);
>         }
>         protected boolean removeEldestEntry(Map.Entry e) {
>             return num > 1;
>         }
>     }
> }
> === Result ===
> RI:           Pass
> Harmy:   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