Skip to content

Commit 13ffd73

Browse files
committed
Update query console links in types-class-hierarchy.rst
Removes 'gradle/gradle' from the queried projects because it cannot be queried currently, and instead queries all demo projects which are currently available.
1 parent 163257a commit 13ffd73

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/language/learn-ql/java/types-class-hierarchy.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ To determine ancestor types (including immediate super types, and also *their* s
3232
where B.hasName("B")
3333
select B.getASupertype+()
3434
35-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/674620010/>`__. If this query were run on the example snippet above, the query would return ``A``, ``I``, and ``java.lang.Object``.
35+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/1506430738755934285/>`__. If this query were run on the example snippet above, the query would return ``A``, ``I``, and ``java.lang.Object``.
3636

3737
.. pull-quote::
3838

@@ -78,7 +78,7 @@ This recipe is not too difficult to translate into a query:
7878
target.getElementType().(RefType).getASupertype+() = source.getElementType()
7979
select ce, "Potentially problematic array downcast."
8080
81-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/666680038/>`__. Many projects return results for this query.
81+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/8378564667548381869/>`__. Many projects return results for this query.
8282

8383
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.
8484

@@ -97,7 +97,7 @@ In code that does not use generics, this method is often used in the following w
9797
9898
Here, ``l`` has the raw type ``List``, so ``l.toArray`` has return type ``Object[]``, independent of the type of its argument array. Hence the cast goes from ``Object[]`` to ``A[]`` and will be flagged as problematic by our query, although at runtime this cast can never go wrong.
9999

100-
To identify these cases, we can create two CodeQL classes that represent, respectively, the ``Collection.toArray`` class, and calls to this method or any method that overrides it:
100+
To identify these cases, we can create two CodeQL classes that represent, respectively, the ``Collection.toArray`` method, and calls to this method or any method that overrides it:
101101

102102
.. code-block:: ql
103103
@@ -148,7 +148,7 @@ Example: Finding mismatched contains checks
148148

149149
We'll now develop a query that finds uses of ``Collection.contains`` where the type of the queried element is unrelated to the element type of the collection, which guarantees that the test will always return ``false``.
150150

151-
For example, `Apache Zookeeper <http://zookeeper.apache.org/>`__ used to have a snippet of code similar to the following in class ``QuorumPeerConfig``:
151+
For example, `Apache Zookeeper <https://zookeeper.apache.org/>`__ used to have a snippet of code similar to the following in class ``QuorumPeerConfig``:
152152

153153
.. code-block:: java
154154
@@ -267,7 +267,7 @@ Now we are ready to write a first version of our query:
267267
not haveCommonDescendant(collEltType, argType)
268268
select juccc, "Element type " + collEltType + " is incompatible with argument type " + argType
269269
270-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/1505750556420/>`__.
270+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/7947831380785106258/>`__.
271271

272272
Improvements
273273
~~~~~~~~~~~~
@@ -294,7 +294,7 @@ Adding these three improvements, our final query becomes:
294294
not argType.hasName("<nulltype>")
295295
select juccc, "Element type " + collEltType + " is incompatible with argument type " + argType
296296
297-
➤ `See the full query in the query console on LGTM.com <https://lgtm.com/query/1505753056300/>`__.
297+
➤ `See the full query in the query console on LGTM.com <https://lgtm.com/query/8846334903769538099/>`__.
298298

299299
Further reading
300300
---------------

0 commit comments

Comments
 (0)