class MapBuilder<T,U> {
operator fun invoke(arg: T): MapBuilder<T, U> {
return this
}
operator fun invoke(arg: U): MapBuilder<T, U> {
return this
}
}
of course it's don't work due to JVM limitations.
Platform declaration clash: The following declarations have the same JVM signature
Copy code
(invoke(Ljava/lang/Object;)Lcom/test/tests/MapBuilder;):
operator fun invoke(arg: T): MapBuilder<T, U> defined in com.test.tests.MapBuilder
operator fun invoke(arg: U): MapBuilder<T, U> defined in com.test.tests.MapBuilder
Any ideas how can I realize this?
b
Bob Glamm
11/16/2018, 7:10 PM
That's not a JVM limitation. For example, what happens if T == String and U == String?