diff --git a/java/ql/src/Likely Bugs/Comparison/MissingInstanceofInEquals.ql b/java/ql/src/Likely Bugs/Comparison/MissingInstanceofInEquals.ql index 1f05298878a6..1c7bb13c0654 100644 --- a/java/ql/src/Likely Bugs/Comparison/MissingInstanceofInEquals.ql +++ b/java/ql/src/Likely Bugs/Comparison/MissingInstanceofInEquals.ql @@ -64,6 +64,7 @@ class UnimplementedEquals extends EqualsMethod { from EqualsMethod m where + m.getFile().isJavaSourceFile() and exists(m.getBody()) and exists(Parameter p | p = m.getAParameter() | // The parameter has no type test diff --git a/java/ql/test/kotlin/query-tests/MissingInstanceofInEquals/Test.kt b/java/ql/test/kotlin/query-tests/MissingInstanceofInEquals/Test.kt index 6eef90c517c5..d5d230bffefe 100644 --- a/java/ql/test/kotlin/query-tests/MissingInstanceofInEquals/Test.kt +++ b/java/ql/test/kotlin/query-tests/MissingInstanceofInEquals/Test.kt @@ -17,3 +17,9 @@ data class G(val x: Int) { return other != null && other.javaClass == this.javaClass } } + +data class H(val x: Int) { + override fun equals(other: Any?): Boolean { + return other != null + } +}