Move under debug log message when nested class is not found

To avoid freezes and useless reporting calculations

#KTIJ-25465 Fixed


Merge-request: KT-MR-10996
Merged-by: Vladimir Dolzhenko <Vladimir.Dolzhenko@jetbrains.com>
This commit is contained in:
Vladimir Dolzhenko
2023-07-08 07:18:09 +00:00
committed by Space Team
parent b5eafb9eb7
commit c1b70a7303
@@ -253,25 +253,27 @@ private class ClassClsStubBuilder(
val (nameResolver, classProto, _, sourceElement) =
c.components.classDataFinder.findClassData(nestedClassId)
?: c.components.virtualFileForDebug.let { rootFile ->
val outerClassId = nestedClassId.outerClassId
val sortedChildren = rootFile.parent.children.sortedBy { it.name }
val msgPrefix = "Could not find data for nested class $nestedClassId of class $outerClassId\n"
val explanation = when {
outerClassId != null && sortedChildren.none { it.name.startsWith("${outerClassId.relativeClassName}\$a") } ->
// KT-29427: case with obfuscation
"Reason: obfuscation suspected (single-letter name)\n"
else ->
// General case
""
if (LOG.isDebugEnabled) {
val outerClassId = nestedClassId.outerClassId
val sortedChildren = rootFile.parent.children.sortedBy { it.name }
val msgPrefix = "Could not find data for nested class $nestedClassId of class $outerClassId\n"
val explanation = when {
outerClassId != null && sortedChildren.none { it.name.startsWith("${outerClassId.relativeClassName}\$a") } ->
// KT-29427: case with obfuscation
"Reason: obfuscation suspected (single-letter name)\n"
else ->
// General case
""
}
val msg = msgPrefix + explanation +
"Root file: ${rootFile.canonicalPath}\n" +
"Dir: ${rootFile.parent.canonicalPath}\n" +
"Children:\n" +
sortedChildren.joinToString(separator = "\n") {
"${it.name} (valid: ${it.isValid})"
}
LOG.debug(msg)
}
val msg = msgPrefix + explanation +
"Root file: ${rootFile.canonicalPath}\n" +
"Dir: ${rootFile.parent.canonicalPath}\n" +
"Children:\n" +
sortedChildren.joinToString(separator = "\n") {
"${it.name} (valid: ${it.isValid})"
}
LOG.info(msg)
return
}
createClassStub(classBody, classProto, nameResolver, nestedClassId, sourceElement, c)