Skip to content

Commit 6386ef3

Browse files
committed
Further perf improvements
1 parent 4dfc9b1 commit 6386ef3

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
@@ -287,18 +287,23 @@ private string stubQualifier(RefType t) {
287287

288288
pragma[nomagic]
289289
private predicate needsPackageNameHelper(RefType t, GeneratedTopLevel top, string name) {
290-
t.getSourceDeclaration() = [getAReferencedType(top), top].getSourceDeclaration() and
290+
t.getSourceDeclaration() =
291+
pragma[only_bind_out]([getAReferencedType(top), top].getSourceDeclaration()) and
291292
name = t.getName()
292293
}
293294

295+
pragma[nomagic]
296+
private predicate describesMultipleTypes(GeneratedTopLevel top, string name) {
297+
2 <= strictcount(RefType t | needsPackageNameHelper(t, top, name))
298+
}
299+
294300
/**
295301
* Holds if `t` may clash with another type of the same name, so should be referred to using the fully qualified name
296302
*/
297303
private predicate needsPackageName(RefType t) {
298-
exists(GeneratedTopLevel top, RefType other, string name |
304+
exists(GeneratedTopLevel top, string name |
299305
needsPackageNameHelper(t, top, name) and
300-
needsPackageNameHelper(other, top, name) and
301-
t != other
306+
describesMultipleTypes(top, name)
302307
)
303308
}
304309

0 commit comments

Comments
 (0)