Show warning also if arrays are compared by '!=' #KT-20259 Fixed
This commit is contained in:
committed by
Mikhail Glukhikh
parent
93252926ba
commit
f08e9832a6
Vendored
+8
@@ -7,4 +7,12 @@
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Replace '==' with 'Arrays.equals'</problem_class>
|
||||
<description>Replace '==' with 'Arrays.equals'</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>test.kt</file>
|
||||
<line>7</line>
|
||||
<module>light_idea_test_case</module>
|
||||
<entry_point TYPE="file" FQNAME="temp:///src/test.kt"/>
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Replace '!=' with 'Arrays.equals'</problem_class>
|
||||
<description>Replace '!=' with 'Arrays.equals'</description>
|
||||
</problem>
|
||||
</problems>
|
||||
@@ -4,4 +4,5 @@ fun foo() {
|
||||
val c: Any? = null
|
||||
a == b // YES
|
||||
a == c // NO
|
||||
a != b
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: Replace '!=' with 'Arrays.equals'
|
||||
fun foo() {
|
||||
val a = arrayOf("a", "b", "c")
|
||||
val b = arrayOf("a", "b", "c")
|
||||
if (a <caret>!= b) {
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
import java.util.Arrays
|
||||
|
||||
// WITH_RUNTIME
|
||||
// INTENTION_TEXT: Replace '!=' with 'Arrays.equals'
|
||||
fun foo() {
|
||||
val a = arrayOf("a", "b", "c")
|
||||
val b = arrayOf("a", "b", "c")
|
||||
if (!Arrays.equals(a, b)) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user