https://kotlinlang.org logo
Title
j

Justin Tullgren

09/09/2021, 4:34 PM
Followup to that "NO" reply for inline classes. Is there java interop?
j

Joffrey

09/09/2021, 4:38 PM
You will java interop for things that use the unboxed inner value at least (like a function taking your inline value class as argument). But I'm not sure for when it is boxed (like when it take a list of your class).
j

Justin Tullgren

09/09/2021, 4:40 PM
the param argument is good enough. Thanks!
j

Joffrey

09/09/2021, 4:42 PM
In this case it will be compiled as the unboxed value as far as java is concerned, so you can pass the inner value directly from Java.
j

Justin Tullgren

09/09/2021, 4:43 PM
thats good. I ran into another issue with the @JvmOverloads annotation which made me worried
s

Stephan Schroeder

09/10/2021, 7:07 AM
Check out the section "Changing JVM name for Java Calls" on how to do Java interop with Inline classes: https://blog.jetbrains.com/kotlin/2021/02/new-language-features-preview-in-kotlin-1-4-30/ and/or the "mangling function names" section of this video on Inline Classes (starting at 7:57)

https://www.youtube.com/watch?v=LpqvtgibbsQ&t=477s

👍 1