Skip to content

[WIP] Add GetStaticMethodFallbackTypesCore override for TrimmableTypeMap#11050

Draft
Copilot wants to merge 1 commit intomainfrom
copilot/add-getstaticmethodfallbacktypescore-override
Draft

[WIP] Add GetStaticMethodFallbackTypesCore override for TrimmableTypeMap#11050
Copilot wants to merge 1 commit intomainfrom
copilot/add-getstaticmethodfallbacktypescore-override

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.


This section details on the original issue you should resolve

<issue_title>[TrimmableTypeMap] Add GetStaticMethodFallbackTypesCore override for desugared default interface methods</issue_title>
<issue_description>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.</issue_description>

Comments on the Issue (you are @copilot in this section)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[TrimmableTypeMap] Add GetStaticMethodFallbackTypesCore override for desugared default interface methods

2 participants