FutureReturnValueIgnored analogue for CompletionStages
- Dominant language
- Java
- Stars
- 7.2k
- Forks
- 820
- Avg merge
- 5h 9m
- Merged PRs (30d)
- 50
Description
Hi! I have a proposal for a new check based on a situation that came up at work. Here is (essentially) our code:
```
CompletionStage c = CompletableFuture.completedFuture(null);
c.thenRun(() -> {...});
```
Error Prone compiles this with no complaints. However, if the type of `c` is changed to `CompletableFuture`, we get a warning about the return value of `thenRun` being ignored. FutureReturnValueIgnored kicks in because the return value is known to be a `CompletableFuture` rather than just a `CompletionStage`.
Since it seems equally dangerous to ignore a returned `CompletionStage` - exceptions thrown by the lambda above are suppressed - maybe Error Prone should warn about that too?
Contributor guide
Assessment
This issue has not been assessed yet.