Kotlin 2.0.0 question: This code newly generates a...
# getting-started
d
Kotlin 2.0.0 question: This code newly generates a warning
Kotlin: Captured type in mutable property reference. Usages of 'set' may lead to cast exceptions.
Copy code
interface IdHolder<T> {
    var id: T
}

fun main() {
    println(IdHolder<*>::id.name)
}
Obviously, the warning is not relevant for this particular situation since I'm not holding a reference to the mutable
id
property. So my question is how to get rid of it. I guess I'm asking about the right argument to
@Suppress
but don't know how to find it.
e
MUTABLE_PROPERTY_WITH_CAPTURED_TYPE
d
For compilation you can add
-Xrender-internal-diagnostic-names
compiler flag, so the compiler will add internal name for each warning and error it reports In IDE you can inspect diagnostic names with internal mode enabled
d
Thanks. I wondered at first why that flag doesn't work before realizing that I need to enable the K2 mode!
👍 1