Uh oh!
There was an error while loading. Please reload this page.
[XA.Tools.Bytecode] Add Kotlin support to our binding process. - #505
Conversation
f9497c7 to
84ccb6dCompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
The last bullet point gives me some pause:
Does this happen with virtual instance members? I fear the answer is "yes". Thus, consider the Kotlin code: classExampleBase {
publicopenfunfoo(value:Int) {
}
publicopenfunfoo(value:UInt) {
}
}Compile & Disassemble it, and: Based on the bullet point, I think we'd bind this as: [Register("ExampleBase",DoNotGenerateAcw=true)]partialclassExampleBase{[Register("foo", ...)]publicvirtualvoidFoo(intvalue){_members.InstanceMethods.InvokeVirtualVoidMethod("foo.(I)V",this, ...);}[Register("foo-WZ4Q5Ns", ...)]publicvirtualvoidFoo(intvalue){_members.InstanceMethods.InvokeVirtualVoidMethod("foo-WZ4Q5Ns.(I)V",this, ...);}}At which point I scratch my head. For starters, that can't compile: there's two Even if it could compile, the // C#classMyDerivedExample:ExampleBase{// Assume we "somehow" override the foo(UInt) overloadpublicoverridevoidFoo(intvalue){}}There's not actually any way to override Now, if we bound As-is, though, I cannot tell what this PR would do with the above Kotlin class. Is this already handled and I just don't see it? Should it be addressed? |
Yeah, that appears to be an issue that we will need to think through and fix. Perhaps if we have a Given that it is likely a rare corner case (that could be fixable via |
Context: #525 Various fixes and enhancements to allow better default Kotlin libraries bindings: * Hide Kotlin-internal classes, constructors, and methods. * Hide implementation methods (`*-impl*`). * Rename extension method parameter like `$this$decodeBase64` to `obj`. * Use Kotlin provided method parameter names instead of `p0`, `p1`, etc. * Rename any method with a `-<mangling>` to drop the invalid part, e.g. `add-H4uI21a` is bound as `add`. ("Name mangling" like this is how Kotlin ensures `add(UInt)` and `add(Int)` don't clash when compiled to [Java][1].) Note that the final bullet point -- "removing" name mangling -- may result in C# code which is either not valid or not entirely usable. See Issue #525 for details. This will be addressed "later". [1]: https://kotlinlang.org/docs/reference/inline-classes.html#mangling
Various fixes and enhancements to allow better default Kotlin libraries bindings.
*-impl*).$this$decodeBase64toobj.p0,p1, etc.hyphen-<hashcode>to drop the invalid part (add-H4uI21a->add).add (UInt)andadd (Int)don't clash when compiled to Java.