Inspectopedia Help

Synchronization on a 'Lock' object

Reports synchronized blocks that lock on an instance of java.util.concurrent.locks.Lock. Such synchronization is almost certainly unintended, and appropriate versions of .lock() and .unlock() should be used instead.


final ReentrantLock lock = new ReentrantLock(); public void foo() { synchronized (lock) {} }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023