osdir.com

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [collections] CollectionUtils not null-safe


On Sat, May 19, 2018 at 4:47 AM, sebb <sebbaz@xxxxxxxxx> wrote:

> On 18 May 2018 at 20:34, Gary Gregory <garydgregory@xxxxxxxxx> wrote:
> > Hi All:
> >
> > A lot of methods in CollectionUtils are not null-safe and are documented
> as
> > such in Javadoc with throwing NPEs.
> >
> > I'd like to change that.
>
> To what?
>

For example, this should not cause an NPE:

collectionA = new ArrayList();
CollectionUtils.addAll(collectionA, (Integer[]) null);

Gary

>
> > The change is behavioral and BC would be preserved.
> >
> > Thoughts?
>
> It depends on the method whether a null parameter makes sense or not.
> In some cases it may be confusing if null is accepted.
> And what is meant by a null parameter.
>
> In any case, any such changes need a big warning in the release notes.
>
> > Gary
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@xxxxxxxxxxxxxxxxxx
> For additional commands, e-mail: dev-help@xxxxxxxxxxxxxxxxxx
>
>