nkiesel
02/03/2017, 11:56 PMfun <T> Connection.use(block : (Connection) -> T) : T = try { return block(this) } finally { this.close() } and same function for PreparedStatement and ResultSet. This all works, but I wanted to replace the three with a single fun <U : Closeable, T> U.use(block : (U) -> T) : T = try { return block(this) } finally { this.close() }. Now code like connection.use { c-> ...} no longer compiles and says: "Cannot infer a type for this parameter"