Skip to content

Commit 7d5844a

Browse files
committed
Kotlin: Add more type check casts to MissingInstanceofInEquals query
1 parent e2efef7 commit 7d5844a

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

java/ql/src/Likely Bugs/Comparison/MissingInstanceofInEquals.ql

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ class CheckedCast extends CastExpr {
2626
predicate hasTypeTest(Variable v) {
2727
any(InstanceOfExpr ioe).getExpr() = v.getAnAccess()
2828
or
29+
any(NotInstanceOfExpr nioe).getExpr() = v.getAnAccess()
30+
or
31+
any(SafeCastExpr sce).getExpr() = v.getAnAccess()
32+
or
2933
exists(MethodAccess ma |
3034
ma.getMethod().getName() = "getClass" and
3135
ma.getQualifier() = v.getAnAccess()
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
| Test.kt:0:0:0:0 | equals | equals() method does not seem to check argument type. |
2-
| Test.kt:4:14:6:5 | equals | equals() method does not seem to check argument type. |

0 commit comments

Comments
 (0)