Sonar wants to close the Stream [duplicate]

2019-02-21 11:20发布

I have a next code:

private Stream<Field> getStreamWithAccessibleFields(final Object object) {
    return Arrays.stream(object.getClass()
            .getDeclaredFields()).peek(field -> field.setAccessible(true));
}

Sonar throws me an issue: [MINOR] Close this "Stream". squid:S2095. Can anybody give an advice, how I can handle this problem?

1条回答
叛逆
2楼-- · 2019-02-21 11:50

This is a false positive that is already fixed and soon to be released with SonarQube Java 3.14.

For further reference, please check SONARJAVA-1478.

查看更多
登录 后发表回答