Separate decompiled declarations light representations from LightClasses
Fixed #KT-39457
This commit is contained in:
@@ -41,6 +41,7 @@ import org.jetbrains.kotlin.idea.refactoring.fqName.getKotlinFqName
|
||||
import org.jetbrains.kotlin.j2k.ReferenceSearcher
|
||||
import org.jetbrains.kotlin.j2k.ast.Nullability
|
||||
import org.jetbrains.kotlin.lexer.KtTokens
|
||||
import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.nj2k.symbols.*
|
||||
import org.jetbrains.kotlin.nj2k.tree.*
|
||||
import org.jetbrains.kotlin.nj2k.tree.JKLiteralExpression.LiteralType.*
|
||||
@@ -129,11 +130,15 @@ class JavaToJKTreeBuilder constructor(
|
||||
JKImportStatement(JKNameIdentifier(rawName))
|
||||
else null
|
||||
}
|
||||
|
||||
fun KtLightClassForDecompiledDeclaration.fqName(): FqName =
|
||||
kotlinOrigin?.fqName ?: FqName(qualifiedName.orEmpty())
|
||||
|
||||
val name =
|
||||
target.safeAs<KtLightElement<*, *>>()?.kotlinOrigin?.getKotlinFqName()?.asString()
|
||||
?: target.safeAs<KtLightClass>()?.containingFile?.safeAs<KtFile>()?.packageFqName?.asString()?.let { "$it.*" }
|
||||
?: target.safeAs<KtLightClassForFacade>()?.fqName?.parent()?.asString()?.let { "$it.*" }
|
||||
?: target.safeAs<KtLightClassForDecompiledDeclaration>()?.fqName?.parent()?.asString()?.let { "$it.*" }
|
||||
?: target.safeAs<KtLightClassForDecompiledDeclaration>()?.fqName()?.parent()?.asString()?.let { "$it.*" }
|
||||
?: rawName
|
||||
|
||||
return JKImportStatement(JKNameIdentifier(name))
|
||||
|
||||
Reference in New Issue
Block a user