`java.lang.ClassCastException: kotlin.Unit cannot ...
# announcements
a
java.lang.ClassCastException: kotlin.Unit cannot be cast to kotlin.Result
when using
useIR = true
Kotlin Version : 1.4.32 After upgrading to 1.4.32 all
runCatching { }
call are throwing
java.lang.ClassCastException
is there any bug or breaking changes in version 1.4.32 ? As an example
Copy code
suspend fun connect(clientId: String): Boolean {
        if (isConnected) {
            Timber.d("Already connected to broker ${mqttClient.serverURI}")
            return true
        }
        mqttClient = MqttClient(BuildConfig.BROKER_URI, clientId, null)
        mqttClient.setCallback(mqttCallback)

        val result = withContext(<http://Dispatchers.IO|Dispatchers.IO>) {
            runCatching {
                Timber.d("Connecting to broker  ${mqttClient.serverURI}")
                val options = MqttConnectOptions().apply {
                    mqttVersion = MqttConnectOptions.MQTT_VERSION_3_1_1
                    isCleanSession = true
                    isAutomaticReconnect = true
                    maxReconnectDelay = 10000
                }
                mqttClient.connect(options)
                Timber.d("Broker connected.")
            }
        }
        result.exceptionOrNull()?.let { t ->
            Timber.e(t, "Failed to connect to the broker.")
        }
        return result.isSuccess
    }
r
That certainly seems like a bug, maybe post it in #jvm-ir-backend-feedback? You might want to try with 1.5-M2 first and see if it's already been fixed, I know there were some Result changes
2
417 Views