mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Address review comments
This commit is contained in:
@@ -54,32 +54,34 @@ class PossiblyConcurrentCallable extends Callable {
|
||||
}
|
||||
}
|
||||
|
||||
private VarAccess getANonInitializationAccess(Field f) {
|
||||
result = f.getAnAccess() and
|
||||
exists(Callable c | c = result.getEnclosingCallable() |
|
||||
not (
|
||||
c = f.getDeclaringType().getACallable() and
|
||||
(c instanceof Constructor or c instanceof InitializerMethod)
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
/**
|
||||
* Holds if all accesses to `v` (outside of initializers) are locked in the same way.
|
||||
*/
|
||||
predicate alwaysLocked(Field f) {
|
||||
exists(Variable lock |
|
||||
forex(VarAccess access |
|
||||
access = f.getAnAccess() and not access.getEnclosingCallable() instanceof InitializerMethod
|
||||
|
|
||||
forex(VarAccess access | access = getANonInitializationAccess(f) |
|
||||
locallySynchronizedOn(access, _, lock)
|
||||
)
|
||||
)
|
||||
or
|
||||
exists(RefType thisType |
|
||||
forex(VarAccess access |
|
||||
access = f.getAnAccess() and
|
||||
not access.getEnclosingCallable() instanceof Constructor and
|
||||
not access.getEnclosingCallable() instanceof InitializerMethod
|
||||
|
|
||||
forex(VarAccess access | access = getANonInitializationAccess(f) |
|
||||
locallySynchronizedOnThis(access, thisType)
|
||||
)
|
||||
)
|
||||
or
|
||||
exists(RefType classType |
|
||||
forex(VarAccess access |
|
||||
access = f.getAnAccess() and not access.getEnclosingCallable() instanceof InitializerMethod
|
||||
|
|
||||
forex(VarAccess access | access = getANonInitializationAccess(f) |
|
||||
locallySynchronizedOnClass(access, classType)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user