Java 17 Collector toList() [False positive]

Must-share information (formatted with Markdown):

  • Community Edition - Version 8.9.6 (build 50800)
  • Plugin id ‘org.sonarqube’ version ‘3.3’ (Gradle)
  • Java introduced a new way to collect the result of a stream to a list like this
  • New way is
  • Old way is
    When using the new way, sonarqube shows a warning that the result of the stream is not used, but it is

Example of usage

Hello @Giovane_Garcia and welcome to the Sonar Community!

This is a known issue, it has been fixed in the Java analyzer version 7.1, available in SonarQube versions > 9.0. (see SONARJAVA-3784).

Note that many other new features and adjustments have been made related to Java 16/17, if you are using a recent Java version you should consider upgrading SonarQube.


1 Like

thank you Quentin, im gonna update right now

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.