kotlin-compile-testing icon indicating copy to clipboard operation
kotlin-compile-testing copied to clipboard

Support Kotlin 2.0

Open technoir42 opened this issue 1 year ago • 9 comments

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");
}

technoir42 avatar Jul 30 '24 10:07 technoir42

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.

NeonMika avatar Aug 07 '24 12:08 NeonMika

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

technoir42 avatar Aug 12 '24 09:08 technoir42

Would be great if this could be solved in the near future, i'm working on multiple KSP projects that could benefit from this.

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

Could you provide some sample code that works in 2.0 for this fork? it seems to just ignore my symbol processor.

IceBlizz6 avatar Sep 24 '24 19:09 IceBlizz6

A solution for KSP can be found here: https://github.com/ZacSweers/kotlin-compile-testing/issues/296#issuecomment-2451011186

solonovamax avatar Oct 31 '24 23:10 solonovamax

Any updates?

5peak2me avatar Jun 20 '25 02:06 5peak2me

Any updates?

aouledissa avatar Sep 28 '25 20:09 aouledissa

+1

iirekm avatar Oct 26 '25 15:10 iirekm

A solution for KSP can be found here: ZacSweers#296 (comment)

unfortunately not, that ZacSweeters library is buggy as hell, e.g. doesn't even run processors in KMP 2.2!

iirekm avatar Oct 26 '25 15:10 iirekm

This library seems pretty dead now sadly. last commit was 18 months ago.

IceBlizz6 avatar Oct 26 '25 16:10 IceBlizz6