https://kotlinlang.org logo
Title
t

tipsy

12/19/2018, 9:29 AM
i'm trying to call a jdbi-method from kotlin, and i get:
Type inference failed: Not enough information to infer parameter X in 
fun <R : Any!, X : Exception!> withHandle(callback: ((handle: Handle!) → R!)!): R!
Please specify it explicitly.
the method signature is
public <R, X extends Exception> R withHandle(HandleCallback<R, X> callback) throws X {
what am i supposed to do in this case?
g

gildor

12/19/2018, 9:30 AM
What is your code? Did you try to just specify types explicitly?
t

tipsy

12/19/2018, 9:32 AM
just the example from the jdbi page:
val names = jdbi.withHandle({ handle ->
            handle.createQuery("select name from contacts")
                    .mapTo(String::class.java)
                    .list()
        })
i don't know how to specify the type of the exception
g

gildor

12/19/2018, 9:34 AM
jdbi.withHandle<R, Exception>
?
t

tipsy

12/19/2018, 9:35 AM
🤔
thank you