Skip to content

fix(sonar): array-aware equals/hashCode/toString on ZstdEncodingEncoder records#175

Merged
dfa1 merged 1 commit into
mainfrom
fix/sonar-s6218-zstd-records
Jun 26, 2026
Merged

fix(sonar): array-aware equals/hashCode/toString on ZstdEncodingEncoder records#175
dfa1 merged 1 commit into
mainfrom
fix/sonar-s6218-zstd-records

Conversation

@dfa1

@dfa1 dfa1 commented Jun 26, 2026

Copy link
Copy Markdown
Owner

On-demand SonarCloud run on main failed the quality gate: new_reliability_rating = C (ERROR), from 2 java:S6218 BUGs in ZstdEncodingEncoder:

  • FrameLayout (long[] components)
  • Frames (byte[] metadata)

S6218 fires because a record with array components gets a default equals/hashCode that compares array identity, not content — a latent reliability bug if the records are ever value-compared.

Fixed by overriding equals/hashCode/toString with Arrays.equals/hashCode/toString (and Objects for the List/scalar fields), so the records consider array content — rather than suppressing the BUG.

Clears the new-code reliability gate. No behavior change to the encode path.

🤖 Generated with Claude Code

…er records

SonarCloud flagged the private FrameLayout (long[] components) and Frames
(byte[] metadata) records as reliability bugs (java:S6218): a record with array
components gets a default equals/hashCode that compares array identity, not
content. Both are BUG-severity and fail the new-code reliability gate.

Fix by overriding equals/hashCode/toString with Arrays.equals/hashCode/toString
(and Objects for the List/scalar fields) so they consider array content, rather
than suppressing the rule.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@dfa1 dfa1 force-pushed the fix/sonar-s6218-zstd-records branch from c45b841 to c8efd73 Compare June 26, 2026 21:03
@dfa1 dfa1 changed the title fix(sonar): suppress S6218 on ZstdEncodingEncoder data-carrier records fix(sonar): array-aware equals/hashCode/toString on ZstdEncodingEncoder records Jun 26, 2026
@dfa1 dfa1 merged commit 811e08d into main Jun 26, 2026
6 checks passed
@dfa1 dfa1 deleted the fix/sonar-s6218-zstd-records branch June 26, 2026 21:06
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 this pull request may close these issues.

1 participant