under the hood, a
@JvmInline value class Value(val value: T)
compiles to a combination of things:
• properties, variables, methods, constructors, etc. declared as type
Value
compile to directly use
T
, but with mangled names to avoid collisions with Java overloads on
T
• a wrapper class
Value
for use in contexts where the above can't work (e.g.
List<Value>
), with boxing/unboxing-like operations around its use
for now, all Kotlin/JVM value classes must be `@JvmInline`; Java's Project Valhalla is not ready and thus there are no JVM primitive classes yet.
there isn't a lot that KAPT can sensibly do with value classes - the mangled names aren't valid Java identifiers