squid:S3655 (Optional use without isPresent) should not fire if .isEmpty() was called

java

(Arne Babenhauserheide) #1

We’re using Version 7.3 (build 15553) of SonarQube, and squid:S3655 fires a lot when people replace

if (!optional.isPresent()) {
    return;
}

with

if (optional.isEmpty()) {
    return;
}

The latter is the cleaner version available since Java 11.

It would be great if S3655 could be updated to accept optional.isEmpty() as an alias for !optional.isPresent().