Skip to content

DangerousRecordArrayField - Fix false positive on static array fields#171

Open
schlosna wants to merge 1 commit into
developfrom
davids/DangerousRecordArrayField
Open

DangerousRecordArrayField - Fix false positive on static array fields#171
schlosna wants to merge 1 commit into
developfrom
davids/DangerousRecordArrayField

Conversation

@schlosna
Copy link
Copy Markdown
Contributor

@schlosna schlosna commented Apr 8, 2026

Before this PR

The check was incorrectly flagging records with static array fields.

After this PR

==COMMIT_MSG==
Static fields don't participate in record's auto-generated equals() and hashCode() methods, so they shouldn't trigger the warning. Added unit tests to verify static fields are properly ignored.

==COMMIT_MSG==

Possible downsides?

The check was incorrectly flagging records with static array fields.
Static fields don't participate in record's auto-generated equals() and
hashCode() methods, so they shouldn't trigger the warning. Added unit
tests to verify static fields are properly ignored.
@changelog-app
Copy link
Copy Markdown

changelog-app Bot commented Apr 8, 2026

Generate changelog in changelog/@unreleased

Type (Select exactly one)

  • Feature (Adding new functionality)
  • Improvement (Improving existing functionality)
  • Fix (Fixing an issue with existing functionality)
  • Break (Creating a new major version by breaking public APIs)
  • Deprecation (Removing functionality in a non-breaking way)
  • Migration (Automatically moving data/functionality to a new system)

Description

Static fields don't participate in record's auto-generated equals() and hashCode() methods, so they shouldn't trigger the warning. Added unit tests to verify static fields are properly ignored.

Check the box to generate changelog(s)

  • Generate changelog entry

@changelog-app
Copy link
Copy Markdown

changelog-app Bot commented Apr 9, 2026

Successfully generated changelog entry!

Need to regenerate?

Simply interact with the changelog bot comment again to regenerate these entries.


📋Changelog Preview

🐛 Fixes

  • Static fields don't participate in record's auto-generated equals() and hashCode() methods, so they shouldn't trigger the warning. Added unit tests to verify static fields are properly ignored. (#171)

1 similar comment
@changelog-app
Copy link
Copy Markdown

changelog-app Bot commented Apr 9, 2026

Successfully generated changelog entry!

Need to regenerate?

Simply interact with the changelog bot comment again to regenerate these entries.


📋Changelog Preview

🐛 Fixes

  • Static fields don't participate in record's auto-generated equals() and hashCode() methods, so they shouldn't trigger the warning. Added unit tests to verify static fields are properly ignored. (#171)

Comment on lines 34 to 36
/**
* Warns that users should not have a {@link java.util.regex.Pattern} as a key to a Set or Map.
*/
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not this PR, but while you're here would you mind either fixing or removing this Javadoc? It looks like it was copied from DangerousIdentityKey.

Probably should also fix the Javadoc in DangerousIdentityKey, since it checks for more than just java.util.regex.Pattern.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants