https://kotlinlang.org logo
Title
e

eygraber

03/06/2017, 9:49 PM
Does it make sense that calling the following extension function on a null
String?
would print
int?
inline val <reified T : Any?> T.TAG get() = ((this as? Any)?.javaClass?.simpleName ?: "${T::class.java.simpleName ?: "null"}?").replace("CompanionObject", "")
m

mfulton26

03/06/2017, 10:28 PM
eygraber: I get "String?"
e

eygraber

03/06/2017, 10:30 PM
@mfulton26 using 1.1? Also, I'm running it on Android
m

mfulton26

03/06/2017, 10:30 PM
Yeah, 1.1, on my desktop
e

eygraber

03/06/2017, 10:30 PM
Interesting. Maybe Android fudges things around to handle nulls in dex? Thanks for your input though 😄
👍🏻 1
m

mfulton26

03/06/2017, 10:33 PM
Are you calling
TAG
on anything related to resources (which are `Int`s)? I guess I'm wondering what you get if you call
x.TAG
on
val x: String? = null
.
e

eygraber

03/06/2017, 11:47 PM
That's the case I was referring to. For that I get
int?
m

mfulton26

03/07/2017, 1:34 PM
Weird.