Java stream pipeline, terminal method toList not acknowledged

Hello,

  • versions used : * Community Edition - Version 8.9.3 (build 48735)
  • minimal code sample to reproduce :
List<Integer> intList = new ArrayList();
List<String> output = intList.stream().map(id -> id.toString()).toList();

I am having the following issue “Refactor the code so this stream pipeline is used.”

It seem that the toList() method is not taken into account.

Is this the same issue as the one in the next link ?

https://jira.sonarsource.com/browse/SONARJAVA-3746

Thank you for your attention

Hello @ciordache and welcome to the community!

Is this the same issue as the one in the next link ?

Almost, the exact ticket is the following: SONARJAVA-3784, fixed in version 7.1 of the analyzer, included in SonarQube >= 9.0.

In addition, the quality of the analysis of Java 16 code was not guaranteed in version 8.9.3, you should consider updating your SonarQube version. You will also benefit from our latest Java 16 rules.

Hope it clarifies the situation.
Best,
Quentin

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