Ternary seems to trick up SonarQube's optional.isPresent() check

This Java code:
return value.isPresent() ? Maybe.just(value.get()) : fetchAndReturn();
results in:
Optional value should only be accessed after calling isPresent()

It should not.

Version 6.7.3 (build 38370)

Hi @Charlie_Hayes, could you let us know which version of SonarJava is installed on your sonarqube instance ?

SonarJava version 5.10.1 (build 16922)

@Charlie_Hayes I can not reproduce. Could you provide a full code reproducer? (with declarations)