Inspectopedia
 
2024.3

Field accessed in both 'synchronized' and unsynchronized contexts

Warning
New
Last modified: 03 December 2024

Reports non-final fields that are accessed in both synchronized and non-synchronized contexts. volatile fields as well as accesses in constructors and initializers are ignored by this inspection.

Such "partially synchronized" access is often the result of a coding oversight and may lead to unexpectedly inconsistent data structures.

Example:

Use the option to specify if simple getters and setters are counted as accesses too.