Skip to content

Comments

[TrimmableTypeMap] Add TypeMap proxy groundwork with CreateInstance#10808

Open
simonrozsival wants to merge 9 commits intomainfrom
dev/simonrozsival/trimmable-typemap-03-generators
Open

[TrimmableTypeMap] Add TypeMap proxy groundwork with CreateInstance#10808
simonrozsival wants to merge 9 commits intomainfrom
dev/simonrozsival/trimmable-typemap-03-generators

Conversation

@simonrozsival
Copy link
Member

@simonrozsival simonrozsival commented Feb 12, 2026

Part of #10799

Summary

Adds the core pipeline that transforms scanned JavaPeerInfo records into TypeMap .dll assemblies with proxy types and CreateInstance support.

Generator pipeline

  • TypeMapAssemblyData model: records for proxy types, type map attributes, associations
  • ModelBuilder: transforms JavaPeerInfoTypeMapAssemblyData with alias detection, ACW filtering, proxy naming, cross-assembly IgnoresAccessChecksTo support
  • TypeMapAssemblyEmitter: PE/IL emission of proxy types with CreateInstance, get_TargetType, get_InvokerType properties
  • TypeMapAssemblyGenerator: orchestrates Build + Emit pipeline
  • RootTypeMapAssemblyGenerator: generates root _Microsoft.Android.TypeMaps.dll
  • JniSignatureHelper: JNI signature parsing utility
  • Scanner enrichment for generator consumption

Tests

  • Comprehensive test coverage for model builder, assembly generator, and root assembly generator

UCO wrappers, RegisterNatives, and IAndroidCallableWrapper support will be added in a follow-up PR.

Stacked PRs:

  1. PR [TrimmableTypeMap] Add TypeMap proxy groundwork with CreateInstance #10808this PR — Proxy groundwork with CreateInstance
  2. PR [TrimmableTypeMap] Add UCO wrappers, RegisterNatives, and IAndroidCallableWrapper #10831 — UCO wrappers + RegisterNatives
  3. PR [TrimmableTypeMap] Add JCW Java source generator #10830 — JCW Java Source Generation

@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-02-scanner branch 5 times, most recently from 627fef2 to 408d73d Compare February 13, 2026 09:25
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch 2 times, most recently from ba936c9 to 61ac7ed Compare February 13, 2026 10:35
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch 2 times, most recently from ddddd2f to 83a50be Compare February 13, 2026 11:22
@simonrozsival simonrozsival added Area: NativeAOT Issues that only occur when using NativeAOT. Area: CoreCLR Issues that only occur when using CoreCLR. copilot `copilot-cli` or other AIs were used to author this trimmable-type-map labels Feb 13, 2026
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from 83a50be to 4e7d06c Compare February 13, 2026 17:12
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-02-scanner branch 8 times, most recently from 2388cf1 to e92938e Compare February 16, 2026 21:04
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from 4e7d06c to 7088777 Compare February 16, 2026 22:25
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-02-scanner branch from e92938e to 9215de9 Compare February 18, 2026 15:49
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from 7088777 to b9f33c9 Compare February 18, 2026 16:31
@simonrozsival simonrozsival changed the base branch from dev/simonrozsival/trimmable-typemap-02-scanner to main February 18, 2026 16:31
@simonrozsival simonrozsival changed the title [TrimmableTypeMap] Add TypeMap assembly and JCW Java source generators [TrimmableTypeMap] Add TypeMap assembly generators with model builder Feb 18, 2026
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from b9f33c9 to 21a68db Compare February 18, 2026 17:08
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch 3 times, most recently from 4c8b459 to e3e4f05 Compare February 19, 2026 10:03
Add the core pipeline that transforms scanned JavaPeerInfo records into
TypeMap .dll assemblies with proxy types and CreateInstance support:

- TypeMapAssemblyData model: proxy types, TypeMap attributes, associations
- ModelBuilder: transforms JavaPeerInfo into model with alias detection,
  ACW filtering, proxy naming, cross-assembly IgnoresAccessChecksTo
- TypeMapAssemblyEmitter: PE/IL emission of proxy types with CreateInstance,
  get_TargetType, get_InvokerType properties
- TypeMapAssemblyGenerator: orchestrates Build + Emit pipeline
- RootTypeMapAssemblyGenerator: generates root _Microsoft.Android.TypeMaps.dll
- JniSignatureHelper: JNI signature parsing utility
- Scanner enrichment for generator consumption
- Comprehensive tests for model builder, assembly generator, root generator

UCO wrappers, RegisterNatives, and IAndroidCallableWrapper support will
be added in a follow-up PR.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from e3e4f05 to 9449651 Compare February 19, 2026 10:09
simonrozsival and others added 2 commits February 19, 2026 11:33
This entire test file references JcwJavaSourceGenerator which doesn't
exist in this PR or anywhere in the repo yet. It belongs with PR #10830
(JCW Java Source Generation) which introduces that class.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move UCO-specific JniSignatureHelper methods (JniParamKind, ParseParameterTypes,
ParseReturnType, EncodeClrType, ParseSingleType) and their tests to PR #10831.

