Thanks for your report. I was not able to reproduce the false positive based on the code you provided. Do you have a complete reproducer available or is the project in which you have observed this behavior public?
This particular rule uses the Kotlin compiler diagnostics directly and doesn’t actually perform an additional analysis itself. It looks like the compiler may not be able to resolve everything correctly. Could you please check which values you have set for sonar.java.binaries and sonar.java.libraries and if these values point to the correct locations?
We strongly recommend against not configuring these parameters properly, as Alexandre has already indicated in the other thread. The quality of the results will most certainly degrade.
If you really want to go down this road (again: we heavily recommend against this!), you can check if you have set the parameters to a dot (.) and you can try setting them to an empty string instead. This may get rid of some false positives, no guarantees though. If libraries and binaries are unknown to the analysis, you cannot expect the results as good as if they were known.
I agree with you that there is definitely room for improvement here and that some situations could be detected with higher precision, even if semantics are unavailable. I’ve created a ticket to track these FPs. Please be aware that tackling this issue is currently not the highest priority, so I cannot give you an exact ETA for a potential fix.
Quick update: the issue has been fixed at the end of 2021 and is deployed on SonarCloud. If you find any other false positives please report them in a new thread, I am going to close this one.