Use ClassId instead of FqName in JavaToKotlinClassMap

Extract mapJavaToKotlin which returns ClassId and needs no KotlinBuiltIns
instance
This commit is contained in:
Alexander Udalov
2016-10-13 19:54:27 +03:00
parent 0e9f29fdba
commit 2f81d48f5e
5 changed files with 63 additions and 65 deletions
@@ -56,7 +56,6 @@ import org.jetbrains.kotlin.psi.debugText.getDebugText
import org.jetbrains.kotlin.psi.psiUtil.getElementTextWithContext
import org.jetbrains.kotlin.psi.stubs.KotlinClassOrObjectStub
import org.jetbrains.kotlin.resolve.DescriptorUtils
import org.jetbrains.kotlin.resolve.descriptorUtil.builtIns
import java.util.*
import javax.swing.Icon
@@ -411,11 +410,10 @@ abstract class KtLightClassForSourceDeclaration(protected val classOrObject: KtC
if (qualifiedName == DescriptorUtils.getFqName(classDescriptor).asString()) return true
val fqName = FqNameUnsafe(qualifiedName)
val mappedDescriptor =
val mappedQName =
if (fqName.isSafe)
JavaToKotlinClassMap.INSTANCE.mapJavaToKotlin(fqName.toSafe(), classDescriptor.builtIns)
JavaToKotlinClassMap.INSTANCE.mapJavaToKotlin(fqName.toSafe())?.asSingleFqName()?.asString()
else null
val mappedQName = if (mappedDescriptor == null) null else DescriptorUtils.getFqName(mappedDescriptor).asString()
if (qualifiedName == mappedQName) return true
for (superType in classDescriptor.typeConstructor.supertypes) {