On Thu, 6 Nov 2025 18:33:26 GMT, Sergey Bylokhov <[email protected]> wrote:

>> Spec of NPE states multiple reasons of when an NPE is thrown while using 
>> null object and IAE clearly mentions that we are trying to validate input 
>> arguments and throw it when we see any issue.
>> 
>> Current spec already throws IAE in one of the validation scenario, so 
>> throwing the same IAE for other input argument validation is uniform.
>> 
>> We can say that in some parts of JDK we throw NPE for null argument 
>> verification, but using IAE in this scenario looks better.
>
>>Current spec already throws IAE in one of the validation scenario, so 
>>throwing the same IAE for other input argument validation is uniform.
> 
> We usually throw an NPE when the value is null, since you can’t validate any 
> properties on a null reference, and it’s more specific than an IAE. Moreover, 
> NPE was thrown before, so this won’t change the behavior.

NPE which was thrown before was undefined behaviour.
There is no objection in CSR request also. I would like to continue keeping 
usage of IAE.

If majority of reviewers have objections, we can take it up in follow-up issue.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/28127#discussion_r2502405775

Reply via email to