Inspectopedia
 
2024.3

Synchronization on a non-final field

Warning
New
Last modified: 03 December 2024

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.

Example: