-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
Add CheckReturnValue annotation #4881
Conversation
Current coverage is 95.74% (diff: 100%)@@ 2.x #4881 diff @@
==========================================
Files 581 581
Lines 37212 37212
Methods 0 0
Messages 0 0
Branches 5601 5601
==========================================
- Hits 35643 35628 -15
- Misses 647 654 +7
- Partials 922 930 +8
|
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.
Gooooooood. Afaik Findbugs also able to process annotation with this name correctly.
* | ||
* @since 2.0.2 - experimental | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) |
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.
nit: static import makes it a little bit better
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.
Yes I know however for RxJava it's common to not static import them (look at BackpressureSupport & SchedulerSupport) so I left it that way. I leave the final decision up to David.
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.
It's fine as is.
*/ | ||
@Retention(RetentionPolicy.RUNTIME) | ||
@Documented | ||
@Target(ElementType.METHOD) |
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.
And here
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.
same as above
I quickly checked findbugs and it does not seem like they pick up our annotation since they have their own |
* | ||
* @since 2.0.2 - experimental | ||
*/ | ||
@Retention(RetentionPolicy.RUNTIME) |
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.
It's fine as is.
Would you manually ignore methods like |
@artem-zinnatullin weird somehow findbugs didn't pick it up though. Could be a configuration error on my side. I'd argue that not annotating We're on the same point that static factory methods and operators such as flatMap, first(), last() etc should be annotated right? If so I'd apply those and then we can see which might need an annotation too. |
@akarnokd added the |
Yes. /cc @JakeWharton |
First draft on this.
So far I have only annotated
subscribeWith()
andtest()
methods.I checked this against Error Prone and their check is able of picking up the RxJava annotation.
How do you feel if I extend
BaseTypeAnnotations
to test for@CheckReturnValue
too?Related #4878