RFR: 8023339: (xs) Refine UOE conditions for removeIf()

Mike Duigou mike.duigou at oracle.com
Fri Sep 13 21:52:33 UTC 2013

Hello all;

A very small patch that refines the declared conditions under which the Collection.removeIf() method will throw UOE. The intent of this patch is to allow the default implementation to be used for immutable collections. It's important that the default implementations provided and the specifications of the methods allow for the behaviour which results from using the default method implementation on any reasonable implementation including immutable implementations. In this case there was a bug originally written against j.u.Arrays.asList() The bug asserted that it's removeIf() implementation was "lazy" and only throws UOE when an element is to be removed. One possible solution was to add a non-default implementation of removeIf() to the Arrays.asList()-List. Since the default method definition must also satisfy other potential immutable implementations we decided to enhance the UOE conditions rather than paper over the problem by adding a default.

(There are a couple of other similar issues which will have similar solutions)



More information about the core-libs-dev mailing list