kotest: Incompatibility with Kotlin-1.7.0-Beta

Using the latest version of Kotest (5.3.0) and the Kotlin 1.7.0-Beta, I am encountering the following error:

java.lang.IncompatibleClassChangeError: Found interface kotlin.time.TimeMark, but class was expected
	at io.kotest.engine.spec.interceptor.SpecFinishedInterceptor.intercept-0E7RQCE(SpecFinishedInterceptor.kt:37)
	at io.kotest.engine.spec.interceptor.SpecFinishedInterceptor$intercept$1.invokeSuspend(SpecFinishedInterceptor.kt)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)

The full stacktrace is attached.

stacktrace.txt

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 19
  • Comments: 28 (20 by maintainers)

Commits related to this issue

Most upvoted comments

1.7 just got released a few hours ago but we’ll wait for the official blog post. Then we can upgrade kotest and make sure it compiles and then release 5.4

On Wed, 8 Jun 2022 at 16:09, Ismar Slomic @.***> wrote:

I’m also facing this issue with kotest v5.3.0 and kotlin v1.7.0 (which is available as we speak)

— Reply to this email directly, view it on GitHub https://github.com/kotest/kotest/issues/2960#issuecomment-1150417937, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAFVSGXF23TOG3YSW5WYV7TVOEDZHANCNFSM5VIQUI3A . You are receiving this because you were mentioned.Message ID: @.***>

@nielsvanvelzen it should be out now 😃

5.3.1 has been released, can you try that ?

I had the same issue with Kotest (5.3.0), but with Kotlin version 1.6.21 also I was using kotlinx-datetime on version 0.3.3. Downgrade of kotlinx-datetime to 0.3.2 solved it for me.

Here’s the description of the change: https://kotlinlang.org/docs/whatsnew17.html#time-marks-based-on-inline-classes-for-default-time-source

(sharing for completeness)

Time marks based on inline classes for default time source

Kotlin 1.7.0 improves the performance of time measurement functionality by changing the time marks returned by TimeSource.Monotonic into inline value classes. This means that calling functions like markNow(), elapsedNow(), measureTime(), and measureTimedValue() doesn’t allocate wrapper classes for their TimeMark instances. Especially when measuring a piece of code that is part of a hot path, this can help minimize the performance impact of the measurement:

@OptIn(ExperimentalTime::class)
fun main() {
    val mark = TimeSource.Monotonic.markNow() // Returned `TimeMark` is inline class
    val elapsedDuration = mark.elapsedNow()
}

This optimization is only available if the time source from which the TimeMark is obtained is statically known to be TimeSource.Monotonic.

Once 1.7 final is out we will release. See https://github.com/kotest/kotest/issues/2990

I can confirmed this is fixed after updating to Kotlin 1.7.0 and kotest 5.3.1

Are snapshots working with 1.7?