Inspectopedia Help

Synchronization on a non-final field

Reports synchronized statement lock expressions that consist of a non-final field reference. Such statements are unlikely to have useful semantics, as different threads may acquire different locks even when operating on the same object.


private Object o; public void foo() { synchronized (o) // synchronization on a non-final field { } }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023