Commit 3341169
[TrimmableTypeMap] Java.Interop bump and update to ValueManagers and TypeManagers (#11799)
## Summary
Bumps **external/Java.Interop** and aligns Mono.Android's reflection-based type and value managers with the new base-class contracts. The Java.Interop bump relaxes the `[DynamicallyAccessedMembers]` (DAM) requirements on the virtual members of `JniRuntime.ReflectionJniTypeManager` / `JniRuntime.ReflectionJniValueManager`, so the Mono.Android overrides no longer need to repeat those annotations and instead rely on targeted trimmer/AOT suppressions.
This is a standalone slice of #11617 with no dependency on the trimmable type-map scanner/emitter or array codegen work.
## Changes
- `external/Java.Interop` → `8d544738a` (from `70493645c`).
- Drop now-redundant `[DynamicallyAccessedMembers]` annotations from the overrides in `AndroidTypeManager`, `ManagedTypeManager`, and `TrimmableTypeMapTypeManager` (`GetInvokerTypeCore`, `GetTypeForSimpleReference`, `RegisterNativeMembers`, `ActivatePeer`), replacing them with `[UnconditionalSuppressMessage]` where the trimmer still needs reassurance.
- `JavaMarshalValueManager` now extends `JniRuntime.ReflectionJniValueManager` directly. It is marked `sealed` and carries `[RequiresDynamicCode]` / `[RequiresUnreferencedCode]`, uses the base `EnsureNotDisposed ()` helper, and drops its own dispose tracking and `ActivatePeer` override.
- Remove the superseded `AndroidReflectionJniValueManager` and `SimpleValueManager` (and their `Mono.Android.csproj` entries).
- `JNIEnvInit.CreateValueManager` creates the value manager through a local helper with the appropriate trimming/AOT suppressions for both the CoreCLR and NativeAOT paths.
- No NativeAOT default change; the trimmable type/value managers are **not** part of this PR.
## Tests / baselines
- Update the API-compatibility baseline: `Android.Graphics.ColorValueMarshaler.CreateGenericValue`'s `targetType` parameter no longer carries a DAM attribute (inherited from the Java.Interop base-class change).
- Refresh `SimpleDotNet` CoreCLR/NativeAOT apkdesc size baselines and the NativeAOT `BuildHasNoWarnings` count, plus `BuildTest2`.
## Context
Carved out of #11617. `JavaMarshalRegisteredPeers` extraction already merged via #11750. The trimmable managers, scanner/emitter, manifest, and R8 changes ship in their own PRs (#11749/#11751/#11753/#11769/#11794/#11796/#11798).
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 837746b commit 3341169
17 files changed
Lines changed: 56 additions & 536 deletions
File tree
- external
- src
- Microsoft.Android.Runtime.NativeAOT/Java.Interop
- Mono.Android
- Android.App
- Android.Graphics
- Android.Runtime
- Microsoft.Android.Runtime
- Xamarin.Android.Build.Tasks/Tests
- Xamarin.Android.Build.Tests
- Xamarin.ProjectTools/Resources/Base
- tests/api-compatibility
Submodule Java.Interop updated 21 files
- samples/Hello-NativeAOTFromAndroid/NativeAotTypeManager.cs+1-8
- samples/Hello-NativeAOTFromJNI/NativeAotTypeManager.cs+1-7
- src/Java.Interop/Java.Interop/JavaArray.cs+1-5
- src/Java.Interop/Java.Interop/JavaObjectArray.cs+1-6
- src/Java.Interop/Java.Interop/JavaPrimitiveArrays.cs-15
- src/Java.Interop/Java.Interop/JniBuiltinMarshalers.cs+27-48
- src/Java.Interop/Java.Interop/JniBuiltinMarshalers.tt+12-12
- src/Java.Interop/Java.Interop/JniRuntime.JniTypeManager.cs+6-44
- src/Java.Interop/Java.Interop/JniRuntime.JniValueManager.cs+8-16
- src/Java.Interop/Java.Interop/JniRuntime.ReflectionJniTypeManager.cs+5-35
- src/Java.Interop/Java.Interop/JniRuntime.ReflectionJniValueManager.cs+10-24
- src/Java.Interop/Java.Interop/JniRuntime.cs+7
- src/Java.Interop/Java.Interop/JniStringValueMarshaler.cs-1
- src/Java.Interop/Java.Interop/JniValueMarshaler.cs+1-11
- src/Java.Interop/Java.Interop/ManagedPeer.cs+2-7
- src/Java.Interop/Java.Interop/RuntimeFeature.cs+4-3
- src/Java.Interop/PublicAPI.Unshipped.txt-5
- src/Java.Runtime.Environment/Java.Interop/JreTypeManager.cs-1
- tests/Java.Interop-Tests/Java.Interop/JavaVMFixture.cs-1
- tests/Java.Interop-Tests/Java.Interop/JniRuntimeTest.cs-15
- tests/Java.Interop-Tests/Java.Interop/JniValueMarshalerContractTests.cs-1
Lines changed: 8 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
| |||
84 | 84 | | |
85 | 85 | | |
86 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
87 | 94 | | |
88 | 95 | | |
89 | 96 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
434 | 434 | | |
435 | 435 | | |
436 | 436 | | |
437 | | - | |
438 | 437 | | |
439 | 438 | | |
440 | 439 | | |
441 | 440 | | |
442 | 441 | | |
443 | 442 | | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
| 443 | + | |
449 | 444 | | |
450 | 445 | | |
451 | 446 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
314 | 314 | | |
315 | 315 | | |
316 | 316 | | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | 317 | | |
323 | 318 | | |
324 | 319 | | |
| |||
335 | 330 | | |
336 | 331 | | |
337 | 332 | | |
338 | | - | |
339 | 333 | | |
340 | 334 | | |
341 | 335 | | |
| |||
384 | 378 | | |
385 | 379 | | |
386 | 380 | | |
387 | | - | |
388 | | - | |
389 | | - | |
390 | | - | |
| 381 | + | |
391 | 382 | | |
392 | 383 | | |
393 | 384 | | |
| |||
500 | 491 | | |
501 | 492 | | |
502 | 493 | | |
503 | | - | |
504 | 494 | | |
505 | 495 | | |
506 | 496 | | |
507 | 497 | | |
508 | 498 | | |
509 | 499 | | |
| 500 | + | |
510 | 501 | | |
511 | 502 | | |
512 | 503 | | |
513 | | - | |
| 504 | + | |
514 | 505 | | |
515 | 506 | | |
516 | 507 | | |
| |||
852 | 843 | | |
853 | 844 | | |
854 | 845 | | |
855 | | - | |
| 846 | + | |
856 | 847 | | |
857 | 848 | | |
858 | 849 | | |
| |||
Lines changed: 0 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | 12 | | |
15 | 13 | | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
21 | | - | |
22 | 19 | | |
23 | 20 | | |
24 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
188 | 188 | | |
189 | 189 | | |
190 | 190 | | |
191 | | - | |
| 191 | + | |
192 | 192 | | |
193 | 193 | | |
194 | 194 | | |
195 | | - | |
| 195 | + | |
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
199 | 206 | | |
200 | 207 | | |
201 | 208 | | |
| |||
Lines changed: 0 additions & 176 deletions
This file was deleted.
Lines changed: 5 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
16 | 18 | | |
17 | | - | |
18 | | - | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | 24 | | |
37 | 25 | | |
38 | 26 | | |
| |||
68 | 56 | | |
69 | 57 | | |
70 | 58 | | |
71 | | - | |
| 59 | + | |
72 | 60 | | |
73 | 61 | | |
74 | 62 | | |
| |||
87 | 75 | | |
88 | 76 | | |
89 | 77 | | |
90 | | - | |
| 78 | + | |
91 | 79 | | |
92 | 80 | | |
93 | 81 | | |
| |||
0 commit comments