diff --git a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/moduleByClassLoader.kt b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/moduleByClassLoader.kt index de9e272a899..c092c5257f3 100644 --- a/core/reflection.jvm/src/kotlin/reflect/jvm/internal/moduleByClassLoader.kt +++ b/core/reflection.jvm/src/kotlin/reflect/jvm/internal/moduleByClassLoader.kt @@ -31,7 +31,7 @@ private class WeakClassLoaderBox(classLoader: ClassLoader) { // Identity hash code is saved because otherwise once the weak reference is GC'd we cannot compute it anymore val identityHashCode: Int = System.identityHashCode(classLoader) - // Temporary strong reference to the class loader to ensure it won't get GC'd when we're inserting this box into the map + // Temporary strong reference to the class loader to ensure it won't get GC'd while we're inserting this box into the map var temporaryStrongRef: ClassLoader? = classLoader override fun equals(other: Any?) = @@ -39,6 +39,9 @@ private class WeakClassLoaderBox(classLoader: ClassLoader) { override fun hashCode() = identityHashCode + + override fun toString() = + ref.get()?.let { it.toString() } ?: "" } private fun Class<*>.getOrCreateModule(): RuntimeModuleData {