mirror of
https://github.com/jlengrand/kotlin.git
synced 2026-05-08 15:53:19 +00:00
To better emphasize the fact that all returned properties require an instance of the class they are declared in. Another issue was that 'Some::class.extensionProperties' was sometimes incorrectly perceived as "get all extension properties available on the class Some"
24 lines
618 B
Kotlin
Vendored
24 lines
618 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.memberProperties.first()
|
|
val p2 = k2.memberProperties.first()
|
|
assertEquals("$p1", "$p2")
|
|
assertNotEquals(p1, p2)
|
|
}
|
|
}
|