Skip to content

[generator] Implement Kotlin interfaces and open classes with value-class parameters #13669

Open

Description

@jonathanpeppers

Android framework version

net12.0-android (Preview)

Affected platform version

dotnet/android main with #13581

Description

When a Kotlin interface or open class method has a value-class parameter or return type, kotlinc mangles its JVM name:

interface ColorCallback {
    fun onDp(dp: MyDp): Int   // JVM name: onDp-<hash>(F)I
}

C# can call these methods, but cannot implement or override them, because the Java callable wrapper (JCW) must declare the method with the mangled Java name. This blocks Compose callbacks and modifiers that C# code would implement.

Expected: a C# class that implements IColorCallback (or overrides the open class method) produces a JCW method with the mangled name and signature, and Java calls reach the C# implementation with the value-class struct.

Steps to Reproduce

  1. Bind a Kotlin library with the interface above (the ColorCallback fixture in tests/Xamarin.Android.Tools.Bytecode-Tests/kotlin-gradle has one).
  2. Implement IColorCallback in C# and pass it to Kotlin code that calls onDp.
  3. The JCW does not declare onDp-<hash>, so the Java call does not reach the C# method.

Did you find any workaround?

No.

Relevant log output

N/A

Activity

  1. added this to the .NET 12 milestone on Nov 19, 2026
  2. added
    enhancement
    java-interop
    on Nov 19, 2026
  3. added
    needs-triage
    on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Area: Mono.Bindingsenhancementjava-interopneeds-triage

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions