SonarCloud, Unused import false positive in Dagger2 module

Products Used

  • SonarCloud - Problem started to occur from 22nd of November. I cannot find the Sonarcloud version.

Example False Positive Unused Imports

I am using the Dagger2 library and Sonarcloud has reported the following unused import even though it is used.

import dagger.Module

object ApiClientModule {

SonarCloud reports the an Remove unused import for the import dagger.Module line. If I remove that line then the code will not compile because the annotation @Module comes from dagger.Module.

My issue is similar to Unused import false positives. Looking at [SONARKT-139] S1128: FP despite reference to constant in companion object of target class - SonarSource it says it is fixed but is this deployed to Sonarcloud?

Hello Ersen,

Welcome to the community!

Thanks for the bug report. The issue you are referring has been fixed and the fix is deployed on SonarCloud. However, there is another issue with this rule, which we are currently in the process of fixing: [SONARKT-182] S1128: FP on imports for delegates and "in" "!in" operators - SonarSource. Once we are done with this ticket, you should not see these FPs anymore.

Great! thank you

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.