Como criar uma instância de interface anônima no Kotlin?
Eu tenho uma biblioteca Java de terceiros que um objeto com interface como esta:
public interface Handler<C> {
void call(C context) throws Exception;
}
Como posso implementá-lo de forma concisa no Kotlin semelhante à classe anônima Java como esta:
Handler<MyContext> handler = new Handler<MyContext> {
@Override
public void call(MyContext context) throws Exception {
System.out.println("Hello world");
}
}
handler.call(myContext) // Prints "Hello world"