|
1 | 1 | using System;
|
2 | 2 | using System.Collections.Generic;
|
| 3 | +using System.Diagnostics.CodeAnalysis; |
3 | 4 | using System.Linq;
|
4 | 5 | using System.Linq.Expressions;
|
5 | 6 | using System.Reflection;
|
|
13 | 14 |
|
14 | 15 | namespace Java.InteropTests {
|
15 | 16 |
|
16 |
| - public abstract class JniValueMarshalerContractTests<T> : JavaVMFixture { |
| 17 | + public abstract class JniValueMarshalerContractTests< |
| 18 | + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] |
| 19 | + T |
| 20 | + > : JavaVMFixture |
| 21 | + { |
17 | 22 |
|
18 | 23 | protected abstract T Value {get;}
|
19 | 24 |
|
@@ -211,6 +216,8 @@ public void DestroyGenericArgumentState ()
|
211 | 216 | }
|
212 | 217 |
|
213 | 218 | [Test]
|
| 219 | + [RequiresUnreferencedCode ("CreateReturnValueFromManagedExpression")] |
| 220 | + [RequiresDynamicCode ("CreateReturnValueFromManagedExpression")] |
214 | 221 | public void CreateReturnValueFromManagedExpression ()
|
215 | 222 | {
|
216 | 223 | var runtime = Expression.Variable (typeof (JniRuntime), "__jvm");
|
@@ -335,7 +342,11 @@ protected override string GetExpectedReturnValueFromManagedExpression (string jv
|
335 | 342 | }
|
336 | 343 | }
|
337 | 344 |
|
338 |
| - public abstract class JniValueMarshaler_BuiltinType_ContractTests<T> : JniValueMarshalerContractTests<T> { |
| 345 | + public abstract class JniValueMarshaler_BuiltinType_ContractTests< |
| 346 | + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] |
| 347 | + T |
| 348 | + > : JniValueMarshalerContractTests<T> |
| 349 | + { |
339 | 350 | protected override bool IsJniValueType {get {return true;}}
|
340 | 351 |
|
341 | 352 | protected override string GetExpectedReturnValueFromManagedExpression (string jvm, string value, Expression ret)
|
@@ -442,8 +453,11 @@ public class JniValueMarshaler_NullableDouble_ContractTests : JniValueMarshalerC
|
442 | 453 | protected override double? Value {get {return 8D;}}
|
443 | 454 | }
|
444 | 455 |
|
445 |
| - public abstract class JniInt32ArrayValueMarshalerContractTests<T> : JniValueMarshalerContractTests<T> |
446 |
| - where T : IEnumerable<int> |
| 456 | + public abstract class JniInt32ArrayValueMarshalerContractTests< |
| 457 | + [DynamicallyAccessedMembers (DynamicallyAccessedMemberTypes.PublicConstructors | DynamicallyAccessedMemberTypes.NonPublicConstructors)] |
| 458 | + T |
| 459 | + > : JniValueMarshalerContractTests<T> |
| 460 | + where T : IEnumerable<int> |
447 | 461 | {
|
448 | 462 | protected abstract T CreateArray (int[] values);
|
449 | 463 | protected abstract string ValueMarshalerSourceType {get;}
|
@@ -647,7 +661,11 @@ public DemoValueTypeValueMarshaler ()
|
647 | 661 | Int32Marshaler = JniRuntime.CurrentRuntime.ValueManager.GetValueMarshaler<int> ();
|
648 | 662 | }
|
649 | 663 |
|
650 |
| - public override DemoValueType CreateGenericValue (ref JniObjectReference reference, JniObjectReferenceOptions options, Type targetType) |
| 664 | + public override DemoValueType CreateGenericValue ( |
| 665 | + ref JniObjectReference reference, |
| 666 | + JniObjectReferenceOptions options, |
| 667 | + [DynamicallyAccessedMembers (Constructors)] |
| 668 | + Type targetType) |
651 | 669 | {
|
652 | 670 | var v = Int32Marshaler.CreateGenericValue (ref reference, options, typeof (int));
|
653 | 671 | return new DemoValueType (v);
|
|
0 commit comments