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
Post a Comment