I was trying to create the following class:
class MyClass {
var foos: List<Foo> = listOf()
constructor(foos: List<Foo>) {
this.foos = foos
}
constructor(bars: List<Bar>) : super() {
this.foos = bars.map { bar ->
Foo(bar)
}
}
}
However, I get an error saying:
Platform declaration clash: The following declarations have the same JVM signature ( (Ljava/util/List;)V):
I understand that they are both List objects, but they are typed with generics so I was sure it would not be a problem.
List
. Look up "type erasure in Java" to learn more. – Sweeper