Inspectopedia Help

Non-private field accessed in 'synchronized' context

Reports non-final, non-private fields that are accessed in a synchronized context.

A non-private field cannot be guaranteed to always be accessed in a synchronized manner, and such "partially synchronized" access may result in unexpectedly inconsistent data structures.


class Bar { public String field1; } public Bar myBar; synchronized public void sample() { myBar.field1 = "bar"; }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023