desruisseaux commented on PR #2277:
URL: https://github.com/apache/maven/pull/2277#issuecomment-2833670455

   I think that the main argument in favour of `NullPointerException` is 
consistency. Not all methods perform explicit null checks. Especially since 
[JEP 358: Helpful NullPointerExceptions](https://openjdk.org/jeps/358) provides 
even more helpful messages than many explicit null checks. Therefore, if 
`Objects.requireNonNull` was throwing `IllegalArgumentException` for a null 
argument, we would be at risk of having sometime an `IllegalArgumentException`, 
and sometime a `NullPointerException`, depending on whether the method chooses 
to perform explicit null checks or not. It would also be a risk of 
compatibility break if the method implementation changes its strategy over time.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@maven.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to