Inspectopedia Help

Synchronization on local variable or method parameter

Reports synchronization on a local variable or parameter.

It is very difficult to guarantee correct operation when such synchronization is used. It may be possible to improve such code, for example, by controlling access using a synchronized wrapper class or by synchronizing on a field.


void bar() { final Object lock = new Object(); synchronized (lock) { } }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023