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

By default bundled with:

IntelliJ IDEA 2024.1, Qodana for JVM 2024.1,

Can be installed with plugin:

Java, 241.14841

Last modified: 12 March 2024