Skip to content

Commit

Permalink
Merge pull request #11306 from tamasvajk/kotlin-equals-missing
Browse files Browse the repository at this point in the history
Kotlin: Exclude .kt files from missing `instanceof` in `equals` query
  • Loading branch information
smowton authored Nov 17, 2022
2 parents 45d4318 + fc614ad commit 1118830
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}

0 comments on commit 1118830

Please sign in to comment.