-
Notifications
You must be signed in to change notification settings - Fork 41.2k
@CheckReturnValue decoration for ApplicationContextAssert::getBean(s) methods #32683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
On second thought, Spring Boot Test might use |
Thanks for the suggestion, @scordio. Using |
I think this is a good idea if we do this consistently. |
I like the idea as well and error prone has been on the list of things to investigate for a while. |
This could be connected to spring-projects/spring-framework#28797 (tentatively planned for 6.1) if we extends its scope via jspecify/jspecify#200. |
Regarding Eclipse IDE support, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=572496. |
@CheckReturnValue
decoration for ApplicationContextAssert::getBean(s)
methods
Marking this as blocked as we want to see what Framework do. |
We are adding |
Now that |
A PR would be most welcome @scordio. This is something we'll probably aim to merge in 4.0 along with JSpecify support. |
I suggest to decorate
ApplicationContextAssert::getBean(s)
methods with a@CheckReturnValue
annotation so that incomplete statements like the following are spotted by static analysis tools like SpotBugs and IntelliJ IDEA:To achieve this, no additional dependency is needed and Spring Boot Test can declare its own
@CheckReturnValue
annotation, similarly to what AssertJ and Mockito do.I can raise a PR with the changes if the idea is accepted.
The text was updated successfully, but these errors were encountered: