mirror of
https://github.com/github/codeql.git
synced 2026-04-30 19:26:02 +02:00
Java: Autoformat most queries.
This commit is contained in:
@@ -10,12 +10,11 @@
|
||||
* correctness
|
||||
* concurrency
|
||||
*/
|
||||
|
||||
import java
|
||||
|
||||
class ThreadClass extends Class {
|
||||
ThreadClass() {
|
||||
this.hasQualifiedName("java.lang", "Thread")
|
||||
}
|
||||
ThreadClass() { this.hasQualifiedName("java.lang", "Thread") }
|
||||
|
||||
/**
|
||||
* Any constructor of `java.lang.Thread` _without_ a parameter of type `Runnable`;
|
||||
@@ -24,11 +23,13 @@ class ThreadClass extends Class {
|
||||
Constructor getAConstructorWithoutRunnableParam() {
|
||||
result = this.getAConstructor() and
|
||||
(
|
||||
result.getNumberOfParameters() = 0 or
|
||||
result.getNumberOfParameters() = 0
|
||||
or
|
||||
(
|
||||
result.getNumberOfParameters() = 1 and
|
||||
result.getParameter(0).getType().(RefType).hasQualifiedName("java.lang", "String")
|
||||
) or
|
||||
)
|
||||
or
|
||||
(
|
||||
result.getNumberOfParameters() = 2 and
|
||||
result.getParameter(0).getType().(RefType).hasQualifiedName("java.lang", "ThreadGroup") and
|
||||
@@ -61,4 +62,5 @@ where
|
||||
) and
|
||||
not cie.getConstructor().callsConstructor*(thread.getAConstructorWithRunnableParam()) and
|
||||
cie.getType().(RefType).getSourceDeclaration() = emptythread
|
||||
select cie, "Thread " + emptythread.getName() + " has a useless empty run() inherited from java.lang.Thread."
|
||||
select cie,
|
||||
"Thread " + emptythread.getName() + " has a useless empty run() inherited from java.lang.Thread."
|
||||
|
||||
Reference in New Issue
Block a user