Skip to content

Conversation

@shamith09
Copy link

Before this PR

This check doesn't ignore static fields, so it emits a warning even in cases like these:

public record SomeRecord(String foo) {
    public static final String[] SOME_CONSTANT = new String[] { "foo", "bar" };
}

Static fields are not compared in .equals, so this code is safe and does not exhibit any weird behavior unless there is also a non-static array field in the record. In this example, we should expect instances of SomeRecord to be equal if their foo fields are equal.

After this PR

Static fields are ignored in this check. The presence of non-static array fields still triggers the warning.

==COMMIT_MSG==
==COMMIT_MSG==

Possible downsides?

@changelog-app
Copy link

changelog-app bot commented Sep 22, 2025

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

Ignore static variables in record array field check

Check the box to generate changelog(s)

  • Generate changelog entry

@changelog-app
Copy link

changelog-app bot commented Sep 22, 2025

Successfully generated changelog entry!

What happened?

Your changelog entries have been stored in the database as part of our migration to ChangelogV3.

Need to regenerate?

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

@stale
Copy link

stale bot commented Oct 18, 2025

This PR has been automatically marked as stale because it has not been touched in the last 14 days. If you'd like to keep it open, please leave a comment or add the 'long-lived' label, otherwise it'll be closed in 7 days.

@stale stale bot added the stale label Oct 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant