Hello, regarding the Kotlin inspection `Useless ca...
# intellij
o
Hello, regarding the Kotlin inspection
Useless call on not null type
which reports the likes of
String?.orEmpty
on not-null variables. Is there a way to extend this inspection to user functions? I have a helper
BigDecimal?.orZero() = this ?: BigDecimal.ZERO
and I'd like the IDE to report useless calls for it.
b
from a very quick glance at the source, it doesn't look like so
thank you color 1
d
Btw, you can “fork” most inspections in LivePlugin like this https://gist.github.com/dkandalov/634dfc88ac92dcbc7f7e0df66ff8f9ba Although this one won’t report
BigDecimal.ONE.orZero()
out-of-the-box because
ONE
is a platform type. It will only work if you tweak the inspection code or do
BigDecimal.ONE!!.orZero()
.
🚀 1
o
That's really cool!
K 1