mirror of
https://github.com/github/codeql.git
synced 2026-04-27 09:45:15 +02:00
Merge pull request #6637 from github/alexet/imporve-query
Java: Fix performance issues with future versions of codeql.
This commit is contained in:
@@ -110,6 +110,7 @@ class Annotatable extends Element {
|
||||
}
|
||||
|
||||
/** Gets an annotation that applies to this element. */
|
||||
cached
|
||||
Annotation getAnAnnotation() { result.getAnnotatedElement() = this }
|
||||
|
||||
/**
|
||||
|
||||
@@ -616,16 +616,21 @@ private predicate elementSpec(
|
||||
summaryModel(namespace, type, subtypes, name, signature, ext, _, _, _)
|
||||
}
|
||||
|
||||
private predicate relevantCallable(Callable c) { elementSpec(_, _, _, c.getName(), _, _) }
|
||||
|
||||
private string paramsStringPart(Callable c, int i) {
|
||||
i = -1 and result = "("
|
||||
or
|
||||
exists(int n, string p | c.getParameterType(n).getErasure().toString() = p |
|
||||
i = 2 * n and result = p
|
||||
relevantCallable(c) and
|
||||
(
|
||||
i = -1 and result = "("
|
||||
or
|
||||
i = 2 * n - 1 and result = "," and n != 0
|
||||
exists(int n, string p | c.getParameterType(n).getErasure().toString() = p |
|
||||
i = 2 * n and result = p
|
||||
or
|
||||
i = 2 * n - 1 and result = "," and n != 0
|
||||
)
|
||||
or
|
||||
i = 2 * c.getNumberOfParameters() and result = ")"
|
||||
)
|
||||
or
|
||||
i = 2 * c.getNumberOfParameters() and result = ")"
|
||||
}
|
||||
|
||||
private string paramsString(Callable c) {
|
||||
|
||||
@@ -11,11 +11,13 @@ import semmle.code.xml.AndroidManifest
|
||||
*/
|
||||
class AndroidComponent extends Class {
|
||||
AndroidComponent() {
|
||||
this.getASupertype*().hasQualifiedName("android.app", "Activity") or
|
||||
this.getASupertype*().hasQualifiedName("android.app", "Service") or
|
||||
this.getASupertype*().hasQualifiedName("android.content", "BroadcastReceiver") or
|
||||
this.getASupertype*().hasQualifiedName("android.content", "ContentProvider") or
|
||||
this.getASupertype*().hasQualifiedName("android.content", "ContentResolver")
|
||||
// The casts here are due to misoptimisation if they are missing
|
||||
// but are not needed semantically.
|
||||
this.(Class).getASupertype*().hasQualifiedName("android.app", "Activity") or
|
||||
this.(Class).getASupertype*().hasQualifiedName("android.app", "Service") or
|
||||
this.(Class).getASupertype*().hasQualifiedName("android.content", "BroadcastReceiver") or
|
||||
this.(Class).getASupertype*().hasQualifiedName("android.content", "ContentProvider") or
|
||||
this.(Class).getASupertype*().hasQualifiedName("android.content", "ContentResolver")
|
||||
}
|
||||
|
||||
/** The XML element corresponding to this Android component. */
|
||||
|
||||
Reference in New Issue
Block a user