<@U8FF3PTMY> `reified` in Kotlin only reifies clas...
# announcements
e
@sabag.ronen
reified
in Kotlin only reifies classes, but it does not reify types. Now
String
and
String?
are different types, but they have the same class.
🤔 1
👍 1
s
@sabag.ronen
inline fun <reified T> isNullable() = null is T
should work
👏 1
but it does not reify types
@elizarov this is working for me (Kotlin 1.2):
Copy code
inline fun <reified T> isNullable() = null is T

fun main(args: Array<String>) {
  println(isNullable<String>())
  println(isNullable<String?>())
}
Copy code
false
true
s
@snrostov you are right, it is working!!!!!!😀 Thanks a lot
s
It turns out this hack is already mentioned here https://youtrack.jetbrains.com/issue/KT-15992#comment=27-2652752 😀
s
I have looked at this issue today and somehow missed it… Once again thanks