tschuchortdev / kotlin-compile-testing

A library for testing Kotlin and Java annotation processors, compiler plugins and code generation
Mozilla Public License 2.0
659 stars 63 forks source link

Support Kotlin 2.0 #411

Open technoir42 opened 1 month ago

technoir42 commented 1 month ago

I'm facing the following error when running a test against Kotlin 2.0.10-RC2:

java.lang.NoSuchFieldError: DEFAULT
    at com.tschuchort.compiletesting.KotlinCompilation.<init>(KotlinCompilation.kt:143)

KotlinCompilation is trying to access JvmDefaultMode.DEFAULT:

var jvmDefault: String = JvmDefaultMode.DEFAULT.description

JvmDefaultMode no longer has DEFAULT in Kotlin 2.0.10-RC2:

package org.jetbrains.kotlin.config

enum class JvmDefaultMode(val description: String) {
    DISABLE("disable"),
    ALL_COMPATIBILITY("all-compatibility"),
    ALL("all");
}
NeonMika commented 1 month ago

I have the same issue.

See https://plugins.jetbrains.com/docs/intellij/api-changes-list-2024.html#kotlin-plugin-20241

org.jetbrains.kotlin.config.JvmDefaultMode.DEFAULT field removed Use org.jetbrains.kotlin.config.JvmDefaultMode.DISABLE.

technoir42 commented 1 month ago

I switched to this fork which supports Kotlin 2.0: https://github.com/ZacSweers/kotlin-compile-testing