Skip to content

Commit 9ee3621

Browse files
committed
Java: Fix basic query in docs
1 parent 545c2f6 commit 9ee3621

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/codeql/codeql-language-guides/basic-query-for-java-code.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Running the query
3737
3838
import java
3939
40-
from IfStmt ifstmt, Block block
40+
from IfStmt ifstmt, BlockStmt block
4141
where ifstmt.getThen() = block and
4242
block.getNumStmt() = 0
4343
select ifstmt, "This 'if' statement is redundant."
@@ -59,7 +59,7 @@ Running the query
5959

6060
The query will take a few moments to return results. When the query completes, the results are displayed below the project name. The query results are listed in two columns, corresponding to the two expressions in the ``select`` clause of the query. The first column corresponds to the expression ``ifstmt`` and is linked to the location in the source code of the project where ``ifstmt`` occurs. The second column is the alert message.
6161

62-
➤ `Example query results <https://lgtm.com/query/3235645104630320782/>`__
62+
➤ `Example query results <https://lgtm.com/query/8628882704378129297/>`__
6363

6464
.. pull-quote::
6565

@@ -81,10 +81,10 @@ After the initial ``import`` statement, this simple query comprises three parts
8181
+===============================================================+===================================================================================================================+========================================================================================================================+
8282
| ``import java`` | Imports the standard CodeQL libraries for Java. | Every query begins with one or more ``import`` statements. |
8383
+---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
84-
| ``from IfStmt ifstmt, Block block`` | Defines the variables for the query. | We use: |
84+
| ``from IfStmt ifstmt, BlockStmt block`` | Defines the variables for the query. | We use: |
8585
| | Declarations are of the form: | |
8686
| | ``<type> <variable name>`` | - an ``IfStmt`` variable for ``if`` statements |
87-
| | | - a ``Block`` variable for the then block |
87+
| | | - a ``BlockStmt`` variable for the ``then`` block |
8888
+---------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------+
8989
| ``where ifstmt.getThen() = block and block.getNumStmt() = 0`` | Defines a condition on the variables. | ``ifstmt.getThen() = block`` relates the two variables. The block must be the ``then`` branch of the ``if`` statement. |
9090
| | | |
@@ -138,7 +138,7 @@ To exclude ``if`` statements that have an ``else`` branch:
138138

139139
There are now fewer results because ``if`` statements with an ``else`` branch are no longer included.
140140

141-
➤ `See this in the query console <https://lgtm.com/query/6382189874776576029/>`__
141+
➤ `See this in the query console <https://lgtm.com/query/2005778170075484819/>`__
142142

143143
Further reading
144144
---------------

0 commit comments

Comments
 (0)