Skip to content

[TrimmableTypeMap] Add GetStaticMethodFallbackTypesCore override for desugared default interface methods #11045

Description

@simonrozsival

Part of #10788

Problem

TrimmableTypeMapTypeManager does not override GetStaticMethodFallbackTypesCore(). The legacy ManagedTypeManager overrides this to support Java 8+ default interface methods that are desugared by D8/R8:

// ManagedTypeManager.cs:155-166
protected override IReadOnlyList<string>? GetStaticMethodFallbackTypesCore(string jniSimpleReference)
{
    int slash = jniSimpleReference.LastIndexOf('/');
    var desugarType = slash > 0
        ? $"{jniSimpleReference.Substring(0, slash + 1)}Desugar{jniSimpleReference.Substring(slash + 1)}"
        : $"Desugar{jniSimpleReference}";
    return new[] {
        $"{desugarType}$_CC",
        $"{jniSimpleReference}$-CC",
    };
}

Without this, calls to desugared default interface methods will fail with NoSuchMethodError at runtime when using the trimmable type map.

Fix

Add the same override to TrimmableTypeMapTypeManager. This is a 1-line method copy.

Impact

Any app using Java libraries with default interface methods (Java 8+ feature, very common in modern Android libraries like AndroidX) could be affected.

Activity

  1. added
    copilot
    on Mar 30, 2026
  2. added
    needs-triage
    on Mar 30, 2026
  3. removed
    needs-triage
    on Mar 30, 2026
  4. added this to the .NET 11 milestone on Mar 30, 2026
  5. locked and limited conversation to collaborators on May 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

copilottrimmable-type-map

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions