spring-projects / spring-data-jpa

Simplifies the development of creating a JPA-based data access layer.
https://spring.io/projects/spring-data-jpa/
Apache License 2.0
2.93k stars 1.39k forks source link

Use `Assert.notNull` for null check #3441

Closed dukbong closed 2 months ago

dukbong commented 2 months ago

Use the Assert object for null checks.

mp911de commented 2 months ago

While this seems an improvement, the changed state introduces eager evaluation of String.format(…). I think the code lines stem from a time before Assert accepted a message supplier. Care to switch to a lambda syntax providing the message as () -> String.format(…)?

dukbong commented 2 months ago

While this seems an improvement, the changed state introduces eager evaluation of String.format(…). I think the code lines stem from a time before Assert accepted a message supplier. Care to switch to a lambda syntax providing the message as () -> String.format(…)?

Oh my god! @mp911de Your feedback helped me revisit eager and lazy evaluation, allowing me to avoid unnecessary computations. Thank you for helping me improve my code.

mp911de commented 2 months ago

We're happy to help. Thanks a lot for the fast turnaround.

dukbong commented 2 months ago

We're happy to help. Thanks a lot for the fast turnaround.

I also appreciate the quick feedback. 😄 I'll continue to study hard to make great contributions in the future! 📚

mp911de commented 2 months ago

Thank you for your contribution. That's merged, polished, and backported now.

dukbong commented 2 months ago

Thank you for your contribution. That's merged, polished, and backported now.

Thank you! I learned something new from today's open source activities!