RFR 8206123 : ArrayDeque created with default constructor can only hold 15 elements

Ivan Gerasimov ivan.gerasimov at oracle.com
Wed Jul 4 04:31:20 UTC 2018


Hi Martin!

Why did you exclude the case of zero initial capacity?
   96         int initialCapacity = rnd.nextInt(1, 20);

I think it may make sense to have "static final EMPTY_DEQUE = 
ArrayDeque(0);" somewhere, and we may want to make sure it doesn't 
allocate more memory than needed?

It's perfectly fine to have this test:
  149         assertTrue((head == tail) ^ (elements[head] != null));

though I would find it a bit easier to read if it were written as
          assertEquals(head == tail, elements[head] == null);

It's a matter of style, of course.

With kind regards,
Ivan

On 7/3/18 3:15 PM, Martin Buchholz wrote:
> OK, this thread is officially upgraded to a RFR.
>
> http://cr.openjdk.java.net/~martin/webrevs/jdk/jsr166-integration/ArrayDeque-capacity/index.html 
> <http://cr.openjdk.java.net/%7Emartin/webrevs/jdk/jsr166-integration/ArrayDeque-capacity/index.html>
>
> On Tue, Jul 3, 2018 at 11:04 AM, Paul Sandoz <paul.sandoz at oracle.com 
> <mailto:paul.sandoz at oracle.com>> wrote:
>
>
>
>>     On Jul 3, 2018, at 10:42 AM, Martin Buchholz <martinrb at google.com
>>     <mailto:martinrb at google.com>> wrote:
>>
>>
>>     On Tue, Jul 3, 2018 at 9:53 AM, Paul Sandoz
>>     <paul.sandoz at oracle.com <mailto:paul.sandoz at oracle.com>> wrote:
>>
>>         Looks good. Where do you propose to place the test in the
>>         OpenJDK repo?
>>
>>
>>
>>     http://cr.openjdk.java.net/~martin/webrevs/jdk/jsr166-integration/overview.html
>>     <http://cr.openjdk.java.net/%7Emartin/webrevs/jdk/jsr166-integration/overview.html>
>>
>>     I hadn't gotten around to a RFR - the test is slightly modified
>>     from my initial post.
>
>     Ok, i see more thorough assertions in the assertInvariants method.
>
>     Thanks,
>     Paul.
>
>

-- 
With kind regards,
Ivan Gerasimov



More information about the core-libs-dev mailing list