Skip to content

[Java.Interop] Remove unused tooling assemblies and package pins - #13223

Merged
jonathanpeppers merged 1 commit into
mainfrom
simonrozsival-java-interop-dependency-audit
Oct 21, 2026
Merged

jonathanpeppers merged 1 commit into
mainfrom
simonrozsival-java-interop-dependency-audit

Conversation

@simonrozsival

Copy link
Copy Markdown
Member

Pull Request
title and
description
should follow the
commit-messages.md workflow documentation, and in particular should include:

  • Useful description of why the change is necessary.
  • Links to issues fixed
  • Unit tests

Continue the final dependency/packaging audit for #11843. Two Java.Interop projects are outside the Android, retained tooling-test, and bootstrap dependency closure; neither assembly is included in SDK, reference, or runtime packs.

Remove the unused Xamarin.Android.Tools.AnnotationSupport.Cecil adapter. Binding generation already uses ManagedTypeFinderGeneratorTypeSystem; retain the live annotation library and generator adapter.

Remove the duplicate standalone Java.Interop.Tools.TypeNameMappings.csproj and its unused shared-project wrappers. Keep JavaNativeTypeManager.cs unchanged, including its direct compilation into Mono.Android and the shipped Java.Interop.Tools.JavaCallableWrappers assembly. No public product API or naming implementation is removed.

Remove three version-only PackageReference Update entries without subtree Include consumers: Microsoft.CSharp, Microsoft.DotNet.GenAPI, and Mono.Linq.Expressions. Actual package dependencies and versions are unchanged; outer Android bootstrap/device-test references remain untouched.

All 27 retained Java.Interop projects remain reachable from Android, the nine host suites, or live bootstrap. The Android-side closure remains 17 projects, and the project-declared package ID set remains 14. SDK/ref/runtime manifests, shared source links, JNINativeWrapper compatibility APIs, and supported runtime/generator paths are unchanged. The audit and detailed evidence are attached to #11843. This is independent of the runner/bootstrap and documentation cleanup PRs.

Validation

Fresh local worktree validation used existing javac 23.0.2, DOTNET_PROCESSOR_COUNT=2, and JAVA_TOOL_OPTIONS='-XX:ActiveProcessorCount=2'. $jdk is the local JDK home and $artifacts is the session artifact directory; logs/binlogs/TRX were retained locally.

dotnet build external/Java.Interop/Java.Interop.slnx -t:Prepare -c Debug -m:1 --disable-build-servers -nr:false -p:UseSharedCompilation=false "-p:JdksRoot=$jdk" '-p:GradleArgs=--stacktrace --no-daemon --max-workers=1 -Pkotlin.compiler.execution.strategy=in-process' "-bl:$artifacts/dependency-audit-prepare.binlog" -v:minimal

Passed.

dotnet build external/Java.Interop/Java.Interop.slnx -c Debug -m:1 --disable-build-servers -nr:false -p:UseSharedCompilation=false '-p:GradleArgs=--stacktrace --no-daemon --max-workers=1 -Pkotlin.compiler.execution.strategy=in-process' "-bl:$artifacts/dependency-audit-build.binlog" -v:minimal

Passed, 0 warnings and 0 errors.

dotnet test external/Java.Interop/Java.Interop.slnx -c Debug --no-build --no-restore -m:1 --disable-build-servers -nr:false -p:UseSharedCompilation=false --logger trx --results-directory "$artifacts/dependency-audit-results" "-bl:$artifacts/dependency-audit-tests.binlog" -v:minimal

All nine suites ran: 799 passed, 1 failed, 2 skipped. The only failure is the pre-existing ModuleInfoTests.ClassFile expectation of 12 constant-pool entries versus 13 emitted by javac 23.0.2. Independently archived main's Java fixtures and compiled them using the same evaluated source lists/compiler flags: baseline/current module-info.class are byte-identical (SHA-256 70344aeaf5936f8f8256ab7416958bf867f45f8309d4aa9a44f35b8f6393ab99). Test and bytecode-library sources are unchanged. No suppression, exclusion, JDK pin, or unrelated test change was made.

dotnet build external/Java.Interop/tools/java-source-utils/java-source-utils.csproj -t:RunTests -c Debug --no-restore -m:1 --disable-build-servers -nr:false -p:UseSharedCompilation=false '-p:GradleArgs=--stacktrace --no-daemon --max-workers=1 -Pkotlin.compiler.execution.strategy=in-process' "-bl:$artifacts/dependency-audit-java-source-tests.binlog" -v:minimal

All 18 Java tests passed; six existing obsolete-Java-8-option warnings, zero errors.

dotnet sln external/Java.Interop/Java.Interop.slnx list, read-only MSBuild evaluation of all 27 projects, static baseline/current project/package/pack/source-link checks, and git diff --check passed. No full Android SDK/native build or device tests were run for these unshipped-project/version-metadata-only deletions.

Fixes: #11843

The final dependency audit for #11843 finds two projects outside the
Android, retained tooling test, and bootstrap dependency closure.
Neither assembly is included in Android SDK or runtime packs.

Remove the unused Cecil annotation adapter; binding generation already
uses the generator-model adapter.  Remove the duplicate standalone
TypeNameMappings assembly and unused shared-project wrappers, retaining
JavaNativeTypeManager.cs and its direct compilation into Mono.Android
and Java.Interop.Tools.JavaCallableWrappers.

Drop three version-only package updates without subtree Include items.
Retain actual package dependencies, public product APIs, and existing
SDK/ref/runtime packaging contracts.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 08:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

No actionable code issues were identified, but completed Android integration validation remains unconfirmed.

No open issues 🎉

What changed in this PR

Continues #11843’s dependency cleanup by removing unused Java.Interop tooling projects while preserving shared naming code and shipped components.

Changes:

  • Removes the unused Cecil annotation adapter.
  • Removes the standalone TypeNameMappings project and shared-project wrappers.
  • Drops three unused package-version pins and updates solution membership.
File Description
external/​Java.Interop/​src/​Xamarin.Android.Tools.AnnotationSupport.Cecil/​Xamarin.Android.Tools.AnnotationSupport.Cecil.csproj Removes unused adapter project.
external/​Java.Interop/​src/​Xamarin.Android.Tools.AnnotationSupport.Cecil/​ManagedTypeFinderCecil.cs Removes adapter implementation.
external/​Java.Interop/​src/​Xamarin.Android.Tools.AnnotationSupport.Cecil/​CecilExtensions.cs Removes adapter-specific helpers.
external/​Java.Interop/​src/​Java.Interop.Tools.TypeNameMappings/​Java.Interop.Tools.TypeNameMappings.shproj Removes unused shared-project wrapper.
external/​Java.Interop/​src/​Java.Interop.Tools.TypeNameMappings/​Java.Interop.Tools.TypeNameMappings.projitems Removes unused shared-source metadata.
external/​Java.Interop/​src/​Java.Interop.Tools.TypeNameMappings/​Java.Interop.Tools.TypeNameMappings.csproj Removes duplicate standalone project.
external/​Java.Interop/​Java.Interop.slnx Removes deleted projects from the solution.
external/​Java.Interop/​Directory.Build.targets Removes three unused package-version pins.

Review effort: Balanced

@jonathanpeppers
jonathanpeppers merged commit 75daa7a into main Oct 21, 2026
42 checks passed
@jonathanpeppers
jonathanpeppers deleted the simonrozsival-java-interop-dependency-audit branch October 21, 2026 19:55
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.

Reduce Java.Interop to the components required by dotnet/android

3 participants