*Disclaimer*: Since I use the `when` expression it...
# android
l
Disclaimer: Since I use the
when
expression it is kotlin related 😌 Can someone tell me why lint is warning it would be always true? This warning is new and must have come up after doing some depedency updates/ IDE update.
j
Since updates were done, have you tried invalidate cache/restart? I remember vaguely having seen weird lint errors after updating libraries
l
Unfortunately this didn't help. Shoud I reinstall? Any other ideas?
j
hmm other than reverting the library updates and see if the problem goes away, no
l
ok easy. There is still a possibility this is a bug. I consider to file an issue
j
Wait, I read too quickly. Have you checked that
connectAsClient
is not being called with the
secure
parameter with a true value in all cases?
l
@José González D'Amico good point but even when I remove the
when
it still warns about being always true. Meanwhile, I'm pretty sure this is a bug
c
From my point of view the warning is fine - you always return true in the run.
Move the return true outside the when call and you are fine.
❤️ 1
l
Damn you are right. But what has changed that it suddenly occurs?
c
Just a new lint check maybe. 🤷‍♂️
l
Makes sense. Thanks boss
t
I don't have the answer for you question, just suggest to rewrite
Copy code
try {
    val bluetoothSocket = if (secure) {
        ...
    } else {
        ...
    }
    socket = bluetoothSocket
    bluetoothSocket.connect()
    true
} catch (e: IOException) {
    false
}