Converting "Callable<T>" Java method to Kotlin -


i'm trying convert java method:

private <t> callable<t> createcallable(final callable<t> task) {     return () -> {         try {             return task.call();         } catch (exception e) {             handle(e);             throw e;         }     }; } 

from following java file exceptionhandlingasynctaskexecutor.java kotlin.

the code gets converted automatically using intellij idea into:

private fun <t> createcallable(task: callable<t>): callable<t> {     return {         try {             return task.call()         } catch (e: exception) {             handle(e)             throw e         }     } } 

which not correct. have idea correct implementation should be. ideas?

i think kotlin converter bug. converted code () -> t instead of callable<t> (which same these different types). working code

private fun <t> createcallable(task: callable<t>): callable<t> {     return callable {         try {             task.call()         } catch (e: exception) {             handle(e)             throw e         }     } } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -