Skip to content

False positive diff for array with maxItems #784

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

Closed
rq-trichins opened this issue May 13, 2025 · 1 comment · Fixed by #785
Closed

False positive diff for array with maxItems #784

rq-trichins opened this issue May 13, 2025 · 1 comment · Fixed by #785
Milestone

Comments

@rq-trichins
Copy link

In #780, the fix for matching maxItems and minItems was changed to check if "oldValue == newValue". But those are both "Integer" and so the equality is doing an object matching, not an equality of the actual integers. It should be "oldValue.equals(newValue)" or "Objects.equals(oldValue, newValue)".

I'm seeing this when the maxItems is a large number. Sometimes, the JVM reuses the same object for the integer and sometimes it doesn't. When it doesn't reuse the same object, then the existing comparison fails.

@DrSatyr
Copy link
Collaborator

DrSatyr commented May 13, 2025

@rq-trichins, good catch, thank you. Fixed.

@DrSatyr DrSatyr added this to the 2.2.0 milestone May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants