Hey guys, wondering if there’s a way to use Kotlin...
# server
a
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
unlikely. anything that uses Java reflection is only going to get the mangled forms that Kotlin produces for passing value classes
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
Does that have performance implications?
e
no, just binary compatibility implications
(if you're doing work in the value classes' constructors, then there is some cost to "constructing" them, but that's not common)
a
Nice! Thank you.