From d59e1ad7ace21efb71229846022e8cd3b7af4c9d Mon Sep 17 00:00:00 2001 From: Alexander Udalov Date: Mon, 30 Mar 2015 13:50:51 +0300 Subject: [PATCH] Minor, add toString() to WeakClassLoaderBox for debug --- .../src/kotlin/reflect/jvm/internal/moduleByClassLoader.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 {