Skip to content

False positive diff for array with maxItems #784

Closed

Description

@rq-trichins

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.

Activity

  1. DrSatyr commented on May 13, 2025

    @DrSatyr
    Collaborator

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

  2. added this to the 2.2.0 milestone on May 13, 2025
  3. added theissue type on May 13, 2025
  4. rq-trichins commented on May 30, 2025

    @rq-trichins
    Author

    @DrSatyr , is it possible to backport this into a 2.1.2 release?

  5. DrSatyr commented on May 30, 2025

    @DrSatyr
    Collaborator

    @rq-trichins done, please check 2.1.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions