diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorAwareStringTable.kt b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorAwareStringTable.kt index ae9d90e7fe7..1200b801755 100644 --- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorAwareStringTable.kt +++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorAwareStringTable.kt @@ -8,21 +8,26 @@ package org.jetbrains.kotlin.serialization import org.jetbrains.kotlin.descriptors.ClassifierDescriptorWithTypeParameters import org.jetbrains.kotlin.metadata.serialization.StringTable import org.jetbrains.kotlin.name.ClassId +import org.jetbrains.kotlin.renderer.DescriptorRenderer import org.jetbrains.kotlin.resolve.descriptorUtil.classId import org.jetbrains.kotlin.types.ErrorUtils interface DescriptorAwareStringTable : StringTable { fun getFqNameIndex(descriptor: ClassifierDescriptorWithTypeParameters): Int { if (ErrorUtils.isError(descriptor)) { - throw IllegalStateException("Cannot get FQ name of error class: $descriptor") + throw IllegalStateException("Cannot get FQ name of error class: ${renderDescriptor(descriptor)}") } val classId = descriptor.classId ?: getLocalClassIdReplacement(descriptor) - ?: throw IllegalStateException("Cannot get FQ name of local class: $descriptor") + ?: throw IllegalStateException("Cannot get FQ name of local class: ${renderDescriptor(descriptor)}") return getQualifiedClassNameIndex(classId.asString(), classId.isLocal) } fun getLocalClassIdReplacement(descriptor: ClassifierDescriptorWithTypeParameters): ClassId? = null + + private fun renderDescriptor(descriptor: ClassifierDescriptorWithTypeParameters): String = + DescriptorRenderer.COMPACT.render(descriptor) + " defined in " + + DescriptorRenderer.FQ_NAMES_IN_TYPES.render(descriptor.containingDeclaration) }