Move JCW-specific scanner properties (BaseJavaName, ImplementedInterfaceJavaNames,
JavaConstructors, JavaConstructorInfo) and resolver methods (ResolveBaseJavaName,
ResolveImplementedInterfaceJavaNames, ResolveInterfaceJniName, BuildJavaConstructors)
to PR #10830.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Add JniParamKind enum, ParseParameterTypes, ParseReturnType,
EncodeClrType, ParseSingleType, and their test classes
(JniSignatureHelperTests, NegativeEdgeCase) — moved from PR #10808.

Also add back JavaConstructors property, JavaConstructorInfo record,
and BuildJavaConstructors scanner method needed by ModelBuilder.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Add BaseJavaName, ImplementedInterfaceJavaNames properties to JavaPeerInfo,
and ResolveBaseJavaName, ResolveImplementedInterfaceJavaNames,
ResolveInterfaceJniName methods to JavaPeerScanner — moved from PR #10808.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Add JniParamKind enum, ParseParameterTypes, ParseReturnType,
EncodeClrType, ParseSingleType, and their test classes
(JniSignatureHelperTests, NegativeEdgeCase) — moved from PR #10808.

Also add back JavaConstructors property, JavaConstructorInfo record,
and BuildJavaConstructors scanner method needed by ModelBuilder.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Add BaseJavaName, ImplementedInterfaceJavaNames properties to JavaPeerInfo,
and ResolveBaseJavaName, ResolveImplementedInterfaceJavaNames,
ResolveInterfaceJniName methods to JavaPeerScanner — moved from PR #10808.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use xUnit's IDisposable pattern for test cleanup instead of manual
try-finally blocks. Each nested test class that generates temp files
now creates a per-instance temp directory in a field initializer and
cleans it up in Dispose().

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival simonrozsival force-pushed the dev/simonrozsival/trimmable-typemap-03-generators branch from d9bd575 to 163f892 Compare February 19, 2026 12:07
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Add JniParamKind enum, ParseParameterTypes, ParseReturnType,
EncodeClrType, ParseSingleType, and their test classes
(JniSignatureHelperTests, NegativeEdgeCase) — moved from PR #10808.

Also add back JavaConstructors property, JavaConstructorInfo record,
and BuildJavaConstructors scanner method needed by ModelBuilder.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Add BaseJavaName, ImplementedInterfaceJavaNames properties to JavaPeerInfo,
and ResolveBaseJavaName, ResolveImplementedInterfaceJavaNames,
ResolveInterfaceJniName methods to JavaPeerScanner — moved from PR #10808.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Add BaseJavaName, ImplementedInterfaceJavaNames properties to JavaPeerInfo,
and ResolveBaseJavaName, ResolveImplementedInterfaceJavaNames,
ResolveInterfaceJniName methods to JavaPeerScanner — moved from PR #10808.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
- Remove // ---- section separator comments from PEAssemblyBuilder and
  TypeMapAssemblyEmitter
- Expand all single-line /// <summary>...</summary> to 3-line format
- Remove trivial property doc comments that just restate the name

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Add JniParamKind enum, ParseParameterTypes, ParseReturnType,
EncodeClrType, ParseSingleType, and their test classes
(JniSignatureHelperTests, NegativeEdgeCase) — moved from PR #10808.

Also add back JavaConstructors property, JavaConstructorInfo record,
and BuildJavaConstructors scanner method needed by ModelBuilder.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Add BaseJavaName, ImplementedInterfaceJavaNames properties to JavaPeerInfo,
and ResolveBaseJavaName, ResolveImplementedInterfaceJavaNames,
ResolveInterfaceJniName methods to JavaPeerScanner — moved from PR #10808.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
simonrozsival added a commit that referenced this pull request Feb 19, 2026
Add BaseJavaName, ImplementedInterfaceJavaNames properties to JavaPeerInfo,
and ResolveBaseJavaName, ResolveImplementedInterfaceJavaNames,
ResolveInterfaceJniName methods to JavaPeerScanner — moved from PR #10808.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@simonrozsival
Copy link
Member Author

/azp run Xamarin.Android-PR

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

Retry all PR checks to refresh failing internal status context.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a Linux template parameter for MSBUILD_ARGS and set -m:2 in the public pipeline Linux build to reduce recurrent MSB4166/OOM failures.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@simonrozsival
Copy link
Member Author

/azp run Xamarin.Android-PR

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: CoreCLR Issues that only occur when using CoreCLR. Area: NativeAOT Issues that only occur when using NativeAOT. 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