On 9/18/12 12:02 PM, Sébastien Brisard wrote:
> Hello,
>
> 2012/9/17 Gilles Sadowski <gil...@harfang.homelinux.org>:
>> On Fri, Sep 14, 2012 at 11:29:41AM -0700, Phil Steitz wrote:
>>> OK, I give up.  Lets do option 2.  Just warn users in the User Guide
>>> somewhere that our APIs are in general not null-safe and unless the
>>> javadoc explicitly allows nulls, they can expect NPE when passing nulls.
>> Thanks, Phil; we are making progress, and I hope that you'll be convinced of
>> that at some point.
>>
>> Another decision still needs to be made.
>>
>> I think that everybody now agrees that wherever an argument will be directly
>> used (i.e. "dereferenced") inside the body of the method[1], it is safe to
>> not check for null (since the JVM will throw an NPE).
>>
>> But, whenever an argument is passed for _later_ use (e.g. stored by a
>> constructor or passed to another method), we also all expressed that it is
>> better to fail early if the object is supposed to be non-null. In those
>> cases, checks are not mandatory (since the JVM will throw NPE at some
>> point), but we must agree on how optional checks are to be implemented.
>> 1. The current state of affairs was to throw "NullArgumentException"; in 4.0
>>    this exception will become a subclass of NPE and we can continue to use
>>    it in the same way as now (i.e. possibly providing additional localizable
>>    error messages).
>> 2. The alternative is to directly throw a standard NPE, but without any
>>    message, since it wouldn't be localizable with the support of CM's
>>    "context".
>>
>> So, which of those alternatives do people want to settle on?
>>
>>
>> Regards,
>> Gilles
>>
>> [1] As opposed to being passed on to another method.
>>
> I have another question: are we going to little by little remove all
> null checks that we feel are not absolutely necessary? I would not
> mind going through this cleaning phase while working on MATH-854.

I think we should wait to remove the existing null checks until
4.0.  This is a significant behavior change, especially for the ones
that have been in place and documented since 1.x.  Removing the
checks and allowing NPEs to propagate will break apps that catch IAE.

Phil
>
> Best regards,
> Sébastien
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
> For additional commands, e-mail: dev-h...@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to