existing spring's JdbcTemplate has signature:
public <T> List<T> query(String sql, RowMapper<T> rowMapper)
and i can call it with a lambda that implements the interface:
jdbcTemplate.query("select ...", { rs, _ -> 5 })
but when i declare the same function in kotlin:
fun <T> query(sql: String, rowMapper: RowMapper<T>): List<T> = TODO()
and try to call it the same way:
query("select ...", { rs, _ -> 5 })
i get a compilation error
Type inference failed: fun query ( sql: String, rowMapper: RowMapper ) : List cannot be applied to ( String, (???, ???) → Int )
i have to write
query("select ...", RowMapper{ rs, _ -> 5 })
why? is there any way to just provide lambda?