AA: use simple name of local type as JVM internal name
Otherwise, e.g., if a local type is within an anonymous object, full class id will include that anonymous object too, resulting in invalid type signature for PsiType. ^KT-59533 Fixed
This commit is contained in:
committed by
Ilya Kirillov
parent
2d178e5273
commit
a93bc60655
+8
-2
@@ -82,7 +82,9 @@ class FirJvmTypeMapper(val session: FirSession) : FirSessionComponent {
|
||||
|
||||
override fun getClassInternalName(typeConstructor: TypeConstructorMarker): String {
|
||||
require(typeConstructor is ConeClassLikeLookupTag)
|
||||
return typeConstructor.classId.asString().replace(".", "$").replace("/", ".")
|
||||
val classId = typeConstructor.classId
|
||||
val name = if (classId.isLocal) safeShortClassName(classId) else classId.asString()
|
||||
return name.replace(".", "$").replace("/", ".")
|
||||
}
|
||||
|
||||
override fun getScriptInternalName(typeConstructor: TypeConstructorMarker): String =
|
||||
@@ -230,7 +232,11 @@ class FirJvmTypeMapper(val session: FirSession) : FirSessionComponent {
|
||||
val result = runUnless(classId.isLocal) {
|
||||
classId.asSingleFqName().toUnsafe().let { JavaToKotlinClassMap.mapKotlinToJava(it)?.shortClassName?.asString() }
|
||||
}
|
||||
return result ?: SpecialNames.safeIdentifier(classId.shortClassName).identifier
|
||||
return result ?: safeShortClassName(classId)
|
||||
}
|
||||
|
||||
private fun safeShortClassName(classId: ClassId): String {
|
||||
return SpecialNames.safeIdentifier(classId.shortClassName).identifier
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user