S1168 FP Best practice Spring Batch raise a Return an empty collection instead of null

versions used : SonarQube : 5.6.1, Java Language

The above code raise a Return an empty collection instead of null. but it’s a best practice from Spring team : https://docs.spring.io/spring-batch/4.0.x/api/org/springframework/batch/item/ItemProcessor.html

    public List<EnrichedDSNLine> process(List<DSNLine> dsnLines) {
        if (dsnLines.isEmpty()) {
            log.warn("process launched but no input lines...'");
            return null;


Anybody have an idea ?



Hi Stef,

The current version of SonarQube is 7.7, and the current LTS is 6.7.6. You’re going to have a hard time finding support for versions older than those. You should upgrade at your earliest convenience.


Thanks for your answer, I try to update to the last LTS version but the RPM repo doesn’t have the 6.76.
I use this repo : http://downloads.sourceforge.net/project/sonar-pkg/rpm.

Did you know if the RPM repo change ?


IIRC, the RPM repo was somebody’s side project. Official download is here: https://www.sonarqube.org/downloads/


I finally upgrage my sonarqube version : 6.7.7 LTS and I have always the false positive.
Is there a way that the issue will not appear in SpringBatch context ?



hello @philippart-s,

you are right that there should be an exception for the implementations of this interface, I created the ticket to improve the rule https://jira.sonarsource.com/browse/SONARJAVA-3101