The Kotlin compiler gave me the following warning:
Warning:(399, 1) Kotlin: Expected performance impact of inlining '...' can be insignificant. Inlining works best for functions with lambda parameters
In this case I would like to suppress this warning. I don't know what value to give to @Suppress
, however, and I can't find any documentation for what values @Suppress
accepts.
What are the possible values that can be given to @Suppress
, and what do they mean?
Suppresses the given compilation warnings in the annotated element. <init>(vararg names: String)
detekt supports the Java ( @SuppressWarnings ) and Kotlin ( @Suppress ) style suppression. If both annotations are present, Kotlin's annotation is favored! To suppress an issue, the id of the issue must be written inside the values field of the annotation.
Instead of a single statement, you can also mark a function, a class or a file ( @file:Suppress("DEPRECATION") in its beginning) with the annotation to suppress all the deprecation warnings issued there. In IntelliJ IDEA this can also be done through Alt + Enter menu with caret placed on code with deprecation warning.
1 Answer. Show activity on this post. Adding @Suppress("UNCHECKED_CAST") (also possible through IDEA's Alt + Enter menu) to any of statement, function, class and file should help.
IntelliJ gives you nice help here:
Which adds @Suppress("NOTHING_TO_INLINE")
to resolve the warning.
Some of the possible names of the compiler diagnostics to suppress can be found in Errors.java and DefaultErrorMessages.java i.e.:
REDUNDANT_MODIFIER, "Modifier ''{0}'' is redundant because ''{1}'' is present"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With