Arrays are compared with ==, which compares their identity, not their elements

tx0/kotlin:array-equalityrecommendedwarningreliability/equalitydepth fastbug

What it finds

For arrays, == and equals are true only for the same array object; two arrays with the same elements are not equal. contentEquals compares the elements. Reported when an operand is known to be an array from its declaration.

From the rule's source, array_equality.rs.

Example from the rule's tests
fun same(a: ByteArray, b: ByteArray, c: List<Int>, d: List<Int>): Boolean {    if (a == b) return truetx0 reports: == compares the identity of arrays    if (a.equals(b)) return truetx0 reports: equals compares the identity of arrays    if (c == d) return true    return a.contentEquals(b)}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs from the recommended tier up. To turn it on in a lower tier, give it a level in tx0.toml:

tx0.toml
[rules]
"tx0/kotlin:array-equality" = "warning"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/kotlin:array-equality] reason="..."

tx0 explain tx0/kotlin:array-equality shows the same in the terminal. Found a false positive? Report it.