You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "spark shen (JIRA)" <ji...@apache.org> on 2007/05/15 08:06:16 UTC

[jira] Created: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

[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


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.


[jira] Closed: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

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

spark shen closed HARMONY-3865.
-------------------------------


Verified at r540423.

> [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.new.patch, 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.


[jira] Assigned: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

Posted by "Paulex Yang (JIRA)" <ji...@apache.org>.
     [ 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.


[jira] Resolved: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

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

Paulex Yang resolved HARMONY-3865.
----------------------------------

    Resolution: Fixed

Spark, patch applied at r538576, thanks a lot, please verify.

> [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.new.patch, 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.


[jira] Updated: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

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

spark shen updated HARMONY-3865:
--------------------------------

    Attachment: AbstractMap.patch

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


[jira] Reopened: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

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

Paulex Yang reopened HARMONY-3865:
----------------------------------


Reverted at r538398,  the patch caused archive module failure at Linux: 

Error log:
1) test_ConstructorLjava_util_jar_Attributes
junit.framework.AssertionFailedError: equal at
org.apache.harmony.archive.tests.java.util.jar.AttributesTest.test_ConstructorLjava_util_jar_Attributes(AttributesTest.java:48)
at java.lang.reflect.VMReflection.invokeMethod

2) test_clone
junit.framework.AssertionFailedError: equal at
org.apache.harmony.archive.tests.java.util.jar.AttributesTest.test_clone(AttributesTest.java:226)
at java.lang.reflect.VMReflection.invokeMethod(VMReflection.java)



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


[jira] Updated: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

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

spark shen updated HARMONY-3865:
--------------------------------

    Attachment: AbstractMap.new.patch

Would you please try this patch.

> [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.new.patch, 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.


[jira] Updated: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

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

spark shen updated HARMONY-3865:
--------------------------------

    Attachment:     (was: AbstractMap.patch)

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


[jira] Updated: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

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

spark shen updated HARMONY-3865:
--------------------------------

    Attachment: AbstractMap.patch

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


[jira] Resolved: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

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

Paulex Yang resolved HARMONY-3865.
----------------------------------

    Resolution: Fixed

Spark, patch applied at r538071, thanks a lot, please verify.

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


[jira] Updated: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

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

spark shen updated HARMONY-3865:
--------------------------------

    Attachment:     (was: AbstractMap.patch)

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


[jira] Updated: (HARMONY-3865) [classlib][luni] AbstractMap seems to have a flawed equals method

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

Tony Wu updated HARMONY-3865:
-----------------------------

    Attachment: AbstractMap.patch

Would you please try this patch.

> [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, 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.