Error 'unused local variables should be removed' issue in consumer interface

  • version:SonarQube :sonarqube: 8.1.31237

I used the foreach method of list,I defined a variable in it and used it.But sonarqube analyzed it as an issue -'unused local variables should be removed '.

After that, I changed the code to an enhanced loop, and the issue didn’t appear,

I didn’t find this problem when I used the previous version.

And I think it’s just a sonarqube issue, not a sonarlint issue.

In my project, I found that it only appears in the consumer interface, while other FunctionalInterface did not.


#bug:fault