dave08
09/19/2021, 6:39 AMvalue class
with Dagger2? It seems like it's not working... (don't think it makes a difference, but I'm using Anvil with it...)ephemient
09/19/2021, 7:13 AMdave08
09/19/2021, 7:16 AMephemient
09/20/2021, 1:25 AM@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