Ok, we found the issue, it is easy to reproduce wi...
# coroutines
k
Ok, we found the issue, it is easy to reproduce with simple code snippet -
Copy code
@JvmInline
value class ValueClassId(private val value: UUID)

class SomeService {

    suspend fun outerFails(id: UUID): ValueClassId {
        return inner(id)
    }

    suspend fun outerWorks(id: UUID) = try {
        somethingTrowing()
        justValueId(id)
    } catch (e: RuntimeException) {
        fallbackValueId(id)
    }

    private suspend fun inner(id: UUID) = try {
        somethingTrowing()
        justValueId(id)
    } catch (e: RuntimeException) {
        fallbackValueId(id)
    }

    private suspend fun justValueId(id: UUID): ValueClassId {
        delay(1)
        return ValueClassId(id)
    }

    private suspend fun fallbackValueId(id: UUID): ValueClassId {
        delay(1)
        return ValueClassId(id)
    }

    private suspend fun somethingTrowing(): Unit {
        delay(1)
        throw IllegalArgumentException()
    }
}

fun main(): Unit = runBlocking {
    val s = SomeService()
    val id = UUID.randomUUID()

    // works fine
    s.outerWorks(id)

    // Fails on: ContinuationImpl.kt:33
    // val outcome = invokeSuspend(param)
    // if (outcome === COROUTINE_SUSPENDED) return
    s.outerFails(id)
}
youtrack 1
should we create a bug on kotlin's YouTrack?
w
Always a good idea 🙂 At worst, it’ll get marked as duplicate and you’ll know which bug to track
k
n
As far as I know value classes are designed to be wrapper around primitive types. In your case you have UUID which is not primitive type.
k
you can change UUID in my example on String and you will face same issue -
Copy code
class kotlin.coroutines.intrinsics.CoroutineSingletons cannot be cast to class java.lang.String
i
Thanks! I cannot reproduce on current master. It is likely, that the issue is fixed in the upcoming 1.5.10 release. Will check, whether it is fixed in 1.5.10, though.
👌 1
k
@Ilmir Usmanov [JB] do you have any ETA when 1.5.10 will be released? or at least some RC version
âž• 1