RFR: 8079136: Accessing a nested sublist leads to StackOverflowError (original) (raw)

Ivan Gerasimov ivan.gerasimov at oracle.com
Fri May 8 15:02:13 UTC 2015


On 08.05.2015 1:26, Martin Buchholz wrote:

On Thu, May 7, 2015 at 12:23 PM, Doug Lea <dl at cs.oswego.edu> wrote:

It would be possible (and easy) to create a specialization for the java.util.Arrays.ArrayList class (i.e., the kind returned by Arrays.asList(a).subList), which would also fix the SOE problem in this particular case. It seems it would be a fairly clean win to no longer have Arrays.ArrayList subclass AbstractList, getting rid of modCount (no structural modifications are possible!), at the cost of more copying. Maybe it could subclass AbstractCollection instead? We can introduce an intermediate abstract base class for AbstractList, which will implement a simpler version of sublists. This BaseAbstractList could then be used for implementing Arrays.ArrayList and Collections.SingletonList without paying too much for copying code.

I wouldn't include such a change in this fix, however, and would leave if for a separate enhancement.

Sincerely yours, Ivan



More information about the core-libs-dev mailing list