Hi! There are a new <KEEP> and a corresponding Git...
# language-proposals
e
Hi! There are a new KEEP and a corresponding GitHub discussion about
@WillBecomeValue
annotation. TL;DR: it marks reference classes (like
Pair
,
Uuid
) that will eventually become `value class`es. Once marked, the compiler warns on identity-sensitive usages (
===
,
synchronized
,
identityHashCode
) — so users can fix their code before the class actually converts and those usages become errors. Basically a Kotlin analog of Java's
@jdk.internal.ValueBased
(JEP 390). Example:
Copy code
@WillBecomeValue
data class Pair<out A, out B>(val first: A, val second: B)

fun check(p: Pair<String, String>) {
    p === p // Warning: identity-sensitive operation on a class annotated with @WillBecomeValue
}
K 8