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

Co-authored-by: Felicity Chapman <felicitymay@github.com>
This commit is contained in:
Ben Ahmady
2022-11-23 10:06:57 +00:00
committed by GitHub
parent 605c7113a2
commit 4bd7e24b5f

View File

@@ -7,7 +7,8 @@ There are however some important cases where writing queries for Kotlin can prod
Be careful when trying to model code elements that dont 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:
`someVar!!.someMethodCall()`
.. code-block:: kotlin
someVar!!.someMethodCall()
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.