mirror of
https://github.com/github/codeql.git
synced 2026-04-27 01:35:13 +02:00
Fix FP for always-locked fields
This commit is contained in:
@@ -68,7 +68,9 @@ predicate alwaysLocked(Field f) {
|
||||
or
|
||||
exists(RefType thisType |
|
||||
forex(VarAccess access |
|
||||
access = f.getAnAccess() and not access.getEnclosingCallable() instanceof InitializerMethod
|
||||
access = f.getAnAccess() and
|
||||
not access.getEnclosingCallable() instanceof Constructor and
|
||||
not access.getEnclosingCallable() instanceof InitializerMethod
|
||||
|
|
||||
locallySynchronizedOnThis(access, thisType)
|
||||
)
|
||||
|
||||
@@ -14,10 +14,10 @@ class FieldAlwaysLocked {
|
||||
protected synchronized void checkOut() {
|
||||
Object o;
|
||||
if (field.size() > 0) {
|
||||
Enumeration e = field.keys(); // $ SPURIOUS: Alert
|
||||
Enumeration e = field.keys();
|
||||
while (e.hasMoreElements()) {
|
||||
o = e.nextElement();
|
||||
field.remove(o); // $ SPURIOUS: Alert
|
||||
field.remove(o);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user