https://kotlinlang.org logo
Title
k

kassim

02/19/2019, 10:27 AM
the deprecated function with the 'not' signature is a great idea though I failed to give full context and unfortunately I need it for a generic of a generic full context: I'm trying to create a Kotlin property backed by a BehaviourRelay (an Rx observable object) and want to ensure obvious mutables aren't used
class BehaviorRelayUpdateOnlyProperty<T>(relay: BehaviorRelay<T>) : BehaviorRelayProperty<T>(relay)
I wanted to prevent T from extending MutableCollection - but with your solution the new constructor shares the same JVM signature as the original
constructor(mutablePropertyRelay: BehaviorRelay<MutableCollection<*>>) : this(mutablePropertyRelay)
isn't accepted
k

karelpeeters

02/19/2019, 11:36 AM
Maybe work around that with factories and
@JvmName
? In the end I think this really should be a lint check instead.