Skip to content

Commit 4dfc9b1

Browse files
committed
Java: Fix performance issue in the stub generator
1 parent baabd2d commit 4dfc9b1

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

java/ql/src/utils/stub-generator/Stubs.qll

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -285,14 +285,19 @@ private string stubQualifier(RefType t) {
285285
else result = ""
286286
}
287287

288+
pragma[nomagic]
289+
private predicate needsPackageNameHelper(RefType t, GeneratedTopLevel top, string name) {
290+
t.getSourceDeclaration() = [getAReferencedType(top), top].getSourceDeclaration() and
291+
name = t.getName()
292+
}
293+
288294
/**
289295
* Holds if `t` may clash with another type of the same name, so should be referred to using the fully qualified name
290296
*/
291297
private predicate needsPackageName(RefType t) {
292-
exists(GeneratedTopLevel top, RefType other |
293-
t.getSourceDeclaration() = [getAReferencedType(top), top].getSourceDeclaration() and
294-
other.getSourceDeclaration() = [getAReferencedType(top), top].getSourceDeclaration() and
295-
t.getName() = other.getName() and
298+
exists(GeneratedTopLevel top, RefType other, string name |
299+
needsPackageNameHelper(t, top, name) and
300+
needsPackageNameHelper(other, top, name) and
296301
t != other
297302
)
298303
}

0 commit comments

Comments
 (0)