Skip to content

[fix-finder] [generator] Check every base interface when fixing access modifiers - #13854

Open
github-actions[bot] wants to merge 1 commit into
mainfrom
fix-interface-bases-20261201-878621f521a345fe
Open

github-actions[bot] wants to merge 1 commit into
mainfrom
fix-interface-bases-20261201-878621f521a345fe

Conversation

@github-actions

@github-actions github-actions Bot commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

AI-generated fix. Produced by the nightly-fix-finder agentic workflow.

Problem

InterfaceGen.FixupAccessModifiers stops examining implemented interfaces when it encounters a public base. If a package-private base follows it, its methods are never copied into the derived binding, making the generated API depend on base-interface order.

Fix

Remove the premature break from InterfaceGen.cs so every base is examined, retaining the existing non-public visibility filter and method deduplication. Add one parameterized regression in InterfaceTests.cs covering both base-interface orders. The owning generator and test projects target net11.0 with inherited LangVersion=preview; no new APIs or syntax requirements are introduced.

Validation

  • AndroidSdkDirectory="/home/runner/work/android/android/bin/Debug/android-sdk" AndroidNdkDirectory="/home/runner/work/android/android/bin/Debug/android-ndk" ./build.sh Prepare — passed, zero warnings/errors.
  • ./dotnet-local.sh test tests/generator-Tests/generator-Tests.csproj -c Debug -v minimal --filter 'FullyQualifiedName~FixupAccessModifiersChecksAllBaseInterfaces' before the fix — reproduced the bug: public-first failed with zero methods instead of one; hidden-first passed.
  • ./dotnet-local.sh build src/generator/generator.csproj -c Debug -v minimal — passed, zero warnings/errors.
  • ./dotnet-local.sh test tests/generator-Tests/generator-Tests.csproj -c Debug -v minimal --filter 'FullyQualifiedName~InterfaceTests|FullyQualifiedName~AccessModifiers' after the fix — all six tests passed.
  • git diff --check — passed; working tree clean after commit.

Fix-finder metadata

  • Script: 05-general-mistakes
  • Score: 25/30 (actionability: 9, safety: 7, scope: 9)

Warning

Firewall blocked 1 domain

The following domain was blocked by the firewall during workflow execution:

  • 169.254.169.254

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "169.254.169.254"

See Network Configuration for more information.

Generated by Nightly Fix Finder · copilot · gpt61 · 32.1 AIC · ⌖ 13.2 AIC · ⊞ 22.9K · ◷

Do not stop at a public base interface when copying methods from non-public bases. Otherwise a later package-private base loses its methods from the generated binding. Cover both base-interface orders with a focused regression.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@PeppersMuse

Copy link
Copy Markdown

Reviewed as a maintainer. This looks correct — no issues found.

What I checked:

  • The fix in InterfaceGen.FixupAccessModifiers (src/generator/Java.Interop.Tools.Generator.ObjectModel/InterfaceGen.cs): the old else { break; } aborted the whole loop at the first public base interface, so whether a package-private base's methods got copied depended on base-interface order. Removing the break is the right fix — every base is now examined, and the existing non-public filter (RawVisibility != "public") and the Matches deduplication are retained, so no duplicate methods can be added if two bases share one. The ToList() snapshot also still protects against mutating Methods while iterating.
  • The regression test (tests/generator-Tests/Unit-Tests/InterfaceTests.cs): I verified the test actually exercises what it claims — TestBaseSupport defaults Visibility to "public", so publicBase is genuinely public, while hiddenBase sets Visibility = "" (package-private). The [DataRow (true)] / [DataRow (false)] cases cover both base orders, and the assertions (exactly 1 method, named HiddenMethod) match the expected outcome in both.
  • Scope: no other early exit remains in the loop, and base.FixupAccessModifiers only recurses into nested types, so nothing else in the method is affected. Copilot had not posted a review on this PR at the time I looked, so there was nothing of its to cross-check.

One harmless observation, not a blocker: the #nullable enable / #nullable restore pair around the new test doesn't appear necessary (the test uses no nullable annotations), but it doesn't affect behavior.

@jonathanpeppers

Copy link
Copy Markdown
Member

/azp run Xamarin.Android-PR

@azure-pipelines

Copy link
Copy Markdown
No pipelines are associated with this pull request.

This branch has not been deployed

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants