Screenshot from 2018-10-15 15-46-16.png
# android
p
Screenshot from 2018-10-15 15-46-16.png
e
Put
@SuppressWarnings
on class definition
g
I usually just believe to Kotlin plugin to suppress any code
p
I definately don't want to suppress the warning for the whole class, only for this one statement
g
Do you have any other options on Alt+Enter suggestions?
b
Just out of curiosity, why would you want to run this code that seemingly does nothing? (Note, I'm not an Android dev)
p
It's an example for when to suppress sth
@gildor It suggests to put
@SuppressLint("CheckResult")
before the init block
Then it fails to compile with the message, that the annotation is not applicable to the target
initializer
g
Ahhh, this is lint warning
I would report this issue to Android issue tracker to support Kotlin @Suppress annotation for lint rules
I also had a couple cases when couldn't use suppress for lint warnings
p
Suppress
just supresses everything
@Suppress("TrueIsFalse")
also suppresses this 😕
w
You're essentially doing nothing here. You whether subscribe to your single or assign this Single to a property. Other wise you just writing code that will never excuted
r
Why would you even suppress that. It literally isn't used lol
It's like trying to suppress the truth lol
@Supprees Unused .... something like that.
p
Dudes, it's an example
r
oh my bad😂 @SuppressWarnings(“unused”)
p
Read the thread please
r
hmm I see what you mean but if you put the anontation inside the init block{} wont it work?
p
Nope, I first try and then ask 😉
a
You can make an init function and then call it from init. You lose the ability to initialize final variables without warning though.
g
Just realised that
@Suppress
also works, at least for IDE (not sure about Lint):
Copy code
init {
@Suppress("CheckResult")
Single.just(1).map { 1 }
}