Repository navigation
[Java.Interop] Simplify single-backend binding generation - #13056
Merged
Merged
Conversation
Remove internal target propagation and backend construction indirection now that XAJavaInterop1 is the only supported binding generator backend. Keep selector validation and obsolete target-taking constructors for compatibility with tooling that references the generator assembly. Collapse single-target test scaffolding while preserving the original 478-test suite and separate nullable-reference-type baselines. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The simplification is internally consistent and comprehensively validated, with only non-blocking compatibility-constructor test coverage suggested.
1 open finding
What changed in this PR
Simplifies Java.Interop binding generation now that XAJavaInterop1 is the sole backend.
Changes:
- Removes target propagation and generator factory indirection.
- Seals the generator and removes unused inheritance hooks.
- Collapses single-backend test scaffolding while preserving compatibility constructors.
| File | Description |
|---|---|
SymbolTable.cs |
Removes target storage; adds target-free construction. |
ArraySymbol.cs |
Adds target-free construction. |
InterfaceGen.cs |
Constructs the generator directly. |
ClassGen.cs |
Constructs the generator directly. |
JavaInteropCodeGenerator.cs |
Seals the implementation and removes virtual hooks. |
CodeGenerationOptions.cs |
Removes the generator factory and target propagation. |
UnmanagedCallersOnlyCallbackTests.cs |
Removes single-target setup. |
SymbolTableTests.cs |
Uses target-free construction. |
PeerMembersFieldTests.cs |
Removes redundant target configuration. |
NRTJavaInteropCodeGeneratorTests.cs |
Removes redundant target override. |
KotlinInlineClassEndToEndTests.cs |
Uses direct generator construction. |
InterfaceConstantsTests.cs |
Flattens single-target fixture inheritance. |
EnumGeneratorTests.cs |
Removes redundant target override. |
DefaultInterfaceMethodsTests.cs |
Flattens single-target fixture inheritance. |
CodeGeneratorTests.cs |
Consolidates the XA generator fixture. |
CodeGeneratorTestBase.cs |
Removes target-dependent test infrastructure. |
BlittableTypeTests.cs |
Removes redundant target override. |
Compiler.cs |
Removes an unused target alias. |
BaseGeneratorTest.cs |
Removes target parameters from integration scaffolding. |
🧠 Review effort: Balanced
| public void FindGenericTypes () | ||
| { | ||
| var table = new SymbolTable (CodeGenerationTarget.XAJavaInterop1); | ||
| var table = new SymbolTable (); |
Member
Author
|
@dalexsoto review |
dalexsoto
approved these changes
Oct 10, 2026
dalexsoto
left a comment
Member
There was a problem hiding this comment.
The complete correctness and integration review found no blocking regression. The sole-backend simplification preserves CLI defaults and retired-target rejection, retains the public constructors as warning-only forwarding overloads, and keeps the existing XA and nullable fixture/baseline paths intact.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Follow-up for .NET 12 to #13030. With
XAJavaInterop1now the only supported backend, the binding generator no longer needs to carry a target through its symbol table or indirect generator construction.Remove internal target storage/propagation, construct the generator directly, and remove its unused inheritance hooks. Keep the CLI selector, retired-target rejection, options validation, and public target-taking constructors; the compatibility constructors now forward to target-free overloads and are marked obsolete.
Collapse single-target test scaffolding without adding or removing existing test cases. Nullable and non-nullable baselines remain distinct, and all 192 generated files captured from the original suite remain byte-for-byte identical. Changes are confined to the binding generator and its tests.
Local validation
dotnet build external/Java.Interop/tools/generator/generator.csproj -v minimal— passed, 0 warnings/errors.dotnet test external/Java.Interop/tests/generator-Tests/generator-Tests.csproj -v minimal— passed, 478/478, 0 skipped; same count as the pre-change baseline.JavaInterop1.make prepare && make all— preparation passed; the first build hit a bootstrap evaluation failure where compilation lacked generatedANDROID_*constants. Re-running unchangedmake allcompiled successfully, then reached the known missing API 37.1 reference-pack bootstrap requirement../dotnet-local.sh build Microsoft.Android.slnx -t:BuildExtraApiLevels -c Debug -v quiet— passed../dotnet-local.sh build build-tools/create-packs/Microsoft.Android.Sdk.proj -t:ConfigureLocalWorkload -c Debug -v quiet— passed.make all— passed against this branch's own rebuilt SDK, without source/build-property workarounds../dotnet-local.sh test bin/TestDebug/net10.0/Xamarin.Android.Build.Tests.dll --filter 'FullyQualifiedName~BindingBuildTest&Name~DotNetBuildBinding|FullyQualifiedName~BindingBuildTest&Name~BindByteArrayInMethodParameter|FullyQualifiedName~BindingBuildTest&Name~NullableReferenceTypes|FullyQualifiedName~BindingBuildTest&Name~BindDefaultInterfaceMethods|FullyQualifiedName~BindingBuildTest&Name~BindingLibraryIncremental'— passed, 10/10, 0 skipped; CoreCLR and NativeAOT binding coverage.Pull Request
title and
description
should follow the
commit-messages.mdworkflow documentation, and in particular should include: