为什么 sonarLint 在 Stream.of() 而不是在 .stream() 上说 'Close this "Stream"'

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

我在eclipse中使用sonarLint插件

在这一行我得到 'Close this "Stream"'

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

但不在

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

我不明白为什么两条线上的信息不同。 我不确定这是 java 问题还是 sonarlint 问题。

这个问题已在 java 插件的即将发布的版本 (3.14) 中修复:https://jira.sonarsource.com/browse/SONARJAVA-1478

有关详细信息,请参阅其他问题:When is an IntStream actually closed?