False positive: Unnecessary imports (S1128)

Please provide

  • Operating system: Windows
  • SonarLint plugin version: 7.1.1.54565
  • Programming language you’re coding in: Kotlin
  • Is connected mode used: No
    • Connected to SonarCloud or SonarQube (and which version):

And a thorough description of the problem / question:

Even though all imports are already optimize in Android Studio, the SonarLint still shows warning about unused import with Flows despite it is being used.

With warning

import kotlinx.coroutines.flow.SharingStarted
import kotlinx.coroutines.flow.emitAll
import kotlinx.coroutines.flow.flow
import kotlinx.coroutines.flow.map
import kotlinx.coroutines.flow.shareIn

Without warning
import kotlinx.coroutines.flow.*

But I think the first one should have no issue and instead more encourage to do.

1 Like

Hello!

Thank you for the report.

It is possible that the rule is misfiring here. Could you please provide a simple reproducer where you see this issue so that we can investigate further?

Thank you!