I am writing my own simple javax.sql.DataSource implementation, the only method of it I need to work is getConnection: Connection, but the interfac
As said in comments, this solution doesn't work
If I understood your problem well, you can also assign default values, as explained in details in what does it mean assign "_" to a field in scala?. You can find more infos in 4.2 Variable Declarations and Definitions of the The Scala Language Specification
So you can simply do:
def unwrap[T](iface: Class[T]): T = _
which will set unwrap with null without the type mismatch.