Repository navigation
[java] Fix #6826: AssertEqualsArgumentOrder false positive for double/float delta - #6827
Merged
Merged
Conversation
…ble/float delta The wildcard assertEquals(_,_,_) matchers for org.junit.Assert and junit.framework.TestCase modeled the 3-arg form as (message?, expected, actual), so for the delta overload assertEquals(double expected, double actual, double delta) they read the delta as "actual" and flagged correctly-ordered calls. Replace the wildcards with the forms actually in use: (String,_,_) and (String,_,_,_) for the message variants, (double,double,double) and (float,float,float) for the deltas. The message + delta form was not matched at all before, so a swap there went undetected. Fixes pmd#6826.
dhalperi
force-pushed
the
copilot/fix-upstream-issue-6826
branch
from
June 30, 2026 03:53
bb090d3 to
488c6a9
Compare
Contributor
|
Compared to main: (comment created at 2026-07-06 10:06:19+00:00 for 6215d44) |
zbynek
reviewed
Jun 30, 2026
zbynek
left a comment
Contributor
There was a problem hiding this comment.
Thanks, looks good. Another thing I've missed when implementing this rule is JUnit Jupiter's assertEquals with 4 parameters (maybe we should just just generalize args for Jupiter to _* + add tests), but I can do that in a separate PR.
# Conflicts: # docs/pages/release_notes.md
Member
|
Thanks! |
2 of 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
The wildcard
assertEquals(_,_,_)matchers fororg.junit.Assertandjunit.framework.TestCasemodeled the 3-arg form as(message?, expected, actual), so for the delta overloadassertEquals(double expected, double actual, double delta)they read the delta as "actual" and flagged correctly-ordered calls.Replace the wildcards with the forms actually in use:
(String,_,_)and(String,_,_,_)for the message variants,(double,double,double)and(float,float,float)for the deltas. The message + delta form was not matched at all before, so a swap there went undetected.Added a release-note entry under
java-errorprone.Related issues
Ready?
./mvnw clean verifypasses (checked automatically by github actions)