I have a function in Kotlin that I want to inline despite not being high-order.
I find that through out the project I have numerous occurrences of such scenario.
Therefore, to ignore compiler warnings about using inline functions, I have to use lots of Suppress("NOTHING_TO_INLINE")
annotations through out my project and it's starting to bother me.
Is there any way to block this warning for the whole project by, for instance, a compiler option? I'd like to know how to do this in IntelliJ IDEA.
It doesn't look like it's possible to disable the inspection globally. I can't find a setting in IntelliJ at least. You can, however, disable the inspection for an entire file:
@file:Suppress("NOTHING_TO_INLINE")
If you press ALT+Enter on the warning, you'll get an option to suppress it which just contains suppressing for the function, class (if it's in one), or for the entire file. Any inspections you can disable usually has a "Disable inspection" option on this list (which NOTHING_TO_INLINE
does not have).
You can, however, disable the warnings when compiling (but it does not affect the inspection; you'll still see warnings while editing) by adding suppressWarnings
to the compileKotlin task. Note that this disables ALL warnings, not just specific ones.
compileKotlin {
kotlinOptions.suppressWarnings = true
}