SonarJava cannot detect Java 11 Optional isEmpty as null testing

Hello @Quentin,

I m not sure the why your reduced code is Ok.

I also tried an add the similar code to another sample java project. It shows the same problem (issue is in line 61, but i should check empty in line 57) .


The quality profile for this project is still “(Java) Sonar way” . Our SonarJava is still 5.14 (build 18788)

I can see a message “WARN: SonarScanner will require Java 11+ to run starting in SonarQube 8.x” in scanner log, but we are using version 7.9.1.27448. The case should not related to java 11 of sonar scanner, right?
I can see two more warn messages in the log:
#1
WARN: SCM provider autodetection failed. Please use “sonar.scm.provider” to define SCM of your project, or disable the SCM Sensor in the project settings.

#2
WARN: Bytecode of dependencies was not provided for analysis of source files, you might end up with less precise results. Bytecode can be provided using sonar.java.libraries property.

Are they related to the issue? or any other log / trace i can capture to provide more insight?

Jeffrey