Commit 3d0cd67
[TrimmableTypeMap] Emit array proxies for boxed nullable value types
GetTypes ("[Ljava/lang/Boolean;") and the other boxed value-type array
signatures dropped the Nullable<T> array family (bool?[], JavaObjectArray<bool?>)
on NativeAOT. Like System.String, Nullable<T> is a built-in reference mapping
injected at runtime by GetBuiltInTypeForSimpleReference, so it is neither a
scanned Java peer nor a primitive and had no pre-generated array proxy.
Unlike String, the proxy map key is the tricky part: at runtime
TryGetManagedTypeKey (typeof (bool?)) keyed on Type.FullName, whose type
argument carries the full versioned assembly-qualified name
(System.Nullable`1[[System.Boolean, System.Private.CoreLib, Version=...]]),
which the generator can't stably reproduce.
Normalize the generic key on both sides:
* Runtime (BuildManagedTypeKey): build closed-generic keys from the open
definition's FullName plus each type argument's normalized key (simple
assembly name, no Version/Culture/PublicKeyToken), and treat Nullable<T> as
a System.Runtime type. typeof (bool?) -> "System.Nullable`1[[System.Boolean,
System.Runtime]], System.Runtime".
* Generator (ModelBuilder): emit reference-array proxies for the eight
Nullable<primitive> types that have a boxed java/lang mapping, keyed with
the same normalized string.
Normalizing (rather than emitting version-qualified duplicates) keeps a single
canonical proxy per logical type.
Fixes the boxed-nullable portion of JniTypeManagerTests.GetType on trimmable
NativeAOT (added in the preceding test-coverage commit).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 243f5c4 commit 3d0cd67
3 files changed
Lines changed: 103 additions & 12 deletions
File tree
- src
- Microsoft.Android.Sdk.TrimmableTypeMap/Generator
- Mono.Android/Microsoft.Android.Runtime
- tests/Microsoft.Android.Sdk.TrimmableTypeMap.Tests/Generator
Lines changed: 44 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
34 | 49 | | |
35 | 50 | | |
36 | 51 | | |
| |||
732 | 747 | | |
733 | 748 | | |
734 | 749 | | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
735 | 779 | | |
736 | 780 | | |
737 | 781 | | |
| |||
Lines changed: 44 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
543 | 544 | | |
544 | 545 | | |
545 | 546 | | |
546 | | - | |
547 | | - | |
548 | | - | |
549 | | - | |
550 | | - | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
551 | 550 | | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
552 | 558 | | |
553 | 559 | | |
554 | | - | |
555 | | - | |
| 560 | + | |
556 | 561 | | |
557 | 562 | | |
558 | | - | |
559 | | - | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
560 | 591 | | |
561 | 592 | | |
562 | 593 | | |
563 | 594 | | |
564 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
565 | 599 | | |
566 | 600 | | |
567 | 601 | | |
| |||
Lines changed: 15 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1203 | 1203 | | |
1204 | 1204 | | |
1205 | 1205 | | |
1206 | | - | |
1207 | | - | |
| 1206 | + | |
| 1207 | + | |
1208 | 1208 | | |
1209 | 1209 | | |
1210 | 1210 | | |
| |||
1259 | 1259 | | |
1260 | 1260 | | |
1261 | 1261 | | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
1262 | 1275 | | |
1263 | 1276 | | |
1264 | 1277 | | |
| |||
0 commit comments