We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 9f2f6ac + 51f9314 commit cd8ac1aCopy full SHA for cd8ac1a
2 files changed
java/ql/src/Likely Bugs/Comparison/MissingInstanceofInEquals.ql
@@ -30,6 +30,8 @@ predicate hasTypeTest(Variable v) {
30
or
31
any(SafeCastExpr sce).getExpr() = v.getAnAccess()
32
33
+ any(ClassExpr c).getExpr() = v.getAnAccess()
34
+ or
35
exists(MethodAccess ma |
36
ma.getMethod().getName() = "getClass" and
37
ma.getQualifier() = v.getAnAccess()
java/ql/test/kotlin/query-tests/MissingInstanceofInEquals/Test.kt
@@ -5,3 +5,9 @@ data class E(val x: Int) {
5
return (other as? E)?.x == this.x
6
}
7
8
+
9
+data class F(val x: Int) {
10
+ override fun equals(other: Any?): Boolean {
11
+ return other != null && other::class == this::class
12
+ }
13
+}
0 commit comments