-
Notifications
You must be signed in to change notification settings - Fork 667
Closed
Labels
Description
Describe the bug
I have started to got IndexOutOfBoundsException after upgrade to Kotlin 1.3.70/serialization 0.20.0
Stack trace:
List descriptor has only one child element, index: 1
java.lang.IndexOutOfBoundsException: List descriptor has only one child element, index: 1
at kotlinx.serialization.internal.ListLikeDescriptor.getElementDescriptor(CollectionDescriptors.kt:28)
at qbit.factorization.EntityEncoder.encodeSerializableElement(KSFactorization.kt:221)
at kotlinx.serialization.internal.ListLikeSerializer.serialize(CollectionSerializers.kt:76)
at qbit.factorization.EntityEncoder.encodeSerializableElement(KSFactorization.kt:257)
at qbit.test.model.EntityWithRefList.write$Self(TestModels.kt)
at qbit.test.model.EntityWithRefList$$serializer.serialize(TestModels.kt)
at qbit.test.model.EntityWithRefList$$serializer.serialize(TestModels.kt:33)
at qbit.factorization.KSFactorization.ksDestruct(KSFactorization.kt:51)
at qbit.typing.SerializationFactorizationTest$1.invoke(SerializationFactorizationTest.kt:43)
at qbit.typing.SerializationFactorizationTest$1.invoke(SerializationFactorizationTest.kt:42)
at qbit.typing.CommonFactorizationTest.Test that destruction of entity graph where the same not persisted entity occurs multiple times produces factorization that refers to the entity using the same Gid(CommonFactorizationTest.kt:209)
index was passed directly from CompositeEncoder.encodeSerializableElement parameter
To Reproduce
Currently I have no time to create minimal example (and since I have found workaround for it - it's not critical for me:) ). You can get d-r-q/qbit@0fa4a21, remove workaround here at https://github.com/d-r-q/qbit/blob/0fa4a21dfa27db3669069ede0d468e9516c5c6d8/qbit-core/src/commonMain/kotlin/qbit/factorization/KSFactorization.kt#L221 and run https://github.com/d-r-q/qbit/blob/0fa4a21dfa27db3669069ede0d468e9516c5c6d8/qbit-core/src/commonTest/kotlin/qbit/typing/CommonFactorizationTest.kt
Expected behavior
No IOOBE
Environment
- Kotlin version: 1.3.70
- Library version: 0.20.0
- Kotlin platforms: JVM, JS, Native
- Gradle version: 6.6.2