KT-37144 Respect quotes in package name during decompilation

- Odd package names (for example `try` in `arrow-core`) were pasted
as-is to the decompiled text
- Because of this, stub checks were failing, forcing completion to start
over and over again, as if something changed in the files
- See EA-5572315 for the error
- ^KT-37144 Fixed
This commit is contained in:
Roman Golyshev
2020-04-10 20:26:59 +03:00
committed by Alexander Podkhalyuzin
parent ec9c7c98cd
commit d7667209b2
6 changed files with 45 additions and 2 deletions
@@ -8,6 +8,7 @@ package org.jetbrains.kotlin.idea.decompiler.textBuilder
import com.intellij.openapi.util.TextRange
import org.jetbrains.kotlin.contracts.description.ContractProviderKey
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.idea.core.quoteIfNeeded
import org.jetbrains.kotlin.idea.decompiler.navigation.ByDescriptorIndexer
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.psi.psiUtil.quoteIfNeeded
@@ -46,7 +47,7 @@ fun buildDecompiledText(
builder.append("// IntelliJ API Decompiler stub source generated from a class file\n" + "// Implementation of methods is not available")
builder.append("\n\n")
if (!packageFqName.isRoot) {
builder.append("package ").append(packageFqName).append("\n\n")
builder.append("package ").append(packageFqName.quoteIfNeeded()).append("\n\n")
}
}