Is there a way to suppress the warning of using java.lang.Object?


I can't seem to find a list/overview I can feed into the @suppress anotation. What string do I use to suppress the cast to java.lang.Object warning?

private val waitingThreads = AtomicInteger(0)

@suppress("<what goes here?>")
private val mutex = waitingThreads as Object


Try to search from here:



Actually, there should be quick fix available, did you try to press Alt+Enter on a warning?


I'd advice to use Any instead of Object, like:

private val mutex = waitingThreads as Any
private val mutex: Any = waitingThreads

Anyway You can use quick fix to fix or suppress any warning, like:



Yes, I did press altl-enter (OSX version, Idea 14 latest stable), doesn’t seem to have the option to disable it.


Thanks, that's really helpful!


In general I agree with you, that's why I think it's important the warning is there.

In this case I want to use of the wait/notify methods that come with this.
I don’t want to use classes like Locks and Semaphores because it would introduce extra instances and thus extra garbage. This is all for my promises library where I want/need to keep the garbage per promise as low as possible in order to be a viable solution on platforms like android where things like this seriously matter (to much garbage collections seriously degrades interface performance on android).


I had a similar issue at the end of yellow code and I created KT-8417, but I don't sure that it's the same. Could you please provide more information (e.g. plugin version, simple steps or simple project to reproduce).


Intellij Ultimate 14.1.4 Kotlin plugin: 0.12.613.Idea141.7 OSX 10.10.4

It doesn’t matter where I put the caret, simply doesn’t work. I use the previous mentioned code to reproduce it.