Jimmy,Jing Lv wrote:
>     According to Harmony-4603, there's a bug in LinkedHashMap.clone(),
> it seems RI omit something (in detail, checking removeEldestEntry() )
> while Harmony perform different. It can be fixed easily.
>     However I have another finding that, the Spec never asks
> LinkedHashMap(which extends HashMap) to override clone() but Harmony
> does, as HashMap.clone() copies entries in arrays while LinkedHashMap
> put them one by one : they appear different in behaviours.
>      Deeper look into the code, I find a way to avoid this redundant
> overriding and make Harmony exactly follow Spec. We can make a package
> method putImpl() (which already exsists in HashMap) which do some real
> work for put elements into maps, and override this putImpl in
> LinkedHashMap. In clone method we can invoke putImpl to do
> elements-copy(do different in HashMap and LinkedHashMap). In this way
> we can both fix Harmony-4603 and delete LinkedHashMap's redundant
> clone.
>      The refactor has passed testcases, I have a little concern about
> performance, it seems the older clone() in HashMap may have higher
> performance. I'll run benchmarks to determin and try to tuning if so.
>      If no objection and it still have high performance, I'll patch
> them together in Harmony-4603.

Sounds reasonable to me.  Go for the shared clone() implementation.

Regards,
Tim

Reply via email to