Hey folks, has anyone seeing an error like this once you add compose to a project with kotlin-serial...
k
Hey folks, has anyone seeing an error like this once you add compose to a project with kotlin-serialization?
Copy code
java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
	at java.base/jdk.internal.util.Preconditions.outOfBounds(Preconditions.java:64)
	at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Preconditions.java:70)
	at java.base/jdk.internal.util.Preconditions.checkIndex(Preconditions.java:248)
	at java.base/java.util.Objects.checkIndex(Objects.java:372)
	at java.base/java.util.ArrayList.get(ArrayList.java:459)
	at org.jetbrains.kotlinx.serialization.compiler.backend.ir.IrBuilderExtension$serializerInstance$1.invoke(GeneratorHelpers.kt:593)
	at org.jetbrains.kotlinx.serialization.compiler.backend.ir.IrBuilderExtension$serializerInstance$1.invoke(GeneratorHelpers.kt:592)
	at org.jetbrains.kotlinx.serialization.compiler.backend.ir.IrBuilderExtension$DefaultImpls.serializerInstance(GeneratorHelpers.kt:609)
    ...
I’m not even sure where to start debugging the actual issue since it seems to be within the compiler itself
c
Fwiw I’m using both kotlin serialization and compose together and it works well. I’m sorry I don’t have any help for your specific issue though
k
I am using kotlin-serialization:1.1.0, with compose:1.0.0-beta04, strangely enought when compose is disabled by removing:
Copy code
buildFeatures {
        compose true
    }

    composeOptions {
        kotlinCompilerVersion kotlin_version
        kotlinCompilerExtensionVersion compose_version
    }
I am able to build successfully.
r
That's definitely worth reporting, it's a compiler error. Probably to the compose tracker? Both probably wouldn't hurt though, I know there's some interoperability issues
k
Yeah, i think so! I think it might be related to the specific serializers that I have but since its a large project its hard to just enable and disable serializers. Is there a good way to debug the source?
For anyone stumbling on this in the future, i’ve managed to repro the issue and i’ve created a ticket here: https://github.com/Kotlin/kotlinx.serialization/issues/1438