Skip to content

SONARKT-379 Fix false positive in S6218#375

Open
fellmann wants to merge 1 commit intoSonarSource:masterfrom
fellmann:fix-S6218
Open

SONARKT-379 Fix false positive in S6218#375
fellmann wants to merge 1 commit intoSonarSource:masterfrom
fellmann:fix-S6218

Conversation

@fellmann
Copy link
Copy Markdown

@fellmann fellmann commented Nov 1, 2023

Overriding equals and hashCode is not necessary for data classes that have array fields in their body, because only arguments of the primary constructor are included in the generated equals and hashCode for data classes.

This should not be trigger the rule:

data class ArrayInBody(val age: Int) { // Compliant
    val employers = arrayOf("SonarSource")
}

@johann-beleites-sonarsource johann-beleites-sonarsource changed the title Fix false positive in S6218 SONARKT-379 Fix false positive in S6218 Nov 29, 2023
@johann-beleites-sonarsource
Copy link
Copy Markdown
Contributor

Hello @fellmann, thanks for your contribution! I've created a ticket to track this issue.

@kaufco kaufco requested review from kaufco and removed request for kaufco January 15, 2024 09:20
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