Is there an `@Ignore` declaration that I can add t...
# intellij
l
Is there an
@Ignore
declaration that I can add that will silence the warning:
Expected performance impact from inlining is insignificant. Inlining works best for functions with parameters of function types.
In my case, I have benchmarked, and it does make a small difference (which matters, because this is in the inner loop of a language interpreter) so I definitely want to keep it.
r
you can annotate the function with
@Suppress("NOTHING_TO_INLINE")
l
Thanks a lot. That's exactly what I was looking for. For the future, are these listed anywhere?
r
I normally discover these options by using the context menu on the warning (alt+enter), and in the submenu for the warning quickfix the relevant suppression is listed (if present)
plus1 1
l
Right, but for this specific warning, there is no such hint.
I also note that NOTHING_TO_INLINE appears to not be what I need. This warning is when I inline a function that does not accept a function argument, such as this:
Copy code
inline fun foo(x: String): Int = x.length
If I add
NOTHING_TO_INLINE
to that, then Idea complains that the suppression is unnecessary.
r
oh weird, when I use your code, I get the exact same warning you mentioned
then I go to more actions (alt+enter) and get the menu I showed earlier
and then the warning is gone when I apply the suppression
l
Oh wait, you're right. Sometimes it gives me a highlight, and sometimes not.
And I never get the warning in IDEA itself, only when I build with gradle.
It looks all fine in the editor:
r
hmm, when I add the suppression the gradle compile warning also disappears
l
I have to admit, I never tried recompiling with gradle, because when I added it, this warning showed up in the editor:
r
and when you remove the suppression on that specific method, the inline warning appears again? 🤔
d
There is actually a suppression for unnecessary suppression warnings. 🙂
xzibit 3
@Suppress("NOTHING_TO_INLINE", "KotlinRedundantDiagnosticSuppress")
l
Wow. Thanks 🙂