RFR: 8079136: Accessing a nested sublist leads to StackOverflowError

Tagir F. Valeev amaembo at gmail.com
Wed Mar 30 09:03:55 UTC 2016


Hello!

IG> After the fix for JDK-8148748 went in, I needed to rebase the fix.
IG> Comparing to the previous webrev, the changes are local to 
IG> ArrayList.spliterator().

IG> http://cr.openjdk.java.net/~igerasim/8079136/09/webrev/

IG> The builds/tests are green.

Looks good to me, thanks.

By the way I just noted that Paul pushed not the latest patch I
prepared for 8148748. There are purely cosmetic differences missing:

Couple of explanation comments here
http://cr.openjdk.java.net/~tvaleev/webrev/8148748/r3/src/java.base/share/classes/java/util/ArrayList.java.html
(lines 1285, 1286, 1303)

Additional test in SpliteratorTraversingAndSplittingTest:
http://cr.openjdk.java.net/~tvaleev/webrev/8148748/r3/test/java/util/Spliterator/SpliteratorTraversingAndSplittingTest.java.udiff.html

These changes were suggested by Paul here:
http://mail.openjdk.java.net/pipermail/core-libs-dev/2016-March/039276.html

I don't know what's better alternative here:

1. Drop these changes as they are not very important.
2. Log a separate issue for them.
3. Ask Ivan to add them to 8079136 (at least comments) as they belong
to the same class.

What do you think?

With best regards,
Tagir Valeev.

IG> With kind regards,
IG> Ivan



IG> On 03.02.2016 22:16, Ivan Gerasimov wrote:
>> Hello!
>>
>> Here's the updated webrev with rangeCheckForAdd() restored in both 
>> AbstractList and ArrayList.
>> http://cr.openjdk.java.net/~igerasim/8079136/07/webrev/
>>
>> The fix was built/tested successfully on all supported platforms.
>>
>> Sincerely yours,
>> Ivan
>>
>> On 02.02.2016 9:55, Martin Buchholz wrote:
>>> On Mon, Feb 1, 2016 at 10:19 PM, Tagir F. Valeev <amaembo at gmail.com> 
>>> wrote:
>>>
>>>> I have a doubt about replacing rangeCheckForAdd. What if size() ==
>>>> Integer.MAX_VALUE? This is not an issue for ArrayList as it's limited
>>>> by MAX_ARRAY_SIZE which is Integer.MAX_VALUE - 8.
>>> Actually, the limit is Integer.MAX_VALUE.  But it only grows beyond
>>> MAX_ARRAY_SIZE if there's no choice.
>>>
>>
>>




More information about the core-libs-dev mailing list