spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.77k stars 38.16k forks source link

Refactor SourceFilteringListener use Assert.state for null check #33769

Closed kwondh5217 closed 1 month ago

kwondh5217 commented 1 month ago

Description

This PR refactors the SourceFilteringListener class to replace the existing null check with Assert.state, in line with Spring's coding standards for handling null checks. The error message has been updated to follow the guideline: it starts with the identifier (in this case, "Delegate") and ends with "must not be null."

Changes:

Why this change?

Using Assert.state improves readability and ensures that error messages are consistent with Spring's coding style. This change also enhances the maintainability of the code by adhering to standard practices.

pivotal-cla commented 1 month ago

@kwondh5217 Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

pivotal-cla commented 1 month ago

@kwondh5217 Thank you for signing the Contributor License Agreement!

snicoll commented 1 month ago

This PR refactors the SourceFilteringListener class to replace the existing null check with Assert.state, in line with Spring's coding standards for handling null checks. The error message has been updated to follow the guideline: it starts with the identifier (in this case, "Delegate") and ends with "must not be null."

Unfortunately, that's not one case that matches that guideline. What you're referring to is Assert.notNull() and it throws an IllegalArgumentException. The code there is fine as it is.

We are a small team with limited time to review PRs. Please be considerate of that before submitting again.

kwondh5217 commented 1 month ago

Hi @snicoll I appreciate your time in reviewing my PR and pointing this out. I'll be more careful with this distinction in the future. Thank you for your patience and the valuable feedback.