Matias Reparaz
07/08/2021, 8:39 PMclass SomeClass<out T>(private val type: Class<T>, val getDefaultValue: () -> T) {
constructor(type: Class<T>, default: T): this(type, {default})
}
but when I upgrade I have this error
Kotlin: Overload resolution ambiguity:
public constructor SomeClass<out T>(type: Class<TypeVariable(T)>, getDefaultValue: () -> TypeVariable(T)) defined in SomeClass
public constructor SomeClass<out T>(type: Class<TypeVariable(T)>, default: TypeVariable(T)) defined in SomeClass
can someone explain me why this doesn’t work anymore and/or how can I rewrite it?ephemient
07/08/2021, 8:48 PMclass SomeClass<out T>(private val type: Class<T>, val getDefaultValue: () -> T) {
constructor(type: Class<T>, default: T): this(type, getDefaultValue = { default })
}
will compileMatias Reparaz
07/08/2021, 8:51 PM