Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin metadata error with Kotlin 1.5.0-M2 #1324

Closed
vRallev opened this issue Mar 26, 2021 · 10 comments · Fixed by #1325
Closed

Kotlin metadata error with Kotlin 1.5.0-M2 #1324

vRallev opened this issue Mar 26, 2021 · 10 comments · Fixed by #1325
Labels

Comments

@vRallev
Copy link
Contributor

vRallev commented Mar 26, 2021

Using Kotlin preview builds like 1.5.0-M2 results in following error:

Caused by: java.lang.IllegalStateException: Could not parse metadata! This should only happen if you're using Kotlin <1.1.
        at com.squareup.moshi.kotlinpoet.metadata.KotlinPoetMetadata.readKotlinClassMetadata(KotlinPoetMetadata.kt:70)
        at com.squareup.moshi.kotlinpoet.metadata.KotlinPoetMetadata.toImmutableKmClass(KotlinPoetMetadata.kt:50)
        at com.squareup.moshi.kotlin.codegen.MoshiCachedClassInspector.toImmutableKmClass(MoshiCachedClassInspector.kt:22)
        at com.squareup.moshi.kotlin.codegen.MetadataKt.targetType(metadata.kt:109)
        at com.squareup.moshi.kotlin.codegen.JsonClassCodegenProcessor.adapterGenerator(JsonClassCodegenProcessor.kt:136)
        at com.squareup.moshi.kotlin.codegen.JsonClassCodegenProcessor.process(JsonClassCodegenProcessor.kt:110)
        at org.jetbrains.kotlin.kapt3.base.incremental.IncrementalProcessor.process(incrementalProcessors.kt:90)
        at org.jetbrains.kotlin.kapt3.base.ProcessorWrapper.process(annotationProcessing.kt:175)
        at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:980)
        ... 41 more

There's no special sample required, it happens with any Kotlin file. This issue doesn't happen with version 1.5.0-M1.

@vRallev vRallev added the bug label Mar 26, 2021
@ZacSweers
Copy link
Collaborator

This is probably due to kotlinx-metadata needing a newer version. They have a 0.2.0 planned but not released yet

@vRallev
Copy link
Contributor Author

vRallev commented Mar 29, 2021

This became an issue in 1.5.0-M2.

@vRallev vRallev changed the title Kotlin metadata error with Kotlin preview builds Kotlin metadata error with Kotlin 1.5.0-M2 Mar 29, 2021
@vRallev
Copy link
Contributor Author

vRallev commented Mar 29, 2021

Seems like 0.2.0 was released a while ago: https://search.maven.org/artifact/org.jetbrains.kotlinx/kotlinx-metadata-jvm/0.2.0/jar

@ZacSweers
Copy link
Collaborator

Yup I was thinking of 0.2.1 not 0.2.0

@gajicm93
Copy link

gajicm93 commented Sep 1, 2021

This seems to be happening again with Kotlin 1.5.30?

@bmarty
Copy link

bmarty commented Nov 16, 2021

This seems to be happening again with Kotlin 1.6.0

@ZacSweers
Copy link
Collaborator

Known issue, it will be updated in the next release (waiting for KSP to release)

@niqo01
Copy link

niqo01 commented Nov 19, 2021

Which KSP issue is this waiting on?

@antonshkurenko
Copy link

I haven't found another issue (about 1.6.0), so maybe it's better to re-open this

@AlexZvonik
Copy link

The issue is reproducible with moshi 1.12.0 and kotlin 1.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants