Skip to content

[Java.Interop] Remove support for experimental JavaInterop1 codegen #11727

Closed

Description

@simonrozsival

Goal

Remove the experimental JavaInterop1 code-generation target and its runtime support, while preserving supported XAJavaInterop1 C# binding generation and the trimmable typemap's separate Java-generation pipeline.

Status

Completed by the merged cleanup series, verified against main at 44d713f364 on October 21, 2026:

  • Migrate the supported NativeAOT consumer and GC bridge: #12133.
  • Remove experimental CodeGenerationTarget.JavaInterop1, its CLI/configuration branches and target-specific baselines, ManagedPeer, ManagedPeerNativeRegistration, GCUserPeerable, handwritten Java.Interop proxies, and java-interop.jar: #13030.
  • Collapse C# binding generation to the supported XAJavaInterop1 backend: #13056.
  • Simplify the then-remaining JCW style (#13060), then retire the obsolete legacy JCW emitter, JavaPeerStyle selection, standalone jcw-gen, and associated scaffolding (#13080). The supported trimmable typemap Java pipeline remains.
  • Keep explicit SDK errors for retired AndroidCodegenTarget/_AndroidJcwCodegenTarget values, and retain the Android managed-object and exception transport paths.

Important scope distinction

The two retired JavaInterop1 switches controlled different things:

  1. CodeGenerationTarget.JavaInterop1 selected a generated C# binding shape.
  2. JavaPeerStyle.JavaInterop1 selected the old Java Callable Wrapper emitter style.

The trimmable typemap consumes neither selector. It generates its own Java sources and registers natives through TrimmableTypeMap.RegisterNativeMethods() and mono.android.Runtime.registerNatives(Class). Removing the old Java emitter does not remove supported XAJavaInterop1 C# binding generation.

Historical plan and retained behavior

The earlier plan first decoupled the built-in handwritten proxies from ManagedPeer (#12152) and proposed retaining their standalone/JVM behavior. That intermediate plan was superseded by #13030, which retired those unsupported proxies along with the bridge. Do not implement the old lazy-registration plan or preserve the retired standalone proxy contract.

Current Android managed-object transport uses the trimmable object proxy with Java identity semantics; exception transport uses Android.Runtime.JavaProxyThrowable. Regression coverage remains in the Android device suite and TrimmableTypeMapBuildTests, including proxy packaging checks. This is a reconciliation of merged work, not a claim of a new test run.

Compatibility decision

Do not retain a runtime ManagedPeer compatibility shim. Previously generated or handwritten Java bytecode referencing net.dot.jni.ManagedPeer must migrate off that retired bridge.

The optional actionable build-time diagnostic mentioned in #11635 is not implemented by this cleanup; keep that follow-up question separate from the completed code-generation retirement. The broader dependency, packaging, documentation, and separate API-deprecation audits remain tracked by #11843.

Activity

  1. added this to the .NET 11 milestone on Jun 24, 2026
  2. changed the title [-][Java.Interop] Remove support for experimental `JavaInterop1` AndroidCodegenTarget[/-] [+][Java.Interop] Remove support for experimental `JavaInterop1` AndroidCodegenTarget and JavaPeerStyle[/+] on Jun 24, 2026
  3. changed the title [-][Java.Interop] Remove support for experimental `JavaInterop1` AndroidCodegenTarget and JavaPeerStyle[/-] [+][Java.Interop] Remove support for experimental `JavaInterop1` AndroidCodegenTarget, _AndroidJcwCodegenTarget, and JavaPeerStyle[/+] on Jun 24, 2026
  4. changed the title [-][Java.Interop] Remove support for experimental `JavaInterop1` AndroidCodegenTarget, _AndroidJcwCodegenTarget, and JavaPeerStyle[/-] [+][Java.Interop] Remove support for experimental `JavaInterop1` codegen[/+] on Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions