[Stubs] Fix writing/reading multi file facades

The fixed error leaded to the invalid resolve of methods during
evaluation, e.g. kotlinx.coroutines#runBlocking should be called from
facade BuildersKt instead of BuildersKt__BuildersKt
This commit is contained in:
Alexey Merkulov
2023-08-15 20:59:51 +02:00
committed by Space Team
parent a6b3896552
commit 60d5de56cb
3 changed files with 10 additions and 7 deletions
@@ -185,7 +185,7 @@ internal open class StubBasedFirDeserializedSymbolProvider(
}
is KotlinStubOrigin.MultiFileFacade -> {
val className = JvmClassName.byInternalName(origin.className)
val facadeClassName = JvmClassName.byInternalName(origin.className)
val facadeClassName = JvmClassName.byInternalName(origin.facadeClassName)
JvmStubDeserializedFacadeContainerSource(className, facadeClassName)
}
else -> {
@@ -23,12 +23,12 @@ object KotlinStubVersions {
// Though only kotlin declarations (no code in the bodies) are stubbed, please do increase this version
// if you are not 100% sure it can be avoided.
// Increasing this version will lead to reindexing of all kotlin source files on the first IDE startup with the new version.
const val SOURCE_STUB_VERSION = 154
const val SOURCE_STUB_VERSION = 155
// Binary stub version should be increased if stub format (org.jetbrains.kotlin.psi.stubs.impl) is changed
// or changes are made to the core stub building code (org.jetbrains.kotlin.idea.decompiler.stubBuilder).
// Increasing this version will lead to reindexing of all binary files that are potentially kotlin binaries (including all class files).
private const val BINARY_STUB_VERSION = 92
private const val BINARY_STUB_VERSION = 93
// Classfile stub version should be increased if changes are made to classfile stub building subsystem (org.jetbrains.kotlin.idea.decompiler.classFile)
// Increasing this version will lead to reindexing of all classfiles.
@@ -10,6 +10,9 @@ import com.intellij.psi.stubs.StubOutputStream
sealed class KotlinStubOrigin {
companion object {
private const val FACADE_KIND = 1
private const val MULTI_FILE_FACADE_KIND = 2
@JvmStatic
fun serialize(origin: KotlinStubOrigin?, dataStream: StubOutputStream) {
if (origin == null) {
@@ -23,8 +26,8 @@ sealed class KotlinStubOrigin {
@JvmStatic
fun deserialize(dataStream: StubInputStream): KotlinStubOrigin? {
return when (dataStream.readInt()) {
Facade.KIND -> Facade.deserializeContent(dataStream)
MultiFileFacade.KIND -> MultiFileFacade.deserializeContent(dataStream)
FACADE_KIND -> Facade.deserializeContent(dataStream)
MULTI_FILE_FACADE_KIND -> MultiFileFacade.deserializeContent(dataStream)
else -> null
}
}
@@ -46,7 +49,7 @@ sealed class KotlinStubOrigin {
}
}
override val kind: Int get() = KIND
override val kind: Int get() = FACADE_KIND
override fun serializeContent(dataStream: StubOutputStream) {
dataStream.writeName(className)
@@ -67,7 +70,7 @@ sealed class KotlinStubOrigin {
}
}
override val kind: Int get() = Facade.KIND
override val kind: Int get() = MULTI_FILE_FACADE_KIND
override fun serializeContent(dataStream: StubOutputStream) {
dataStream.writeName(className)