Function argument treated as a mutable instance field in HttpServlet (squid S2226

  • SonarQube version 7.5 (build 20543)
  • SonarQube Scanner version 2.6.1
  • Intellij IDEA Ultimate Edition 2018.3.5, build #IU-183.5912.21, built on February 26, 2019
  • SonarLint v4.0.2.3009
import java.util.function.Function;
import javax.servlet.http.HttpServlet;

public class Servlet extends HttpServlet {
  private static final Function<Integer, Integer> SOME_FUN = param -> 1;
}

param is reported as a mutable instance field.

Hi, Thanks for the feedback, this is indeed a false positive : Ticket created to handle it : https://jira.sonarsource.com/browse/SONARJAVA-3145