Uh oh!
There was an error while loading. Please reload this page.
[typemap] Reject duplicate generated JCW names - #12569
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Copilot review overview
Review tier: Lite
Findings: 2
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildWithLibraryTests.cs — 💡 suggestion — errors is never null because Where(...) returns a non-null enumerable.… | |
tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Generator/TrimmableTypeMapGeneratorTests.cs — 💡 suggestion — The new XA4215 regression test uses broad Contains predicates, which can… |
What changed in this PR
This PR closes a feature-parity gap in the trimmable typemap pipeline by detecting cross-assembly collisions in generated Java wrapper (JCW) names early and emitting deterministic, localized XA4215 diagnostics, preventing ambiguous Java/acw-map/typemap outputs.
Changes:
- Add duplicate generated Java type validation in
TrimmableTypeMapGenerator.ValidateJavaNames()and log XA4215 header + detail lines deterministically. - Extend the trimmable typemap logger interface and MSBuild task logger to emit XA4215 diagnostics via localized resource strings.
- Add/expand regression coverage for duplicate generated JCW names across llvm-ir, trimmable CoreCLR, and trimmable NativeAOT builds.
| File | Description |
|---|---|
| tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Generator/TrimmableTypeMapGeneratorTests.cs | Adds a focused unit test asserting XA4215 emission for duplicate generated JCW names. |
| src/Xamarin.Android.Build.Tasks/Tests/Xamarin.Android.Build.Tests/BuildWithLibraryTests.cs | Expands integration coverage to validate XA4215 behavior and output artifacts across typemap implementations/runtimes. |
| src/Xamarin.Android.Build.Tasks/Tasks/GenerateTrimmableTypeMap.cs | Implements new XA4215 logging methods in the MSBuild logger using localized resources. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/TrimmableTypeMapGenerator.cs | Adds early cross-assembly duplicate JCW name rejection with deterministic XA4215 logging. |
| src/Microsoft.Android.Sdk.TrimmableTypeMap/ITrimmableTypeMapLogger.cs | Extends the logging interface with XA4215 header/detail methods. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
simonrozsival
commented
Sep 2, 2026
/review |
✅ Android PR Reviewer completed successfully!
|
There was a problem hiding this comment.
Verdict: ✅ LGTM
Findings: 0 errors · 0 warnings · 1 suggestion
The collision check correctly runs before typemap, Java, and ACW-map output generation; XA4215 diagnostics are localized and deterministic; and the integration matrix covers llvm-ir, trimmable CoreCLR, and NativeAOT. All 44 CI checks pass. The inline suggestion is non-blocking and asks only for direct coverage of the intentionally preserved same-assembly alias branch.
Generated by Android PR Reviewer for #12569 · gpt56 · 140 AIC · ⌖ 8.89 AIC · ⊞ 25.7K
Comment /review to run again
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.

Summary
TDD evidence
Before the fix, the unchanged fixture failed with XA4215 under llvm-ir but succeeded under trimmable CoreCLR and NativeAOT. Trimmable wrote duplicate ACW-map entries, overwrote one
DuplicatePeer.java, and retained inconsistent mappings.After the fix, the focused llvm-ir, trimmable CoreCLR, and trimmable NativeAOT fixture passes 3/3. Additional validation:
GenerateTrimmableTypeMaptask tests: 14/14Part of #12561