Hey guys, wondering if there’s a way to use Kotlin value classes (inline classes) in JAX-RS. I had created a data class with properties of value class types. I couldn’t get my data class with parameters which have value class types as the request body in JAX-RS. I’m wondering if there’s any work around to get this working.
e
ephemient
06/20/2023, 10:06 AM
unlikely. anything that uses Java reflection is only going to get the mangled forms that Kotlin produces for passing value classes
ephemient
06/20/2023, 10:08 AM
if you manually create a constructor with the underlying types and
@JvmName
all the accessors, perhaps you can get it to look close enough for Java
a
asavio
06/20/2023, 10:09 AM
Does that have performance implications?
e
ephemient
06/20/2023, 10:58 AM
no, just binary compatibility implications
ephemient
06/20/2023, 10:59 AM
(if you're doing work in the value classes' constructors, then there is some cost to "constructing" them, but that's not common)