kotlinx.serialization
kotlinx.serialization copied to clipboard
JVM compiler error after upgrading to 1.6.21
Describe the bug I'm trying to upgrade a project from Kotlin 1.6.10 and serialization 1.3.2 to Kotlin 1.6.21 and serialization 1.3.3. Compilation fails when trying to upgrade.
To Reproduce You can check out the project for which compilation is failing.
e: org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during IR lowering
File being compiled: /home/runner/work/carp.core-kotlin/carp.core-kotlin/carp.protocols.core/src/commonMain/kotlin/dk/cachet/carp/protocols/application/StudyProtocolSnapshot.kt
> Task :carp.protocols.core:compileKotlinJvm FAILED
The root cause java.lang.RuntimeException was thrown at: org.jetbrains.kotlin.backend.jvm.codegen.FunctionCodegen.generate(FunctionCodegen.kt:50)
at org.jetbrains.kotlin.backend.common.CodegenUtil.reportBackendException(CodegenUtil.kt:238)
...
Caused by: java.lang.RuntimeException: Exception while generating code for:
FUN name:write$Self visibility:public modality:FINAL <> (self:dk.cachet.carp.protocols.application.StudyProtocolSnapshot, output:kotlinx.serialization.encoding.CompositeEncoder, serialDesc:kotlinx.serialization.descriptors.SerialDescriptor) returnType:kotlin.Unit
annotations:
JvmStatic
...
I'm currently trying to pinpoint the exact issue. Maybe a regression? In the meantime, I hope the open-source project can already be of some help in identifying the issue.
Expected behavior Compilation to succeed, similar to how it did on Kotlin 1.6.10 and serialization 1.3.2.
Environment
- Kotlin version: 1.6.21
- Library version: 1.3.3
- Kotlin platforms: JVM
- Gradle version: 7.4
I can confirm this is a regression of https://github.com/Kotlin/kotlinx.serialization/issues/1770
The following is thus an easy repro:
@Serializable
data class Holder( val devices: WithParameters<*, *> )
@Serializable
abstract class WithParameters<T1 : Type1, T2 : Type2>
@Serializable
class Type1
@Serializable
class Type2
That's the same error as in #1692