- SonarQube 9.2.4 (build 50792)
- sonar-kotlin-plugin 184.108.40.2068
When using arithmetic operators on interfaces with BigDecimal methods we have to import compareTo methods like:
ICurrencyValue.compareTo(other: ICurrencyValue) : Int
Unfortunately, Sonar reports such imports as unused and marks it as Code Smell (Unnecessary imports should be removed).
Obviously we can’t remove it, because of “Unresolved reference. None of the following candidates is applicable because of receiver type mismatch:
public fun String.compareTo(other: String, ignoreCase: Boolean = …): Int defined in kotlin.text” error in compilation.