Thanks for the bug report and the PR with the minimal example. The underlying issue seems to the same as reported here: FP java:S2259 Optional.map(). We are aware of the issue and took note of your example. Thanks again for sharing.
This false positive starts to become a daily issue for me and the bye far most annoying thing about SonarQube. If you are working with a library that uses JSpecify, you will constantly mark Sonar issues “false positive”, leading to cry-wolf syndrome. Is there any timeline when this will be fixed?