How to suppress warnings?


#1

I see the annotation here: http://jetbrains.github.io/kotlin/versions/snapshot/apidocs/kotlin/suppress.html And a blog post here: http://blog.jetbrains.com/kotlin/2013/10/m6-1-released/

How do I find out what String to pass to suppress? I tried a couple guesses – no luck.  Alt+Enter doesn’t seem to be working as described in the blog post. It doesn’t give me an option to add the suppress annotation.

Specifically I’m trying to suppress these 2 warnings:
Warning:(75, 25) Kotlin: The corresponding parameter in the supertype ‘ToJsonConverter’ is named ‘x’. This may cause problems when calling this function with named arguments.
Warning:(47, 44) Kotlin: Parameter ‘req’ is never used

Rob


#2

If you are in the IDE, press Alt+Enter and navigate to suppression action:

http://screencast.com/t/2ppaRFRhRV


#3

Ah, thanks. I was clicking it, but needed to hit the right arrow instead to show the submenu.

Rob


#4

doesn’t work for when expression that is not exhaustive :c


#5

If it’s a ‘when’ expression (as opposed to a statement), then it has to be exhaustive otherwise it won’t compile.

Can’t say I’ve tried to suppress the warning you get if the ‘when’ statement is not exhaustive as I think it’s good practice to make it so in any case.


#6

oh yeah, typo, I meant as a statement. There are simply cases where it does not need to be exhaustive, because it’s only an if-else replacement to handle some cases