This question already has an answer here:
- When is an IntStream actually closed? Is SonarQube S2095 a false positive for IntStream? 1 answer
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?