RFR(XS): 8033909: Objects.requireNonNull(T, Supplier) doesn't specify what happens if the passed supplier is null itself

Alan Bateman Alan.Bateman at oracle.com
Mon Feb 13 16:57:49 UTC 2017

On 09/02/2017 16:18, Volker Simonis wrote:

> :
> I really think that the simplest and most natural fix for this problem
> is to simply check for a null Supplier argument and create the NPE
> with an explicit null message in that case (as outlined in the
> webrev). This:
>   - makes the two requireNonNul() overloads for String and Supplier
> behave the same (which I think was the initial intention).
>   - doesn't require documentation changes
>   - makes it possible to write a simple and conforming TCK test
> If we can't agree on this quickly, I suggest to close the issue as
> "will-not-fix" and leave it untested by the TCK.
If I read JDK-8033909 correctly then it's a request for the javadoc to 
specify the expected behavior when called with a messageSupplier of 
null. I think Joe said at one point that he deliberately didn't specify 
this. If that remains the position then the issue can be closed as WNF 
so that we don't waste any more discussion on it.

If I read your mail and patch correctly then it's more about what the 
NPE message is. I agree the exception you pasted in from the SAP build 
is difficult to read, in which case your patch makes it easier to read. 
That make sense and maybe just push that with a separate issue.


More information about the core-libs-dev mailing list