JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.92k stars 1.16k forks source link

Kotlin/Native klib dependencies reordering causes NPE from the compose compiler plugin during metadata compilation #3927

Open ShikaSD opened 10 months ago

ShikaSD commented 10 months ago

Describe the bug Originally reported in https://issuetracker.google.com/issues/294869453. The description below is copied for brevity.

Steps to Reproduce:

Effectively the api dependency changes the order of -library %libPath%.klib arguments passed to the K/N compiler. It could be seen in the attached files broken.txt and not-broken.txt. After some experiments with debugger I saw that compiling the working case and manually rewriting the order of dependencies does the thing – build fails.

ERROR: Exception while analyzing expression in (8,5) in %path_to_project%/KT-60761/shared/src/iosMain/kotlin/com/kopylovis/kmmcomposemuliplatformexample/MainViewController.kt

Attachments:
causeThrowable
java.lang.NullPointerException
        at androidx.compose.compiler.plugins.kotlin.k1.AnnotationUtilsKt$makeComposableAnnotation$1.getType(AnnotationUtils.kt:38)
        at org.jetbrains.kotlin.resolve.descriptorUtil.DescriptorUtilsKt.getAnnotationClass(DescriptorUtils.kt:402)
        at org.jetbrains.kotlin.descriptors.annotations.AnnotationDescriptor$DefaultImpls.getFqName(AnnotationDescriptor.kt:34)
        at androidx.compose.compiler.plugins.kotlin.k1.AnnotationUtilsKt$makeComposableAnnotation$1.getFqName(AnnotationUtils.kt:36)
        at org.jetbrains.kotlin.descriptors.annotations.Annotations$DefaultImpls.findAnnotation(Annotations.kt:29)
        at org.jetbrains.kotlin.descriptors.annotations.AnnotationsImpl.findAnnotation(AnnotationsImpl.kt:22)

Affected platforms Select one of the platforms below:

gulabsagevadiya commented 7 months ago

i am getting same issue in my project. is there any workaround for this?

okushnikov commented 3 weeks ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.