Repository navigation
[java] Fix #6625: New rule: UnusedReturnValue - #6916
Merged
UncleOwen merged 9 commits intoAug 9, 2026
Merged
Conversation
Contributor
|
Compared to main: (comment created at 2026-08-07 16:06:02+00:00 for c4ca084) |
(cherry picked from commit 6ffe8b5)
UncleOwen
force-pushed
the
issue-6625-new-rule-UnusedReturnValue
branch
from
August 1, 2026 20:51
612b993 to
4db560b
Compare
lukasgraef
reviewed
Aug 7, 2026
lukasgraef
approved these changes
Aug 8, 2026
lukasgraef
left a comment
Member
There was a problem hiding this comment.
Looks good!
I especially like the updated error messages compared to the previous deprecated rules.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe the PR
This rule uses multiple ways to find method calls where the return value is ignored but shouldn't be:
JavaRuleUtil.isKnownPuredetermines to be pure. The existing rule UselessPureMethodCallRule is deprecatedI did not include CheckResultSet. Although the rule claims it is about the return value of .next() and siblings, it is really about making sure that .getFoo() is only called when the object is in the correct state.
Related issues
Ready?
./mvnw clean verifypasses (checked automatically by github actions)