We have found a problem with the Nullability analysis on the following Java code:
import org.jspecify.annotations.NullMarked;
@NullMarked
public class VolatileField {
private volatile String state;
public VolatileField(String state) {
this.state = state;
}
}
SonarQube is giving me the following error: SonarQube: "state" is marked "@NullMarked at class level" but is not initialized in this constructor
. However, the field is initialized in the constructor.
This happens for non-nullable volatile fields.
This was found on SonarQube Enterprise Edition v2025.1 (102418)