I encountered a subtle difference between Boolean
and other primitives:
@Test
fun test() {
println(java.lang.Boolean::class.java.name)
println(Boolean::class.java.name)
println(java.lang.Number::class.java.name)
println(Number::class.java.name)
println(java.lang.String::class.java.name)
println(String::class.java.name)
println(java.lang.Boolean::class.qualifiedName)
println(Boolean::class.qualifiedName)
println(java.lang.Number::class.qualifiedName)
println(Number::class.qualifiedName)
println(java.lang.String::class.qualifiedName)
println(String::class.qualifiedName)
}
Prints:
java.lang.Boolean
boolean
java.lang.Number
java.lang.Number
java.lang.String
java.lang.String
kotlin.Boolean
kotlin.Boolean
kotlin.Number
kotlin.Number
kotlin.String
kotlin.String
Does anyone know why?