Dear Sonar community!
Using SonarLint 4.1.0.201901311043 I encountered the following false positive: S1143 reports that return statements should not be used inside finally blocks even if the return is in a lambda function.
Quick example, where the line return obj.length() > 42;
is identified as a return from the finally block, but actually it isn’t:
try {
// do something
}
finally {
List<String> list = new LinkedList<>();
// do something with the list
List<String> filtered = list.stream()
.filter(obj -> {
return obj.length() > 42;
})
.collect(Collectors.toList());
}
Expected result: this line should not be reported because it’s inside the lambda block.
Thank you, and I hope I can help to make this good product even better.