Skip to content

Commit 1e7f269

Browse files
[Java.Interop.GenericMarshaler] fix trimmer warnings (#1314)
Context: dotnet/android#9846 When trying to build `Mono.Android-Tests` for NativeAOT, I get many warnings like this (that are upgraded to errors): src\Java.Interop.GenericMarshaler\Java.Interop.GenericMarshaler\JniPeerInstanceMethodsExtensions.cs(10874,17): error IL2091: 'T' generic argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicConstructors', 'DynamicallyAccessedMemberTypes.NonPublicConstructors' in 'Java.Interop.JniRuntime.JniValueManager.GetValueMarshaler<T>()'. The generic parameter 'T16' of 'Java.Interop.GenericMarshaler.JniPeerInstanceMethodsExtensions.InvokeGenericVirtualObjectMethod<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16>(JniInstanceMethods, String, IJavaPeerable, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. Build failed with 2992 error(s) in 4.8s To solve this here, we can import: <Import Project="..\..\build-tools\trim-analyzers\trim-analyzers.props" /> To see all the warnings *here*, and then I added the missing attributes to solve the warnings.
1 parent 471afd4 commit 1e7f269

File tree

3 files changed

+6660
-373
lines changed

3 files changed

+6660
-373
lines changed

src/Java.Interop.GenericMarshaler/Java.Interop.GenericMarshaler.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
</PropertyGroup>
99

1010
<Import Project="..\..\TargetFrameworkDependentValues.props" />
11+
<Import Project="..\..\build-tools\trim-analyzers\trim-analyzers.props" />
1112

1213
<PropertyGroup>
1314
<OutputPath>$(ToolOutputFullPath)</OutputPath>

0 commit comments

Comments
 (0)