Eugenio
07/02/2016, 4:08 PMinterface FooModel {
fun a(): Int
fun b(): String
}
interface Creator<T : FooModel> {
fun create(a: Int, b: String): T
}
@AutoValue
abstract class Foo : FooModel {
companion object : Creator<Foo> by ::AutoValue_Foo
// Type mismatch: inferred type is KFunction2<String!, Int, AutoValue_Foo> but Creator<Foo> was expected
}
Right now the workaround is creating a Java method like
static <T extends FooModel> wrap(Creator<T> creator) {
return creator;
}
and then doing
Creator<Foo> by wrap(::AutoValue_Foo)