Add CheckReturnValue to queries
See original GitHub issueIt allows to detect incorrect API usage through static checkers in IDEs or Findbugs.
Findbugs and the IDEs work in a nice way and one can define an annotation named @CheckReturnValue
in their own package and the checkers will honer it. There won’t be any need for a dependency to a 3rd party.
Marking a class with @CheckReturnValue
will apply that to all of it’s method. In order to ignore a particular method one can annotate it with an annotation named @CanIgnoreReturnValue
.
All this would be beneficial for a better developer experience with the Flowable Java API
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
apply CheckReturnValue to entire project - java - Stack Overflow
It's been fixed but now I want to add some static analysis to help find if other existing bugs of the same nature...
Read more >CheckReturnValue - Error Prone
add (element) returns a boolean : The return value is false if element was already contained in set . Typically, callers don't need...
Read more >CallArgsStep (jOOQ 3.18.0-SNAPSHOT API)
A step in the construction of the CALL statement. Referencing XYZ*Step types directly from client code. It is usually not recommended to reference...
Read more >Source code - Guava
CheckReturnValue ; 037import javax.annotation. ... of certain elements (for example 049 * {@link #last}) 050 * <li>query methods which answer questions about ...
Read more >hasParameterType: Functions to query existence of specific type ...
Similarly, we determine if we have any information about the return type before adding a call to checkReturnValue. They are used internally.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@lamtrhieu you don’t need to write a custom detector for findbugs.
An example of what an incorrect usage is:
The problem is not calling one of
singleResult
,list
,listPage
orcount
.An example how this looks like in AssertJ can be found in this.
This is how the
CheckReturnValue
annotation works in Findbug.There is also a possibility to use a custom
CanIgnoreReturnValue
. This is how it was done in AssertJ.All things said, if you want to do something I would suggest you do one query and we see how it works, because I think that there might be some issues (at least discovery in IntelliJ)
Hi @filiphr Can you please help to answer all my questions when you have time ? Thanks