arekolek
08/28/2017, 3:14 PMinterface Foo<T> {}
class JavaStringFoo implements Foo<String> {}
class JavaStringListFoo implements Foo<List<String>> {}
class Spam {
Foo<String> one() {
return new JavaStringFoo();
}
Foo<String> two() {
return new KotlinStringFoo();
}
Foo<List<String>> three() {
return new JavaStringListFoo();
}
Foo<List<String>> four() {
return new KotlinStringListFoo();
}
}
and this code in Kotlin:
class KotlinStringFoo : Foo<String>
class KotlinStringListFoo : Foo<List<String>>
I’d think KotlinStringFoo
code is equivalent to JavaStringFoo
and KotlinStringListFoo
to JavaStringListFoo
.
But I get this error in `four()`:
incompatible types: KotlinStringListFoo cannot be converted to Foo<List<String>>This is while other three functions compile just fine. What’s up with that? How do I fix it?