Inspectopedia Help

Access to static field locked on instance data

Reports accesses to a non-constant static field which is locked on either this or an instance field of this.

Locking a static field on instance data does not prevent the field from being modified by other instances, and thus may result in surprising race conditions.


static String s; def foo() { synchronized (this) { System.out.println(s); // warning } }

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Groovy, 233.SNAPSHOT

Last modified: 13 July 2023