We are using SonarJava for Java code analysis. We are facing a problem that SonarJava cannot detect Java 11 isEmpty as valid null testing for Optional Class (The code sample is shown in below picture, violated rule: squid:S3655). We did try follow suggestion in rule to use ! isEmpty() but it doesn’t work. I can see there is a Jira log SONARJAVA-3087 which is discussing the same problem and this problem should be fixed in version 5.12.1. But, our version is newer than 5.12.1. Is there way to handle this problem?
SonarQube & relevant plugin version:
- SonarQube Developer edition, the version is 220.127.116.11448
- SonarJava version is 5.14 (build 18788)
Reference Jira ticket: