We have a Kotlin project for which some classes are intended to be shared with the client-side, and as a result have configured our kotlin-maven-plugin to spit out certain Kotlin classes as JavaScript:
<configuration>
<outputFile>${project.basedir}/angular/src/assets/kotlin_classes.js</outputFile>
<moduleKind>commonjs</moduleKind>
</configuration>
With a Kotlin class that looks like:
class SomeKotlinClass {
fun someMethod(name: String): String {
return "Happy Birthday, " + name;
}
}
The problem that we're encountering is that no matter what moduleKind we use (we've tried plain, umd, amd), our method names seem to have an odd/garbled suffix in the JavaScript file:
SomeKotlinClass.prototype.someMethod_6q3v0v$ = function (name) {
return 'Happy Birthday, ' + name
};
This means that our calls in Angular/TypeScript can't be to someMethod(), they have to be to someMethod_6q3v0v$(), which doesn't work for us.
Am I doing something wrong with my plugin configuration, or with the way I'm including this JavaScript file in our project? We're 99% of the way there, but this last (strange) hurdle is holding us up.