Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Suppress NOTHING_TO_INLINE warning globally

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.

like image 970
Riki137 Avatar asked Mar 07 '23 05:03

Riki137


1 Answers

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
}
like image 124
Zoe stands with Ukraine Avatar answered Mar 10 '23 12:03

Zoe stands with Ukraine