Stable mangling of function names? (JVM, used for JNI)

Hi,

Is the mangling of function names as produced by the Kotlin compiler for JVM guaranteed to remain stable? For instance, suppose we have a function foo with a parameter of an inlined class.

inline class CPointer(val value: Long)

external fun foo(ptr: CPointer)

Then the Kotlin compiler creates a function name foo-9PQahP4. When I register a C++ function in JNI to implement foo, I have to pass that mangled name foo-9PQahP4 to RegisterNatives. Can I rely on the fact that the name stays the same as long as the signature does not change, or could it happen that in a different build (or Kotlin version), the name suddenly changes to foo-tjek8dY?

I am aware of the @JvmName annotation to enforce a certain name, but with stable mangling I could do without it.

Well, as far as I’ve read mangling for inline classes is still early days and experimental in Kotlin.

https://kotlinlang.org/docs/reference/inline-classes.html#mangling

That said, I’d expect the mangling to be stable once inline classes reach a stable state. Otherwise kotlin intself would run into ABI issues.