harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kevin Zhou (JIRA)" <j...@apache.org>
Subject [jira] Closed: (HARMONY-6141) [classlib][luni] java.util.ArrayList.addAll(int index, Collection<? extends E> c) fails to add itself
Date Thu, 07 May 2009 03:42:31 GMT

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

Kevin Zhou closed HARMONY-6141.
-------------------------------


Thanks, Tim. I'm OK with your new patch. It makes the code simpler and efficient.

> [classlib][luni] java.util.ArrayList.addAll(int index, Collection<? extends E>
c) fails to add itself
> -----------------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-6141
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6141
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>    Affects Versions: 5.0M8
>            Reporter: Kevin Zhou
>             Fix For: 5.0M10
>
>         Attachments: HARMONY-6141.diff
>
>
> Given a test case [1], both of these two scenarios are used to test java.util.ArrayList.addAll(int
index, Collection<? extends E> c) method.
> For scenario1, initialize two array list "arrayListA" and "arrayListB", add 1 to them
respectively; then invoke arrayListA.addAll(arrayListB); finally "arrayListA" should be like
[1, 1]
> For scenario2, initialize an array list "arrayList", add one element to it; then try
to add itself in the position of 1; finally "arrayList" should look like [1, 1] as well.
> Conduct this test scenarios on RI and HY, RI passes all while HY fails on the 2nd scenario.
> [1] Test Case:
> public void test_ArrayList_addAll_scenario1() {
>     ArrayList arrayListA = new ArrayList();
>     arrayListA.add(1);
>     ArrayList arrayListB = new ArrayList();
>     arrayListB.add(1);
>     arrayListA.addAll(1, arrayListB);
>     int size = arrayListA.size();
>     assertEquals(2, size);
>     for (int index = 0; index < size; index++) {
>         assertEquals(1, arrayListA.get(index));
>     }
> }
> public void test_ArrayList_addAll_scenario2() {
>     ArrayList arrayList = new ArrayList();
>     arrayList.add(1);
>     arrayList.addAll(1, arrayList);
>     int size = arrayList.size();
>     assertEquals(2, size);
>     for (int index = 0; index < size; index++) {
>         assertEquals(1, arrayList.get(index));
>     }
> }

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