Java: Performance tweaks

This commit is contained in:
Ian Lynagh
2022-02-08 14:53:05 +00:00
parent 83bba47fdb
commit 7ce9b160d0
116 changed files with 266 additions and 244 deletions

View File

@@ -29,7 +29,7 @@ class ArchiveEntryNameMethod extends Method {
archiveEntry.hasQualifiedName("java.util.zip", "ZipEntry") or
archiveEntry.hasQualifiedName("org.apache.commons.compress.archivers", "ArchiveEntry")
|
this.getDeclaringType().getASupertype*() = archiveEntry and
this.getDeclaringType().getAnAncestor() = archiveEntry and
this.hasName("getName")
)
}

View File

@@ -34,7 +34,7 @@ private predicate alwaysReturnsTrue(HostnameVerifierVerify m) {
*/
class TrustAllHostnameVerifier extends RefType {
TrustAllHostnameVerifier() {
this.getASupertype*() instanceof HostnameVerifier and
this.getAnAncestor() instanceof HostnameVerifier and
exists(HostnameVerifierVerify m |
m.getDeclaringType() = this and
alwaysReturnsTrue(m)

View File

@@ -134,7 +134,7 @@ predicate inDifferentBranches(MethodAccess ma1, MethodAccess ma2) {
/** The method access `ma` occurs in method `runnable`, which is an implementation of `Runnable.run()`. */
predicate inRunnable(MethodAccess ma, Method runnable) {
runnable.getName() = "run" and
runnable.getDeclaringType().getASupertype+().hasQualifiedName("java.lang", "Runnable") and
runnable.getDeclaringType().getAStrictAncestor().hasQualifiedName("java.lang", "Runnable") and
ma.getEnclosingCallable() = runnable
}