Hi,
This is about the recent feature that allows for a quick fix on some of the warnings.
import java.util.Collection;
public class TestSonarS1125 {
Collection<?> collection;
boolean isNonEmpty() {
return collection == null ? false : !collection.isEmpty();
}
}
When I click on “Simplify the expression”, here is what happens:
boolean isNonEmpty() {
return !collection == null && !collection.isEmpty();
}
What is expected to happen:
boolean isNonEmpty() {
return collection != null && !collection.isEmpty();
}
- Operating system: Windows
- SonarLint plugin version: 7.4
- Is connected mode used: No
Thanks & regards,
Nicolas.