You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Paulex Yang (JIRA)" <ji...@apache.org> on 2007/05/15 08:47:16 UTC
[jira] Assigned: (HARMONY-3865) [classlib][luni] AbstractMap seems
to have a flawed equals method
[ https://issues.apache.org/jira/browse/HARMONY-3865?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Paulex Yang reassigned HARMONY-3865:
------------------------------------
Assignee: Paulex Yang
> [classlib][luni] AbstractMap seems to have a flawed equals method
> -----------------------------------------------------------------
>
> Key: HARMONY-3865
> URL: https://issues.apache.org/jira/browse/HARMONY-3865
> Project: Harmony
> Issue Type: Bug
> Components: Classlib
> Reporter: spark shen
> Assigned To: Paulex Yang
> Attachments: AbstractMap.patch
>
>
> The following test case will fail on Harmony, but pass on RI
> public class AMT extends AbstractMap {
> // Very crude AbstractMap implementation
> Vector values = new Vector();
> Vector keys = new Vector();
> public Set entrySet() {
> return new AbstractSet() {
> public Iterator iterator() {
> return new Iterator() {
> int index = 0;
> public boolean hasNext() {
> return index < values.size();
> }
> public Object next() {
> if (index < values.size()) {
> Map.Entry me = new Map.Entry() {
> Object v = values.elementAt(index);
> Object k = keys.elementAt(index);
> public Object getKey() {
> return k;
> }
> public Object getValue() {
> return v;
> }
> public Object setValue(Object value) {
> return null;
> }
> };
> index++;
> return me;
> }
> return null;
> }
> public void remove() {
> }
> };
> }
> public int size() {
> return values.size();
> }
> };
> }
> public Object put(Object k, Object v) {
> keys.add(k);
> values.add(v);
> return v;
> }
> }
>
> /**
> * @tests {@link java.util.AbstractMap#putAll(Map)}
> */
> public void test_putAllLMap() {
> Hashtable ht = new Hashtable();
> AMT amt = new AMT();
> ht.put("this", "that");
> amt.putAll(ht);
> amt.equals(ht);
> assertEquals("Should be equal", amt, ht);
> }
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.