Are we stuck with the following situation? java de...
# announcements
c
Are we stuck with the following situation? java declaration
public abstract <R> java.util.concurrent.CompletableFuture<R> send(Object command)
Java call
object.send(command);
nice 👍 Kotlin call
object.send<Any>(command)
not nice, I'd like to avoid having to write
<Any>
👎 K
a
What happens when you leave out the
<Any>
?
c
>> Type inference failed: Not enough information to infer parameter R in
fun <R : Any!> send(command: Any!): CompletableFuture<R!>!
Please specify it explicitly.
s
Why does it work in Java? It it a raw
CompleteableFuture
?
🤔 1
1
c
I don't know type system well enough to answer why 😐
s
You should create a ticket. It is not just a problem in Java interop but in Kotlin also:
Copy code
fun <R> foo() : CompletableFuture<R> { TODO() }

val init = run {
    foo()
    Unit
}
Seems like a nice ease of life win to omit type on an unused return value.
1
g
There is an existing issue about this
c
Yeah, there is even a selection of issues, not much activity on them currently though: KT-15604, KT-19684, KT-2656