Kotlin 1.3 and Coroutines


#1

Hello all.
Just switched this morning to kotlin 1.3 and kotlinx-coroutines 1.0.0.

When executing fairly simple code that previous (kotln 1.2.71, coroutines 0.22.5) worked, I am now getting an AbstractMethodError arising from BaseContinuationImpl line 32.

The code is something like:

runBlocking {
  deferred.await()
}

so nothing earth shattering. Have I missed a support library or extensions lib that is needed now?


#2

Please read the migration guide here: https://github.com/Kotlin/kotlinx.coroutines/blob/master/COMPATIBILITY.md#migration-to-100-version-with-kotlin-13 and follow the steps mentioned, that will probably solve the problem :slight_smile:


#3

Sorry…the problem is more subtle than that.

It seems that the problem is around the annotation @JvmSuppressWildcards

@Test
fun simpleTest() {
    val face: Face = FaceImpl()
    face.doSomething()
}

interface Face {
    fun doSomething()
}

@JvmSuppressWildcards
class FaceImpl : Face {
    override fun doSomething() {
        println("Doing something")

        runBlocking {
            delay(200)
            async {
                println(1 + 1)
            }
        }
    }

}

As soon as the wildcard suppression is added, the coroutines fail. My guess is that something is going wrong with the way in which subclassing is being done for the lambdas. Remove the annotation, and it works again. This will cause me issues, as the code I am migrating from kotlin 1.2.71 needs that wildcard suppression


#4

I’ll take advice here…
Can I expect this issue to appear a bug with an associated Jira ticket, or will this be treated as “as expected”? If so, shall I assume that I need to refactor code to never accidentally include @JvmSuppressWildcards and coroutines? This seems a bit of a step back from rich java interop.


#5

Sorry for the late reply. As discussed in Slack, this looks like a bug, please submit an issue here: http://kotl.in/issue.


#6

Reported as https://youtrack.jetbrains.com/issue/KT-28097


#7

thank you