Skip to content

Commit c10a598

Browse files
committed
Update query console links in call-graph.rst
Removes 'eclipse-cdt/cdt' and 'gradle/gradle' from the queried projects because they cannot be queried currently, and instead queries all demo projects which are currently available.
1 parent ab24566 commit c10a598

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

docs/language/learn-ql/java/call-graph.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ We can use the ``Callable`` class to write a query that finds methods that are n
7878
where not exists(Callable caller | caller.polyCalls(callee))
7979
select callee
8080
81-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/665280012/>`__. This simple query typically returns a large number of results.
81+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/8376915232270534450/>`__. This simple query typically returns a large number of results.
8282

8383
.. pull-quote::
8484

@@ -97,7 +97,7 @@ Running this query on a typical Java project results in lots of hits in the Java
9797
callee.getCompilationUnit().fromSource()
9898
select callee, "Not called."
9999
100-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/668510015/>`__. This change reduces the number of results returned for most projects.
100+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/8711624074465690976/>`__. This change reduces the number of results returned for most projects.
101101

102102
We might also notice several unused methods with the somewhat strange name ``<clinit>``: these are class initializers; while they are not explicitly called anywhere in the code, they are called implicitly whenever the surrounding class is loaded. Hence it makes sense to exclude them from our query. While we are at it, we can also exclude finalizers, which are similarly invoked implicitly:
103103

@@ -111,7 +111,7 @@ We might also notice several unused methods with the somewhat strange name ``<cl
111111
not callee.hasName("<clinit>") and not callee.hasName("finalize")
112112
select callee, "Not called."
113113
114-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/672230002/>`__. This also reduces the number of results returned by most projects.
114+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/925473733866047471/>`__. This also reduces the number of results returned by most projects.
115115

116116
We may also want to exclude public methods from our query, since they may be external API entry points:
117117

@@ -126,7 +126,7 @@ We may also want to exclude public methods from our query, since they may be ext
126126
not callee.isPublic()
127127
select callee, "Not called."
128128
129-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/667290016/>`__. This should have a more noticeable effect on the number of results returned.
129+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/6284320987237954610/>`__. This should have a more noticeable effect on the number of results returned.
130130

131131
A further special case is non-public default constructors: in the singleton pattern, for example, a class is provided with private empty default constructor to prevent it from being instantiated. Since the very purpose of such constructors is their not being called, they should not be flagged up:
132132

@@ -142,7 +142,7 @@ A further special case is non-public default constructors: in the singleton patt
142142
not callee.(Constructor).getNumberOfParameters() = 0
143143
select callee, "Not called."
144144
145-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/673060008/>`__. This change has a large effect on the results for some projects but little effect on the results for others. Use of this pattern varies widely between different projects.
145+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/2625028545869146918/>`__. This change has a large effect on the results for some projects but little effect on the results for others. Use of this pattern varies widely between different projects.
146146

147147
Finally, on many Java projects there are methods that are invoked indirectly by reflection. So, while there are no calls invoking these methods, they are, in fact, used. It is in general very hard to identify such methods. A very common special case, however, is JUnit test methods, which are reflectively invoked by a test runner. The CodeQL library for Java has support for recognizing test classes of JUnit and other testing frameworks, which we can employ to filter out methods defined in such classes:
148148

@@ -159,7 +159,7 @@ Finally, on many Java projects there are methods that are invoked indirectly by
159159
not callee.getDeclaringType() instanceof TestClass
160160
select callee, "Not called."
161161
162-
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/665760002/>`__. This should give a further reduction in the number of results returned.
162+
➤ `See this in the query console on LGTM.com <https://lgtm.com/query/2055862421970264112/>`__. This should give a further reduction in the number of results returned.
163163

164164
Further reading
165165
---------------

0 commit comments

Comments
 (0)