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?
We’ve been facing the same problem and had hoped that waiting would bring a solution. Since that hasn’t been the case so far, we’d really appreciate it if this issue could be picked up soon. It’s starting to become a recurring frustration for us in our daily work as well and would be great to see some movement on it.