Skip to content

[TrimmableTypeMap] Refactor NativeTypeMap tests to use runtime-agnostic type map API #11018

Description

@simonrozsival

Parent issue:#11017

The following tests are tagged [Category("NativeTypeMap")] because they call TypeManager.GetJavaToManagedType() and JNIEnv.TypemapManagedToJava() — APIs that read directly from the native LLVM typemap and don't work with the trimmable path.

They should be refactored to use JniRuntime.CurrentRuntime.TypeManager, which routes through whatever ITypeMap is registered at runtime and works regardless of which typemap implementation is active.


JnienvTest.JavaToManagedTypeMappingtests/Mono.Android-Tests/Mono.Android-Tests/Java.Interop/JnienvTest.cs

// Before:Typem=Java.Interop.TypeManager.GetJavaToManagedType("android/content/res/Resources");// After:Type?m=JniRuntime.CurrentRuntime.TypeManager.GetType(newJniTypeSignature("android/content/res/Resources"));

JnienvTest.ManagedToJavaTypeMapping — same file

// Before:stringm=JNIEnv.TypemapManagedToJava(type);// After:string?m=JniRuntime.CurrentRuntime.TypeManager.GetTypeSignature(type).SimpleReference;

AndroidValueManagerContractTeststests/Mono.Android-Tests/Java.Interop-Tests/Java.InteropTests/AndroidValueManagerContractTests.cs

  • Drop [Category("NativeTypeMap")] — the AndroidValueManager contract tests work through ITypeMap and should pass regardless of which typemap is active.

Cleanup:

  • Remove [Category("NativeTypeMap")] from all refactored methods
  • Remove NativeTypeMap from the ExcludeCategories NativeAOT condition in tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj

Activity

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