Files
kotlin-fork/compiler/testData/codegen/box/reflection/jvmKPackageCaching.kt
T
Vsevolod Tolstopyatov c6cbab43f7 Introduce KClass-based cache for KPackageFragment
* It is a heavy-weight object that is hard to compute
* It is being constructed each type _cached_ method ref is used in equals/hashCode
* Module name is deliberately ignored, corresponding doc is added where appropriate 

#KT-48136

Merge-request: KT-MR-6817
Merged-by: Vsevolod Tolstopyatov <qwwdfsad@gmail.com>
2022-08-08 15:57:56 +00:00

14 lines
317 B
Kotlin
Vendored

// TARGET_BACKEND: JVM_IR
// FULL_JDK
// WITH_REFLECT
import kotlin.jvm.internal.*
class A
fun box(): String {
val pckg = Reflection.getOrCreateKotlinPackage(A::class.java)
System.gc()
val pckg2 = Reflection.getOrCreateKotlinPackage(A::class.java)
if (pckg === pckg2) return "OK"
return "Fail"
}