我有下一个代码:
private Stream<Field> getStreamWithAccessibleFields(final Object object) {
return Arrays.stream(object.getClass()
.getDeclaredFields()).peek(field -> field.setAccessible(true));
}
Sonar 向我抛出了一个问题:[MINOR] 关闭此流".鱿鱼:S2095.谁能给个建议,我该如何处理这个问题?
Sonar throws me an issue: [MINOR] Close this "Stream". squid:S2095. Can anybody give an advice, how I can handle this problem?
这是一个误报,已经修复,很快将与 SonarQube Java 3.14 一起发布.
This is a false positive that is already fixed and soon to be released with SonarQube Java 3.14.
如需进一步参考,请查看SONARJAVA-1478.
For further reference, please check SONARJAVA-1478.
这篇关于Sonar 想要关闭 Stream的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!