Skip to content

Commit 4bd7e24

Browse files
subatoifelicitymay
andauthored
Update docs/codeql/reusables/kotlin-java-differences.rst
Co-authored-by: Felicity Chapman <[email protected]>
1 parent 605c711 commit 4bd7e24

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

docs/codeql/reusables/kotlin-java-differences.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ There are however some important cases where writing queries for Kotlin can prod
77

88
Be careful when trying to model code elements that don’t exist in Java, such as `NotNullExpr (expr!!)`, because they could interact in unexpected ways with common predicates. For example, `MethodAccess.getQualifier()` gets a `NotNullExpr `instead of a `VarAccess`` in the following Kotlin code:
99

10-
`someVar!!.someMethodCall()`
10+
.. code-block:: kotlin
11+
someVar!!.someMethodCall()
1112
1213
In that specific case, you can use the predicate `Expr.getUnderlyingExpr()`. This goes directly to the underlying `VarAccess`` to produce a more similar behavior to that in Java.
1314

0 commit comments

Comments
 (0)