saveourtool / diktat

Strict coding standard for Kotlin and a custom set of rules for detecting code smells, code style issues and bugs
https://diktat.saveourtool.com
MIT License
525 stars 39 forks source link

Diktat should suggest to override equals and hashcode for Arrays #1869

Open orchestr7 opened 9 months ago

orchestr7 commented 9 months ago

If you will do the following:

data class SimpleArray(val a: Array<Long>)

and after that will try to do something like

assertEquals(SimpleArray(arrayOf(1)), SimpleArray(arrayOf(1)))

you will obviously get false. But sometimes it's easy to forget it, when you are working with Listsfor a long period of time (because Lists will work in Kotlin-like style in the same case).