https://kotlinlang.org logo
#coroutines
Title
# coroutines
n

napperley

10/17/2019, 3:24 AM
Keep on getting this error which is reproducible:
Copy code
Exception in thread "main" java.lang.NoSuchMethodError: org.digieng.kmqtt.client.MqttClient.connect$default(Lorg/digieng/kmqtt/client/MqttClient;Lorg/digieng/kmqtt/client/MqttConnectionOptions;Lkotlin/coroutines/Continuation;ILjava/lang/Object;)Ljava/lang/Object;
	at org.example.mqtt_test.MainKt$main$1.invokeSuspend(main.kt:11)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
	at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:241)
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:270)
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:79)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:54)
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source)
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:36)
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source)
	at org.example.mqtt_test.MainKt.main(main.kt:8)
	at org.example.mqtt_test.MainKt.main(main.kt)
Which Issue Tracker should I use for creating the issue (Kotlin or KotlinX Coroutines)?
l

louiscad

10/17/2019, 6:11 AM
kotl.in/issue because it seems to be related to how default interface methods are compiled regarding JDK8.
n

napperley

10/17/2019, 7:54 AM
The class that is used (MqttClient) doesn't implement any interface, unless Kotlin does something in behind the hood that I should be aware of.
If it is something to do with default interface methods in Kotlin would the next Kotlin version (1.4?) fix the issue?
v

Vsevolod Tolstopyatov [JB]

10/17/2019, 9:41 AM
it actually looks like an incompatible change in MqttClient libary
n

napperley

10/17/2019, 10:31 PM
Won't be a incompatible change since the KMQTT Client library ( https://gitlab.com/napperley/kmqtt-client ) doesn't use reflection, although the library's JVM module does depend on the Paho MQTT Client library ( https://www.eclipse.org/paho/clients/java/ ) which does use reflection.
Seems as though the issue might be related to KT-24461 ( https://youtrack.jetbrains.com/issue/KT-24461 ) and/or KT-28752 ( https://youtrack.jetbrains.com/issue/KT-28752 ). Below is the definition for the MqttClient.connect function in the Common module ( https://gitlab.com/napperley/kmqtt-client/blob/master/src/jvmMain/kotlin/org/digieng/kmqtt/client/MqttClient.kt#L88 )
Copy code
suspend fun connect(connOptions: MqttConnectionOptions = MqttConnectionOptions()): MqttError?
Which KT issue should I add a comment on?
l

louiscad

10/18/2019, 8:00 AM
@napperley You can have incompatible changes even without using reflection. That's why most serious JVM libraries strive to keep binary compatibility as much as possible. Check dependencies using that library, they might rely on version different than the one ending in your executable. You might want to align the versions in a way or another.
n

napperley

10/19/2019, 1:24 AM
There are no dependency conflicts between the program and the library. Have even gone so far as to remove all library artifacts, republish the library, do a clean build of the program followed by a Gradle refresh, and run the program again which has the same result as before.
I have created a issue ( https://youtrack.jetbrains.com/issue/KT-34471 ) in the Kotlin Issue Tracker.
@louiscad - If there were compatibility issues then it would be the MPP part ( https://kotlinlang.org/docs/reference/evolution/components-stability.html )
5 Views