Skip to content

Commit d6ae5c8

Browse files
felicitymayaibaars
authored andcommitted
Respond to review feedback
1 parent a9b6a12 commit d6ae5c8

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

docs/codeql/codeql-language-guides/codeql-library-for-java.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,8 @@ For Javadoc, class ``Element`` has a member predicate ``getDoc`` that returns a
299299
jdoc = f.getDoc().getJavadoc()
300300
select jdoc
301301
302+
You can see this pattern in many projects.
303+
302304
Class ``Javadoc`` represents an entire Javadoc comment as a tree of ``JavadocElement`` nodes, which can be traversed using member predicates ``getAChild`` and ``getParent``. For instance, you could edit the query so that it finds all ``@author`` tags in Javadoc comments on private fields:
303305

304306
.. code-block:: ql

docs/codeql/codeql-language-guides/types-in-java.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ This recipe is not too difficult to translate into a query:
8080
target.getElementType().(RefType).getASupertype+() = source.getElementType()
8181
select ce, "Potentially problematic array downcast."
8282
83+
Many projects return results for this query.
84+
8385
Note that by casting ``target.getElementType()`` to a ``RefType``, we eliminate all cases where the element type is a primitive type, that is, ``target`` is an array of primitive type: the problem we are looking for cannot arise in that case. Unlike in Java, a cast in QL never fails: if an expression cannot be cast to the desired type, it is simply excluded from the query results, which is exactly what we want.
8486

8587
Improvements

0 commit comments

Comments
 (0)