mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-17 00:21:28 +00:00
Introduce KClass<T>.javaPrimitiveType and KClass<T>.javaObjectType
#KT-6319 Fixed
This commit is contained in:
24
compiler/testData/codegen/boxWithStdlib/reflection/javaProperties/javaReified.kt
vendored
Normal file
24
compiler/testData/codegen/boxWithStdlib/reflection/javaProperties/javaReified.kt
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
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"
|
||||
}
|
||||
Reference in New Issue
Block a user