Skip to content

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

Description

@simonrozsival

The CodeGenerationTarget enum / AndroidCodegenTarget MSBuild property historically had three values:

  • XamarinAndroid - classic/legacy codegen target; obsolete and no longer supported.
  • XAJavaInterop1 - current supported/default .NET for Android target.
  • JavaInterop1 - experimental value from the first NativeAOT/Java.Interop exploration.

JavaInterop1 should be removed as a public/documented Android codegen value, and we should also remove the underlying JavaPeerStyle.JavaInterop1 / generator support once the remaining internal NativeAOT references are cleaned up.

Why this should be removable

The current NativeAOT/trimmable path does not need the JavaInterop1 Java peer generator shape:

  • The supported/default NativeAOT path uses the trimmable type map (_AndroidTypeMapImplementation=trimmable), and the trimmable type map has its own Java generator. It does not need to call the Java peer generator that emits net.dot.jni.ManagedPeer.* / JavaPeerStyle.JavaInterop1 style Java classes.
  • We don't need to use the JI1 style for Java classes anymore. It gets in the way more than it helps now that the trimmable type map owns the generated Java source shape.
  • The GC bridge currently has a distinction between CoreCLR and NativeAOT. Removing the remaining JavaInterop1-style split should let us align both paths around 100% shared native code.
  • The public docs now say JavaInterop1 is obsolete/no longer supported, leaving XAJavaInterop1 as the supported value for AndroidCodegenTarget.

Current source still has one important internal reference to migrate/remove:

That should be treated as cleanup work, not as a reason to keep the public experimental target.

Relevant history

Possible cleanup steps

  • Remove JavaInterop1 from the documented/public AndroidCodegenTarget surface if any remaining acceptance path still exists.
  • Replace/remove the NativeAOT $(_AndroidJcwCodegenTarget)=JavaInterop1 default.
  • Remove JavaPeerStyle.JavaInterop1 use from the dotnet/android build path.
  • Remove Java.Interop generator/codegen branches that only exist for CodeGenerationTarget.JavaInterop1, once the NativeAOT/trimmable path no longer consumes them.
  • Decide whether the trimmable type map Java shape needs a distinct internal name/specification (for example an XAJavaInterop2-style label), or whether it is simply the trimmable typemap Java generator and does not need to be represented as an AndroidCodegenTarget value.

Metadata

Metadata

Assignees

No one assigned

    Type

    No fields configured for Task.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions