Files
kotlin/compiler/testData/codegen/reflection/classLoaders/differentClassLoaders.kt
Alexander Udalov 50dbda1e1a Introduce KClass.members, make properties/extensionProperties extensions
To avoid significant growth of KClass and KPackage interfaces
2015-07-29 21:36:36 +03:00

24 lines
606 B
Kotlin
Vendored

package test
import kotlin.reflect.*
import kotlin.test.*
class K(val p: String)
class Test {
fun kClass(): Any = K::class
fun doTest(k1: KClass<*>, k2: KClass<*>) {
// KClass instances for classes loaded with different class loaders should have the same string representation,
// but should not be equal
assertEquals("$k1", "$k2")
assertNotEquals(k1, k2)
// The same for properties of these classes
val p1 = k1.properties.first()
val p2 = k2.properties.first()
assertEquals("$p1", "$p2")
assertNotEquals(p1, p2)
}
}