mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-09 15:53:37 +00:00
27 lines
578 B
Kotlin
Vendored
27 lines
578 B
Kotlin
Vendored
// WITH_REFLECT
|
|
|
|
import kotlin.reflect.KClass
|
|
|
|
inline fun <reified T : Any> check(expected: String) {
|
|
val clazz = T::class.java!!
|
|
assert (clazz.canonicalName == "java.lang.${expected.capitalize()}") {
|
|
"clazz name: ${clazz.canonicalName}"
|
|
}
|
|
}
|
|
|
|
fun box(): String {
|
|
check<Boolean>("boolean")
|
|
check<Char>("character")
|
|
check<Byte>("byte")
|
|
check<Short>("short")
|
|
check<Int>("integer")
|
|
check<Float>("float")
|
|
check<Long>("long")
|
|
check<Double>("double")
|
|
|
|
check<String>("String")
|
|
check<java.lang.Void>("Void")
|
|
|
|
return "OK"
|
|
}
|