RFR: 8079136: Accessing a nested sublist leads to StackOverflowError

Daniel Fuchs daniel.fuchs at oracle.com
Tue May 5 13:29:50 UTC 2015


Hi Ivan,

On 05/05/15 14:55, Ivan Gerasimov wrote:
> I converted the SubList into an inner class to make the implementations
> for AbstractList.SubList and ArrayList.SubList similar.
> It might be not worth doing so, but I thought it would be easier to
> maintain those classes, if they have similar structure.

There's a subtle difference here - because SubList in ArrayList is
not an ArrayList - so I find it less confusing: that SubList can't
have inner SubList instances :-)
Whereas SubList in AbstractList is itslef an AbstractList, and
therefore if SubList is an AbstractList it can have inner
SubList instances too - which is precisely what you don't want
to happen.
You might want to wait and see where other reviewer's preferences
lean to...

best regards,

-- daniel



More information about the core-libs-dev mailing list