- What language is this for? *Java
- Which rule? java:S6857
- Why do you believe it’s a false-positive/false-negative?
- using SonarCloud
Here’s an example that is reported by Sonar :
public class TestConfiguration {
@Value("${anyValue:}")
private String anyString;
}
This sets the value of anyValue to the anyString variable, and an empty string if anyValue is null.
Documented here : https://www.baeldung.com/spring-value-defaults#string-defaults
Removing the comma fixes the issue, but it also changes the behaviour of the code.