Search code examples
sonarlintsonarlint-eclipse

Why is sonarLint saying 'Close this "Stream"' on Stream.of() but not on .stream()


I am using the sonarLint plugin in eclipse

On this line i get 'Close this "Stream"'

Stream.concat(Stream.of("a"), Stream.of("b")).collect(Collectors.toSet());

but not on

Arrays.asList("a", "b").stream().collect(Collectors.toSet());

I don't understand why not its not the same message on both lines. I am not sure if this is a java question or a sonarlint question.


Solution

  • This is an issue already fixed in the upcoming version (3.14) of the java plugin : https://jira.sonarsource.com/browse/SONARJAVA-1478

    See this other question for more details : When is an IntStream actually closed?