The following code will trigger rule S2589 because SonarLint thinks that the value cannot be null:
import javax.validation.constraints.NotNull;
@NotNull(groups = { SpecialValidation.class })
public Long getSomeLong() {
return theLong;
}
public void failS2589() {
if(getSomeLong() == null) {
throw new RuntimeException("SonarLint flags the condition above as being always false (S2859)")
}
}
However, the validation is conditional so null is a possibility