-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Decorate all Assert implementations with @CheckReturnValue #46766
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
base: main
Are you sure you want to change the base?
Conversation
72390fd
to
8978e51
Compare
See #32683 (comment) |
As I need to extend Checkstyle's
or should I define a more fine-grained rule, restricting it to the following packages?
|
Yep. The intention is to restrict only to certain AssertJ entry point and this is one of them so I think that's ok. |
@scordio how is it going, anything I can do to help? |
Apologies, life happened and this fell off my radar! 🤦 If not in a rush, I'm happy to continue on it over the weekend. |
Thanks, @scordio. There's no rush. |
76f6b34
to
934b746
Compare
When building the project locally, I get two NullAway errors on
but the CI seems fine 🤔 |
@scordio you need Java 24 to build the project |
This comment was marked as outdated.
This comment was marked as outdated.
Signed-off-by: Stefano Cordio <[email protected]>
934b746
to
df47244
Compare
private static DescribedPredicate<JavaMethod> dontReturnSelfType() { | ||
return DescribedPredicate.describe("don't return self type", | ||
(method) -> !method.getRawReturnType().equals(method.getOwner())); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't play well with overridden methods:
Architecture Violation [Priority: MEDIUM] - Rule 'methods that are declared in classes that implement org.assertj.core.api.Assert and are public and don't return self type should be annotated with @CheckReturnValue' was violated (4 times):
Method <org.springframework.boot.test.json.JsonContentAssert.isEqualTo(java.lang.Object)> is not annotated with @CheckReturnValue in (JsonContentAssert.java:56)
Method <org.springframework.boot.test.json.JsonContentAssert.isEqualTo(java.lang.Object)> is not annotated with @CheckReturnValue in (JsonContentAssert.java:56)
Method <org.springframework.boot.test.json.JsonContentAssert.isNotEqualTo(java.lang.Object)> is not annotated with @CheckReturnValue in (JsonContentAssert.java:56)
Method <org.springframework.boot.test.json.JsonContentAssert.isNotEqualTo(java.lang.Object)> is not annotated with @CheckReturnValue in (JsonContentAssert.java:56)
I'll continue looking at it tomorrow.
See #32683.
Deliverables
Assert
implementations