Skip to content

[TrimmableTypeMap] Fix trimmable Java object activation#11275

Draft
simonrozsival wants to merge 2 commits intotrimmable-virtual-constructorfrom
trimmable-object-activation
Draft

[TrimmableTypeMap] Fix trimmable Java object activation#11275
simonrozsival wants to merge 2 commits intotrimmable-virtual-constructorfrom
trimmable-object-activation

Conversation

@simonrozsival
Copy link
Copy Markdown
Member

@simonrozsival simonrozsival commented May 3, 2026

Summary

  • run default managed constructors from generated no-arg constructor callbacks using direct generated IL instead of reflection
  • mark generated constructor activation peers as replaceable so managed wrappers can replace temporary peers created during Java-side virtual dispatch
  • re-enable the throwable activation and JNI CreateInstance identity tests for trimmable typemap

Validation

  • dotnet build src/Mono.Android/Mono.Android.csproj -v:minimal -nologo -consoleloggerparameters:NoSummary
  • dotnet build src/Microsoft.Android.Sdk.TrimmableTypeMap/Microsoft.Android.Sdk.TrimmableTypeMap.csproj -v:minimal -nologo -consoleloggerparameters:NoSummary
  • MSBUILDDISABLENODEREUSE=1 /Users/simonrozsival/Projects/dotnet/android-trimmable-java-proxy-object/dotnet-local.sh build tests/Mono.Android-Tests/Mono.Android-Tests/Mono.Android.NET-Tests.csproj -c Debug -p:_AndroidTypeMapImplementation=trimmable -p:UseMonoRuntime=false -nr:false -m:1 -v:minimal -nologo -consoleloggerparameters:NoSummary
  • Focused device run with temporary category filter: passed=3, failed=0 for ActivatedDirectThrowableSubclassesShouldBeRegistered, GetObject_ReturnsMostDerivedType, JnienvCreateInstance_RegistersMultipleInstances

Related issues

@simonrozsival simonrozsival changed the title Fix trimmable Java object activation [TrimmableTypeMap] Fix trimmable Java object activation May 3, 2026
@simonrozsival simonrozsival added copilot `copilot-cli` or other AIs were used to author this trimmable-type-map labels May 3, 2026
@simonrozsival simonrozsival force-pushed the trimmable-virtual-constructor branch from 711aeae to 7e2737b Compare May 4, 2026 18:23
@simonrozsival simonrozsival force-pushed the trimmable-object-activation branch from a8491be to 3bcb461 Compare May 4, 2026 18:23
simonrozsival and others added 2 commits May 4, 2026 20:31
Run default managed constructors for generated no-arg constructor callbacks, and mark generated constructor activation peers as replaceable so managed wrappers can replace temporary peers created during Java-side virtual dispatch.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Avoid reflection for generated no-arg Java constructor callbacks by emitting IL that attaches the JNI peer and invokes the managed default constructor directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival simonrozsival force-pushed the trimmable-virtual-constructor branch from 7e2737b to dc13b42 Compare May 4, 2026 18:31
@simonrozsival simonrozsival force-pushed the trimmable-object-activation branch from 3bcb461 to 82ae8f0 Compare May 4, 2026 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

copilot `copilot-cli` or other AIs were used to author this trimmable-type-map

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant