Request for review : 7121314 : Behavior mismatch between AbstractCollection.toArray(T[] ) and its spec (original) (raw)
Sean Chou zhouyx at linux.vnet.ibm.com
Fri Mar 23 06:45:51 UTC 2012
- Previous message: Request for review : 7121314 : Behavior mismatch between AbstractCollection.toArray(T[] ) and its spec
- Next message: Request for review : 7121314 : Behavior mismatch between AbstractCollection.toArray(T[] ) and its spec
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi Ulf,
I'm sorry I didn't quite get your testcase. Will you please provide a
jtreg style testcase with main method ?
I was thinking you were worried by the comment "// inherits from
AbstractCollection.toArray()" and "map2", if that was the case, I would like to modify.
On Fri, Mar 23, 2012 at 5:57 AM, Ulf Zibis <Ulf.Zibis at gmx.de> wrote:
Hi Sean,
bad news ;-) ... Am 22.03.2012 08:28, schrieb Sean Chou:
Hi Ulf,
I'm glad you agreed my suggestion. To all: Can this patch be committed as it has been reviewed by David Holmes and Mike Duigou, and Ulf also says agreed ? I agree with your implementation of AbstractCollection, but NOT with the test. For correct testing I suggest to use: /** * * @author Ulf Zibis */ public class TestCollection extends AbstractCollection { private E[] elements; private int[] sizes; private int nextSize; public TestCollection(E[] elements) { this.elements = elements; setConcurrentSizeCourse(null); } void setConcurrentSizeCourse(int... sizes) { this.sizes = sizes == null ? new int[]{elements.length} : sizes; nextSize = 0; } @Override public int size() { return sizes[nextSize == sizes.length-1 ? nextSize : nextSize++]; } @Override public Iterator iterator() { return new Iterator<>() { int pos = 0; public boolean hasNext() { return pos < sizes[nextSize]; } public E next() { return elements[pos++]; } public void remove() { throw new UnsupportedOperationException(**"Not supported yet."); } }; } } -Ulf
-- Best Regards, Sean Chou
- Previous message: Request for review : 7121314 : Behavior mismatch between AbstractCollection.toArray(T[] ) and its spec
- Next message: Request for review : 7121314 : Behavior mismatch between AbstractCollection.toArray(T[] ) and its spec
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]