This commit is contained in:
Ben Ahmady 2022-11-23 16:59:52 +00:00
Родитель d03817ce2d
Коммит 357c823b92
2 изменённых файлов: 2 добавлений и 2 удалений

Просмотреть файл

@ -10,7 +10,7 @@ Experiment and learn how to write effective and efficient queries for CodeQL dat
.. pull-quote:: Enabling Kotlin support .. pull-quote:: Enabling Kotlin support
To enable Kotlin support, you should enable ``java`` as a language. CodeQL treats Java and Kotlin as parts of the same language, so to enable Kotlin support you should enable ``java`` as a language.
.. toctree:: .. toctree::
:hidden: :hidden:

Просмотреть файл

@ -13,7 +13,7 @@ Be careful when you model code elements that dont exist in Java, such as ``No
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. 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, which may not exactly match the code as written in the codebase.
Another example is that if-else expressions in Kotlin are translated into ``WhenExprs`` in CodeQL, instead of the more typical ``IfStmt`` seen in Java. Another example is that if-else expressions in Kotlin are translated into ``WhenExprs`` in CodeQL, instead of the more typical ``IfStmt`` seen in Java.