CodeQL library for Java/Kotlin
codeql/java-all 7.8.3-dev (changelog, source)
Search

Module Monitors

This module provides predicates, chiefly locallyMonitors, to check if a given expression is synchronized on a specific monitor.

Import path

import semmle.code.java.Concurrency

Predicates

getNodeToBeDominated

Gets the control flow node that must dominate e when e is synchronized on a lock.

locallyLockedOn

Holds if e is synchronized on the Lock lock by a locking call.

locallyMonitors

Holds if the expression e is synchronized on the monitor m.

Classes

ClassMonitor

A class used as a monitor. This is achieved by marking a static method as synchronized.

InstanceMonitor

An instance reference used as a monitor. Either via synchronized (this) { ... } or by marking a non-static method as synchronized.

LockField

A field storing a lock.

Monitor

A monitor is any object that is used to synchronize access to a shared resource. This includes locks as well as variables used in synchronized blocks (including this).

VariableMonitor

A variable used as a monitor. The variable is either a lock or is used in a synchronized block. E.g synchronized (m) { ... } or m.lock();

Datatypes

TMonitor

A monitor is any object that is used to synchronize access to a shared resource. This includes locks as well as variables used in synchronized blocks (including this).