Skip to content

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

Closed

Description

@simonrozsival

Goal

Reduce this repository to the minimum set of components that are required by dotnet/android, and remove legacy standalone JVM/desktop experiments, samples, tests, and alternative runtime paths that are no longer maintained or used by the Android SDK product path.

This should be done incrementally across multiple focused PRs rather than as one large deletion PR.

Progress

Status checked against merged PRs and the current main tree (44d713f364) on October 21, 2026. Checked items are completed removals or explicitly described retirements, not merely proposed changes. The remaining audits and separate API deprecation work are still open.

Completed

  • Remove Java.Runtime.Environment and its former direct desktop/JRE consumers. The component is absent from the current tree; the remaining JreRuntime under Microsoft.Android.Runtime.NativeAOT is Android runtime code, not the retired standalone library.
  • Remove the experimental Java.Interop.Dynamic, Java.Interop.GenericMarshaler, and Java.Base components, including src/Java.Base-ref.cs (absent from the current tree).
  • Retire JVM-only interop test runs and fixtures, and remove the desktop Java.Interop stage from public, internal, and official pipelines: #12894.
  • Remove reflection-backed JNI type/value managers, the standalone TestJVM harness and host interop test project, and obsolete proxy-runtime/test scaffolding: #13018.
  • Move retained core JNI tests and Java fixtures into the Android device suite, removing the former standalone test directory and desktop-specific selection: #13019.
  • Retire experimental JavaInterop1 binding/JCW support, ManagedPeer, GCUserPeerable, handwritten Java.Interop proxies, and java-interop.jar, while preserving supported Android interop: #13030.
  • Remove unused Mono native-validation adapters and runtime-pack/header dependencies: #13054.
  • Remove orphaned internal JNI runtime/allocation helpers: #13057.
  • Retire obsolete expression-marshaling/member-builder and ActivatePeer contracts, preserving non-expression value marshaling and generated activation: #13058.
  • Simplify binding generation to its single supported backend and JCW generation to its then-supported single style: #13056, #13060.
  • Remove the obsolete legacy JCW emitter, standalone jcw-gen, Java wrapper/bootstrap scaffolding, and alternate runtime JAR/DEX artifacts; retain the trimmable typemap Java pipeline: #13080.
  • Remove the legacy version-1 binary TypeNameMapGenerator: #13094.
  • Remove JavaTypeScanner and its unused Cecil adapters/helpers: #13122.
  • Remove the unused native Java.Interop support library, its validation/build project, CMake dependencies, and runtime-pack assets; use direct Android runtime symbol lookup: #13112.
  • Remove the unused param-name-importer, its build references/dependency, and stale documentation. Android parameter-name generation already uses java-source-utils.jar; existing parameter metadata remains supported: #13113.
  • Remove the dead javadoc-to-mdoc tool: #12683.
  • Remove the obsolete raw JNI backend from the Android jnienv-gen tool and its backend-selection plumbing: #13100.
  • Remove the standalone desktop external/Java.Interop/samples/Hello-NativeAOTFromJNI sample, its obsolete publish/run steps, and sample-only parameters in core-tests.yaml: #13138. Preserve Android NativeAOT support.
  • Remove the orphaned desktop external/Java.Interop/tests/NativeTiming project and its entry in Java.Interop.slnx: #13138. Preserve the separate Android JCW device-test timing fixture.
  • Remove Mono.Android.Export.dll and its legacy runtime export callback engine; retain [Export]/[ExportField] through trimmable typemaps: #13111.
  • Retire runtime JNI delegate wrapping, but retain public Android.Runtime.JNINativeWrapper.CreateDelegate(Delegate) for legacy connector binary references. On main (.NET 12), the method is [Obsolete(..., error: true)] and throws NotSupportedException: #13130. The separate .NET 11 release-branch change marks it obsolete with error: true while retaining the implementation: #13128. Neither change removes the public class/method.

Remaining

  • Audit and remove leftover standalone build/automation metadata and documentation after the above deletions. In particular, review the remaining external/Java.Interop/build-tools/automation/templates/ files and standalone-build/support guidance; remove only what has no retained caller or supported developer/test use.
  • Complete a final dependency/packaging audit of the retained components and any remaining alternative runtime paths. Remove further pieces only when proven unused by Android and its retained tests; update build/solution metadata and documentation alongside each removal and validate the affected Android build/test paths. Public-unused Java.Interop APIs require separate deprecation/compatibility decisions, not blanket removal; preserve supported retained contracts.

Retained Android components

These are not unchecked deletion candidates. Keep the Android runtime, binding/API-generation tools, and their live transitive dependencies unless a separate dependency audit proves otherwise:

  • src/Java.Interop — managed JNI runtime used by Android.
  • tools/generator and src/Java.Interop.Tools.Generator — supported XAJavaInterop1 C# binding generation.
  • tools/class-parse — Java bytecode/API description generation.
  • tools/java-source-utils and src/Java.Interop.Tools.JavaSource — Java-source/parameter metadata and related tooling.
  • src/Java.Interop.Tools.JavaCallableWrappers — remaining shared naming/hash/identifier utilities; the old emitter/scanner/CLI have been removed.
  • src/Java.Interop.Tools.JavaTypeSystem, src/Java.Interop.Tools.TypeNameMappings, and retained Cecil utilities.
  • src/Java.Interop.Tools.Maven — still directly referenced by Android build tasks; not a blanket removal candidate.
  • src/Xamarin.Android.Tools.ApiXmlAdjuster, src/Xamarin.Android.Tools.Bytecode, src/Xamarin.SourceWriter, live annotation support, and shared diagnostics/localization support.
  • Android device JNI/runtime tests and retained host-side tooling tests.

The former initial keep-list entries tools/param-name-importer and tools/jcw-gen have been removed after their replacements/retirement were established. The goal remains to remove unsupported standalone infrastructure, not all Java.Interop tooling or Android NativeAOT.

Approach for remaining work

For each component:

  1. Prove whether dotnet/android, its SDK packs, or retained tests/developer workflows reference it.
  2. Remove it in a focused PR only if unused.
  3. Update solution/build metadata and directly related documentation in the same PR.
  4. Validate the remaining Java.Interop tooling and relevant Android build/test path.
  5. Preserve supported behavior and distinguish completed removals from open investigations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    java-interopneeds-triage

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions