From 4f1ad0ff5dba26241e2860dbe0fe59a2e818fcc1 Mon Sep 17 00:00:00 2001 From: Owen Mansel-Chan Date: Tue, 27 Jan 2026 15:38:06 +0000 Subject: [PATCH] Exclude *Pool classes from LockType --- java/ql/lib/semmle/code/java/Concurrency.qll | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/java/ql/lib/semmle/code/java/Concurrency.qll b/java/ql/lib/semmle/code/java/Concurrency.qll index da2783bc308..b9dd7bfd99b 100644 --- a/java/ql/lib/semmle/code/java/Concurrency.qll +++ b/java/ql/lib/semmle/code/java/Concurrency.qll @@ -6,12 +6,16 @@ import semmle.code.java.frameworks.Mockito /** * A Java type representing a lock. - * We identify a lock type as one that has both `lock` and `unlock` methods. + * + * We exclude types with a name ending in "Pool" as they typically manage a + * collection of resources and the `lock` and `unlock` methods typically only + * lock one resource at a time. */ class LockType extends RefType { LockType() { this.getAMethod().hasName("lock") and - this.getAMethod().hasName("unlock") + this.getAMethod().hasName("unlock") and + not this.getName().matches("%Pool") } /** Gets a method that is locking this lock type. */