kotlinx.serialization
kotlinx.serialization copied to clipboard
java.lang.IllegalAccessError when inline class is in different module and Proguard's on
If the inline class marked @Serializable
is in another kotlin module and Proguard is enabled, a java.lang.IllegalAccessError
occurs
If Proguard is disabled, no exception occurs: also if the entity is in the same module, no exception occurs.
Log crash: java.lang.IllegalAccessError: Final field 'e.c.b' cannot be written to by method 'java.lang.Object e.a.b(b0.b)' (declaration of 'e.a' appears in /data/app/~~VCTnd_psFPHb6iCMguQ8rg==/github.frosyaX.kotlinX_value_class_sample-sOua_23PZEkNu4nHKj-GrQ==/base.apk)
To Reproduce
A project that reproduces the issue: Android Project
or code:
app-android module
val serializer = SurveyConfig.serializer()
val config = Json.decodeFromString(serializer, """{ "test": "test"}""")
lib-kotlin module:
@JvmInline
@Serializable
value class SurveyConfig(
val data: Map<String, String>,
) : Map<String, String> by data
Also Proguard is enabled
Expected behavior
No-exception behavior
Environment
- Kotlin version: 1.8.20
- Library version: 1.5.0
- Kotlin platforms: JVM