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 15:10:14 +00:00
committed by GitHub
parent 3c3442d8f0
commit 72999c7af1

View File

@@ -11,7 +11,7 @@ Be careful when you model code elements that dont exist in Java, such as ``No
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.
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.
Nullable elements (`?`) can also produce unexpected behavior. To avoid a `NullPointerException`, Kotlin may inline calls like `expr.toString()` to `String.valueOf(expr)` when `expr` is nullable. Make sure that you write CodeQL around the extracted code, and do not directly modify the source code in the codebase.